Parallel execution of catalog client scripts. We are unable to see multithreading in execution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 12:28 AM
Hi we have noticed that , onchange catalog client script executes sequentially and not able to observe multithreading in PDI. I checked all thread in PDI , all were idle. Is behaviour same in PDI and Vendor instance regarding this issue?
Please help
- Labels:
-
Architect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2024 10:32 AM
Hi @Sachin,
Client scripts do not run on threads (as far as I can think of!) they run on the browser so unless you are calling a server-side code in it these are pretty much running on your browser. Secondly, may I know your use case here?
Do you mean you are running two client scripts with the same condition in the same order and you expect them to run parallel rather than sequentially?
-Harneet Sital
Request you please mark my answer as helpful or correct based on the impact
Find all my ServiceNow articles here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 03:14 AM
Thanks for your reply.
Let me explain you my case :
We have two onchange catalog client scripts having different orders.
Example onChange client script 1 with order 100
onChange client script 2 with order 200
both the client scripts makes an ajax call to the same script include and get some response from server side.
My query is , whether these catalog client scripts will run in sequence or in parallel?
I mean the 2nd client script will start once 1st client script completely finishes its execution?
or 2nd client script will have its independent execution flow?
or is it like both the client scripts will have sequential flow till the ajax call and later it will be in parallel depending on the ajax call response?
what is your thinking? would the whole flow be sequential, if so, in what sequence? or else part of it is parallel...then which part ?
Appreciate your help !
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 03:27 AM
@sachincalsoft thanks for sharing that information, makes it clear. With order, obviously the client script with order 100 will execute first, complete its execution, and then the client script with order 200 will start that's the whole meaning of having order on these scripts.
Now if the AJAX call is async then it may still be running but the execution of the scripts will be passed to the next client script with order 200 as the AJAX call was async.
Try creating two client scripts with just a basic alert in them with these configurations you mentioned and test them, if you want the first script to wait for the response and then run the second one then
1. Create a single script script and call the script in second script in the same code but only after the response is received
OR
2. Create the first script as a synchronous script that waits for the server response and then only proceeds to the second script.
-Harneet Sital
Request you please mark my answer as helpful or correct based on the impact
Find all my ServiceNow articles here