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!

Rookie Asked on October 16, 2023 in SuiteScript.
Add Comment
5 Answer(s)

Don’t listen to those other answers. They’re spat out by chatGPT and are wrong.

Load the transfer order and use getSublistValue or getCurrentSublistValue with the field ids “quantityfulfilled” and “quantityreceived”. You can then compare these values against “quantity” to figure out the status of each transfer order line.

Of course, if the transfer order status is one of “Pending Fulfillment”, “Pending Receipt” or “Received”, you can already infer the status of all the transfer order lines (unlike statuses “Pending Receipt/Partially Fulfilled” and “Pending Receipt/Partially Fulfilled”)

Beginner Answered on October 18, 2023.
Add Comment

I understand that you need to get the fields quantity received and quantity fulfilled but they are not available in the saved search and you cannot use them in the transfer orders script.

Here are a few possible solutions:

  1. You could try to create a custom field that combines the two fields quantity received and quantity fulfilled. This would allow you to see both fields in the saved search and use them in the transfer orders script.
  2. You could try to use the field explorer to create a custom report that includes the fields quantity received and quantity fulfilled. This would allow you to see both fields in a single report, but you would not be able to use them in the transfer orders script.
  3. You could try to use the field explorer to export the fields quantity received and quantity fulfilled to a spreadsheet. This would allow you to work with the data in a more flexible way, but it would require manual intervention to update the transfer orders script.

Which solution is best for you will depend on your specific needs and requirements.

Beginner Answered on October 16, 2023.
Add Comment

Hi,

Thank you very much for your answer. Is there a way to get these filed with record.load() for example or it is not possible in the transfer orders script?  What could be the best way to get these fields and use them in the status formula to get ‘Pending Receipt/Partially Fulfilled’, or “In Transit” status correctly?

EDIT: Is it possible just to use quantityshiprecv, for both quantityfulfilled and quantityreceived fields?

Thank you

Rookie Answered on October 16, 2023.
Add Comment

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.

Beginner Answered on October 16, 2023.

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

on October 18, 2023.
Add Comment

In fact, I am using Suite Script 2.0 javascript. I will look at these getSublistValue or getCurrentSublistValue.

Thank you very much David_B.

Regards

Rookie Answered on October 19, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor