+ Start a Discussion
Callum Van Den HoekCallum Van Den Hoek 

FSL Trigger Exceeding Apex CPU Time Limit

I am attempting to integrate Salesforce using some middleware. 

What the integration does it take an Excel sheet, and from that sheet create a Work Order, Service Appointment and Assigned Resource record for each row.

When I run this integration, the Work Order and Service Appointments are created as expected - however, the AssignedResource creation fails, with the following error message: 
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY:FSL.TR021_AssignedResource_AfterInsert: System.LimitException: Apex CPU time limit exceeded:--

Judging from this error message, it seems that there is a trigger on the AssignedResource object which is exceeding the CPU time limit. The trigger is part of the FSL managed package, so it can't be disabled or changed.

Does anyone know what this trigger does, and if there is a way to disable it or work around the issue to avoid the error?
Danish HodaDanish Hoda
hey Callum,
I'll suggest you to create two Queueable classes to create 
1. Work Order
2. Service Appountment
I think with one of these classes, Assigned Resource record(s) is/are getting created which is firing the trigger. With this approach you can fix the Apex CPU time error coz the queuable classes run asynchronously.