- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 10:15 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 10:24 AM
Setworkflow(false) is used to stop running any Business Rule written on that table for insert/update.
Ex- You have list of incident and you want to change State = Closed.
in this case you run a script to closed all the incident but there are many Business Rules are written on incident table which run once incident get closed. like sending mail to requester,update any related records.
Since you don't want to sent notification so you can use setworkflow(false) to stop running any other script.
scratchpad
Uses to set a global variable which you can use in throughout the life of that record.
Uses - Requirement of any field value in client side which are not present in form (in this case, you won't use g_form.getValue())
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 10:21 AM
HI Sreenu
setworkflow() takes the parameter true or false. Mostly it is user with parameter false. When you are running any script and you want that any other script should not trigger because of your script then we use this function.
Scratchpad helps to use the same field values between client side and server side
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 10:22 AM
Hi Sreenu,
In server side when you query some table and try to insert or update record and if you use setWorkflow(false); it will stop the triggering of business rule on that table.
scratchpad has 2 purpose
a) workflow scratchpad -> if you define workflow scratchpad variable in first activity you can use it as global variable in that workflow and any activity after the initial run script which set this scratchpad can use this variable
Activity 1 - Run Script
workflow.scratchpad.userId = 'abc';
Activity 2- Run Script
var workflowVariable = workflow.scratchpad.userId;
b) business rule scratchpad - this is use to send information from server side to client side.
declare g_scratchpad in display business rule and use it in onLoad, onChange and onSubmit client script
http://wiki.servicenow.com/index.php?title=Using_the_Workflow_Scratchpad
http://wiki.servicenow.com/index.php?title=Client_Script_Best_Practices#Example:_g_scratchpad
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 10:24 AM
Setworkflow(false) is used to stop running any Business Rule written on that table for insert/update.
Ex- You have list of incident and you want to change State = Closed.
in this case you run a script to closed all the incident but there are many Business Rules are written on incident table which run once incident get closed. like sending mail to requester,update any related records.
Since you don't want to sent notification so you can use setworkflow(false) to stop running any other script.
scratchpad
Uses to set a global variable which you can use in throughout the life of that record.
Uses - Requirement of any field value in client side which are not present in form (in this case, you won't use g_form.getValue())
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2017 05:41 AM
Hi Sreenu,
Any update on this?
Can you mark answer as correct, helpful and hit like if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader