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
Roopa S 1Roopa S 1 

hi....someone help me to write a trigger

1. Whenever a user tries to close a work order(change the order status of work order to closed/completed), ensure that it does not have 0 work detail lines associated
   with it.
   Also, check if any of the work detail lines are in open status, the user should see the error
   that : 'The work order cannot be closed since there are no associated work detail lines or the related work detail lines are open.'
   
   Whenever a work order is closed,  on all the related work detail lines,  the Work Order Status(text field) should be updated as : Work Order is closed.
   Also, ensure, once the work order is closed, the user should not be able to modify any of the related work detail lines. The system should restrict the user through a custom validation.  
  
 Also, on successful closure of the work order, the closure status(text field) should display the following info in the same format:
     Start Time of WDL1 : Value
 End Date Time of WDL1 : Value

 Start Time of WDL2 : Value
 End Date Time of WDL2 : Value
 
AbhinavAbhinav (Salesforce Developers) 
HI Roopa,

This is detailed implementation requirements . I would suggest post specific issue on forum which you face while implementing  so that community can help you better.

Thanks!
Abhinav
Roopa S 1Roopa S 1
@Abhinav I'm facing difficulty in implementing logic could you please help me out with logic Thanks Roopa