Transfer Order Lines Created via Custom TO Record Producer – Stages Not Working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi Community,
We have a custom Record Producer on the Transfer Order (TO) that is being used to upload/create transfer orders in bulk.
From the Record Producer script, we are calling a custom Script Include, which contains the logic to create the Transfer Order Lines (TOLs).
We are facing two issues with the TOLs created through this approach:
- The stages are not progressing/working as expected for the TOL.
- We noticed that a Receive Task is being created instead of a Fulfillment Task for the TOL.
When the TO/TOL is created through the standard ServiceNow process, the stages and tasks appear to work as expected.
We would like to understand:
- What determines whether a Fulfillment Task or Receive Task is created for a Transfer Order Line?
- Which fields/conditions on the Transfer Order and Transfer Order Line are evaluated to determine the task creation?
If anyone has implemented bulk Transfer Order using a custom Record Producer, could you please share the recommended approach?
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Task creation isn't decided by the Transfer Order. It comes from the Template Task records in alm_template_task, matched on the model category of the line. So if the model category is empty or different at the moment your script inserts the line, you get the wrong task, which would explain the Receive Task showing up instead of a Fulfillment Task.
Stages work off the same chain. The workflow on alm_transfer_order_line drives them and calls the TransferOrderLineTemplateTaskAPI script include to build the tasks. If your script sets the stage field itself, or inserts the line before the model and model category are populated, that sequence breaks and the stages stop moving.
For bulk creation, set only the fields the standard process sets, so from stockroom, to stockroom, model, quantity and asset, then let the workflow do the rest. Leave stage alone and don't create any tasks yourself.
Worth checking what the model category holds on one of the lines your script created, compared with one from the standard process. That comparison usually shows it straight away.
Stage and task reference: https://www.servicenow.com/docs/r/it-asset-management/asset-management/r_SummaryOfTransferOrderStage...
Thanks
