Fetches all PurchaseOrders and RequisitionOrders linked to a specified Target.

Parameters

target_id

The ID of the Target.

target_type

The type of the Target. It is an integer from 1-6, which corresponds to one of the following types:

  1. Contract
  2. Customer
  3. Quote
  4. Appointment
  5. Department
  6. Location

Example

This example fetches orders linked to an Appointment:

FM_api('Target_getOrders', ['id' => '123', 'type' => '4']);

Result

On Success

An example showing two PurchaseOrders and two RequisitionOrders:

[{'ro_id':'1','status':'0'},{'ro_id':'2','status':'1'},{'po_id':'1','status':'1'},{'po_id':'2','status':'0'}]

On Failure

If the User is not logged in:

{'error':'not logged in'}

If there is no Target ID provided:

{'error':'no target ID provided'}

If there is no Target type provided:

{'error':'no target type provided'}