RE: How to get quantityfulfilled and quantityreceived on line level status?
Hi,
I need to get these 2 fields quantityreceived, and quantityfulfilled, In the saved search the fields are not available, however, I can find them with the field explorer but cannot use them in the transfer orders script.
Thank you in advance!
No, it is not possible to get the quantityfulfilled and quantityreceived fields with record.load(). The record.load() method only loads the fields that are defined in the transfer order schema. The quantityfulfilled and quantityreceived fields are not defined in the transfer order schema, so they cannot be loaded with record.load().
To get the quantityfulfilled and quantityreceived fields, you can use the sc_item_receipt.get() and sc_item_receipt.get_received_quantity() methods. The sc_item_receipt.get() method returns the item receipt record for the specified transfer order line item. The sc_item_receipt.get_received_quantity() method returns the quantity of the item that has been received for the specified item receipt record.
Once you have the quantityfulfilled and quantityreceived fields, you can use them in the status formula to get the correct status. The following formula will return the correct status based on the quantityshiprecv, quantityfulfilled, and quantityreceived fields:
Python
def get_status(quantityshiprecv, quantityfulfilled, quantityreceived):
if quantityshiprecv != quantityfulfilled:
return ‘Pending Receipt/Partially Fulfilled’
elif quantityshiprecv != quantityreceived:
return ‘In Transit’
else:
return ‘Completed’
Use code with caution. Learn more
You can use the following code to get the quantityfulfilled and quantityreceived fields and use them in the status formula:
Python
import pandas as pd
df = pd.DataFrame({‘quantityshiprecv’: [10, 5, 15],
‘quantityfulfilled’: [5, 10, 15],
‘quantityreceived’: [5, 10, 15]})
def get_status(df):
df[‘status’] = df.apply(lambda x: ‘Pending Receipt/Partially Fulfilled’ if x[‘quantityshiprecv’] != x[‘quantityfulfilled’] else ‘In Transit’, axis=1)
return df
df = get_status(df.copy())
print(df)
Use code with caution. Learn more
Output:
quantityshiprecv … status
0 10 … Pending Receipt/Partially Fulfilled
1 5 … Pending Receipt/Partially Fulfilled
2 15 … In Transit
[3 rows x 4 columns]
It is not possible to use quantityshiprecv for both quantityfulfilled and quantityreceived fields. The quantityfulfilled field represents the quantity of the item that has been fulfilled, while the quantityreceived field represents the quantity of the item that has been received.
If you use quantityshiprecv for both quantityfulfilled and quantityreceived fields, the status formula will always return the In Transit status. This is because the quantityshiprecv field will always be greater than or equal to the quantityfulfilled and quantityreceived fields.

This is the most obvious chatGPT answer I’ve ever seen, and is wrong to the degree that it’s using Python?!!