RE: I need to fetch related records and Create new records with same details - D365 Field service
Hi Sayali,
From your description, I get following information:
Asset and Work order is 1:N relationship
Asset and Asset checklist is 1:N relationship
Work order and Work order checklist is 1:N relationship
Asset checklist and Work order checklist entities are custom entities you created?
You want to create Work order checklist with value from Asset checklist, right?
If so, maybe you can firstly use power automate to create an automated flow to achieve it, which is no-code and easier that code.
Go Power Automate(https://us.flow.microsoft.com/en-us/ )
2.Trigger
3.List rows action--Fetch Asset checklist for the asset that related to the new work order.
Note:new_assetid is logic name of the lookup field.
4.Add a new row action--create work order checklist with value from asset checklist.
5.Test.
One asset named 'asset1' has three asset checklist value.
when i create new workorder and select asset1, save and refresh current form, work order checklist records can created automatically.
Regards,
Leah Ju
Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.