The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Can g_scratchpad be triggered from a UI Action to be used in a Business Rule?

tahnalos
Kilo Sage

I have a UI action that is designed to trigger workflow, which then triggers a business rule.  However, I require that the business rule perform a specific action when only the UI action is triggered.

Would g_scratchpad work in this instance?  Granted, I've used g_scratchpad in business rules to trigger client scripts, and used g_scratchpad to trigger other business rules, but I am unsure if the developers thought of a case like UI Action->Workflow->Business Rule.

Thanks

5 REPLIES 5

Shillu
Kilo Guru

g_scratchpad object is used to pass information from server to client. It will not work in this case.

 

The g_scratchpad object provides a mechanism for passing information from the server to the client when the client requires information not available on a form. This can be accomplished by creating a business rule to put the information in the g_scratchpad object and accessing the information in a client script.

The SN Nerd
Giga Sage
Giga Sage

Use events to pass information to workflows and code logic (Event Actions)


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Raf1
Tera Guru

You can trigger an event from UI action and sent it to workflow using broadcast event. You can also use the same event in your business rule.

This previous post should give you an idea how to use broadcast event:

https://community.servicenow.com/community?id=community_question&sys_id=310a89d3db353b04d58ea345ca96...

 

 

SatheeshKumar
Kilo Sage

You can't trigger a business rule from UI action, You can use script include to do the same ,  also you can pass the required param to script include directly. BR can be triggered only when a database CRUD operation occurs.

if need only specific action to be perfomed on clicking UI action, create that asa function in script include and call that function from ui action.

g_scratchpad can be used only for passing details from server to client, vice versa is not possible.