You need to sign in to do that
Don't have an account?
Flow to create Work Order Line Item records from previous Work Order
I am attempting to create a flow that will trigger when a work order is created with a specific criteria and create work order line item records that were under the previous work order.
So far I have done the following:
Get Records on the Work Order Line Item object based on the work order ID. I would store multiple records and automatically store all fields
Then I have created a loop through each record.
Inside the loop I create a record one by one using seperate rescources and literal values and set the values of the fields within that record.
What am I doing wrong?
Thanks in advance!
Thank you for reaching out to the community.
May I recommend you please add a list variable to store the record inside the loop and then use create records outside of the loop using the list variable?
I hope this will resolve your issue. Please do let me know if you need any further information on this.
Thanks & Regards'
Nagarjuna
As you are doing DML operation inside the For Loop it may cause issue. It is always recommended to do DML operation outside the for loop.
Create a variable of type record which accepts multiple variables and assign the records and outside the for loop create the record .
Please find the below example (https://www.salesforceben.com/salesforce-flow-loops-best-practices-and-examples/) for similar requirement.
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,
When I create a work order and add work order line items records manually I do not receive such an error.
Can you share the screenshots of each element of the flow so can check and let you know the issue.
Thanks,
The only issue in the flow which I feel is Your are assiging ProductId to the WOLI. Can you assign AssetId and also Workorderid is missing assignment(Assign Individual WOLI) because of which you are getting .
Can you modify those and try again.
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,
Hi Sai,
We do not use Asset ID, we use the Pricebook Entry ID which has the label Product ID.
I added an additional assignment in the Assign Individual WOLI for:
WOLIRecord>Work Order ID to be equal the loop variable work order ID.
This time I didn't get an error but the process didn't work. The WOLI records were not created at all. Also during debugging I noticed 9 records were passed to the Create WOLI element when only 3 record were present.
If possible can we connect over and check excat issue so can try to resolve it.
Thanks,
I can arrange that in my sandbox. Please reach out to me at amalhabib@lkqcorp.com
I cannot reach over email. I will keep eye on developer forum. If you need any help we can connect over gmeet .
Thanks,