cancel
Showing results for 
Search instead for 
Did you mean: 

Updating a service_order (work order) in test class seems to exceed SOQL limit

Grill Chef
Grill Chef

Updating a service_order (work order) in test class seems to exceed SOQL limit

I am trying to test a function that copies a custom field, shipping comments of SVMXC__Component__c (Installed Product), which is a field on Work Order and put it as the shipping comments of the Work Order itself.

I do this in a before Update trigger on Work Order.

But when I run my code I get a DML exception: ""System.DmlException: Update failed. First exception on row 0 with id a1Yg0000001u1kmEAA; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ServiceMaxWorkOrder: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 500g0000005QsqjAAC; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, SVMXC.CASE_Trigger1: execution of BeforeUpdate caused by: System.LimitException: SVMXC:Too many SOQL queries: 101 (SVMXC) : []". It seems as though the installed trigger CASE_Trigger1 throws this error. Did anyone have this sort of error before or have any idea where this error might originate from?

Thanks in advance.

Highlighted
Sushi Chef
Sushi Chef

Re: Updating a service_order (work order) in test class seems to exceed SOQL limit

We have had a number of issues with System.LimitException: SVMXC:Too many SOQL queries: 101 (SVMXC), ours have been on the iPad and we were advised to change SET011 to 40%.

Roast Chef
Roast Chef

Re: Updating a service_order (work order) in test class seems to exceed SOQL limit

This will definitely help - decreases the batch size, thereby reducing the possibility of hitting governor limits

However, using Airplane Mode can still bypass this, causing a single "sync batch" to be overloaded - on the flip side, Airplane Mode has MANY benefits, for us it has decreased call closure time significantly

The feature request i refer to below would help balance the cons of Airplane Mode - please vote for it if this would be useful for you!

0 Likes
Reply
Roast Chef
Roast Chef

Re: Updating a service_order (work order) in test class seems to exceed SOQL limit

I have submitted an enhancement request to the Product Hub:

[For Mobile Devices:]

Basically, if SOQL limit is hit - have records go to the "Sync Conflicts" tab - allowing records to be re-released manually in smaller batches, hopefully allowing processing without error.

As of right now all updated records get "stuck" together in a single batch - and only way to clear the error or get a Data Sync to go through is to do a full Reset App (full mobile wipe AND redownload of all data) - resulting in full data loss

Would help a lot considering that "Airplane Mode" is a best-practice for the mobile app versions