function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Aaron Persich 9Aaron Persich 9 

Flow, Process Builder, or Trigger to populate a warning field if related Assets are missing information

Hello,
 
As part of fulfillment process our manufacturing team works on Assets which are related to the standard Order object.  The manufacturing team needs to add either a Serial Number or a Voucher Code (text fields) to the related assets before they can complete their fulfillment.  This is an important step and is easily missed. 
 
What I would like to do is create a Ready For Fulfillment – picklist field on the Order which will query on all related assets. 

1)  If any or all asset do NOT have either a Serial Number or a Voucher Code then I would like the Ready For Fulfillment field to be set to "Not Ready". 

2)  If all Assets have at least one Serial Number or a Voucher Code then I would like the Ready For Fulfillment field to be set to "Ready".
 
Can I do this using a Flow, Process Builder or Trigger?
 
Thanks,

Aaron
John TowersJohn Towers
Process builder by itself won't work here because you can't use them to query child records. Either a flow (launched by a process) or a trigger would work.

If you're less comfortable with code and aren't sure about how to bulkify triggers or don't have development resources to maintain the code, you'll likely want to go with a flow that's kicked off by a process.

I would create a process that checks the status of the Order and launches a flow if it's ready for fulfillment. It would pass the Id of the Order into the flow and the flow would
  1. Retrieve the related Assets
  2. Loop over them to check for required information
  3. Update the Order status to either 'Ready' if all required information is filled in or 'Not Ready' if not all required information is filled in