Onsubmit catalog client script

geogeorge
Tera Expert

Hi Team,

I've created an on-submit catalog client script that is intended to function exclusively on RITM records. This script is designed to initiate approvals based on specific variables, and the approval records should be linked to the RITM. However, after implementing it with a script include, I am experiencing issues with duplicate approval records being triggered. Additionally, I have heard from other users that using an on-submit catalog client script for RITM is not considered best practice. Do you have any suggestions?

6 REPLIES 6

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @geogeorge 

 

Better create the flow and use this variable to trigger extra approvals, that is the best way.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron
Tera Patron

@geogeorge 

that's correct, don't use onSubmit.

Approvals should be generated via either Workflow or Flow whichever is associated to your catalog item.

Ensure you add the approvals there

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Abhishek_Thakur
Mega Sage

Hello @geogeorge ,

@Dr Atul G- LNG  & @Ankur Bawiskar  said a valida point. It is not recommended to use the onsubmit catalog client script.

You need to trigger the approval either via the workflow or flow designer.

 

Please mark my solution as accepted and give thumbs up, if it helps you.

Regards,

Abhishek Thakur

geogeorge
Tera Expert

The workflow or flow designer won't be effective in this case since we need to generate approvals for RITM records based on variables that are hidden in the catalog and SCTask view. Ideally, when users are selected in the RITM variable section and saved, it should initiate the approval process. In the meantime, we've developed a UI button with events that triggers a script action, which is functioning as intended. Do you have any insights on why it's not recommending the use of onSubmit client scripts for generating approvals in RITM, and why it is causing duplicates?