We’ve developed some resources to help you work effectively from home during COVID-19 Click to learn more

Crmscript execution gives timeout for long running tasks

Hi there

 

First of all, CRM Script is awesome!

I have made some scripts made for massprocessing all sorts of things, like mass creating sales based on a selection, and things like that. Nothing specific needs to be mentioned, as the scripts are working as they should.

 

My problem however, is of a more technical nature, which is why i'm writing here.

Whenever i run a script that works with processing a small amount of items like 250, gets to take a long time to execute when doing the same script for 11000 items which is understandable. The thing is, i experience that the server throws a 500 erorr, which seems to be due to some kind of timeout on the IIS - i know this is the case, because if i limit the script to a lower item count, and use "pagination" it works just fine - this means that it is not choking up on any items it is processing, and it basically throws  the error after an equal amount of running time everytime.

I thought that crmscript was executed in the ejscheduler service, and therefore not dependent on settings in IIS - anyone knows what i need to change in IIS in order to allow it to run to the end? I kind of get the same timeout for a heavy combination selection, in SO web. I just don't see the error in the gui, it basically just don't stop showing the loading animation, and i can see an error in the JS console.

 

Thanks in advance.

RE: Crmscript execution gives timeout for long running tasks

Hi,

What you can do is run your script using a scheduled task in Customer Service so that it is executed in the background. (Make sure you change the settings related to how long the task can run)

Note: if this is in online, there are additional limits related to RAM and execution limits.

Von: David Hollegien 22. Feb 2018

RE: Crmscript execution gives timeout for long running tasks

Hi there - i actually just figured that out myself and went back in order to update the thread, but you beat me to it :)

 

Thanks for the suggestion :)

Von: Dennis Aagaard Mortensgaard 22. Feb 2018

RE: Crmscript execution gives timeout for long running tasks

Hi,

We have developed a script for online environment. In this script we are calculating, based on current date, some deadline UDFields for all projects. There are more than 16.000 projects!

 

The problem is that the scripts ends after few minutes with this error:

EjScript::RunTimeException: An exception occurred in script: "" at: line 0, char 0 Original exception: EjScript::RunTimeException: Script is taking too long to execute. Execution time: 120.28, User CPU time: 3.09

 

Does anyone knows if (and how) it is possible to overcome these online tresholds (for execution timeout) so the script should run until the end (maybe it will need some hours!) ?

Thanks!

Von: Ovidiu Butisca 13. Nov 2019

RE: Crmscript execution gives timeout for long running tasks

Hello Ovidu,

You can solve this by processing the projects in batch, so for example take 1000 projects each time your CRMScript is run, and keep a date field for the last time you did your calculation per project, and then use that as criteria when selecting projects that you still need to process.

Von: David Hollegien 13. Nov 2019