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

Is there a way to set some value to scratchpad in the script include and pass the same to business rule

lingamgunta_mah
Kilo Contributor

Hi,

Is there a way to add some value to scratchpad variable in the script include and pass the same scratchpad to business rule like we have the display business rule to retrieve the database value using g_scratchpad and pass it same in the client script.

Thanks,

Mahesh.

5 REPLIES 5

marcguy
ServiceNow Employee
ServiceNow Employee

you could call the script include in the business rule and populate scratchpad with the results.



g_scratchpad.variable = new scriptInclude().returnSomething();


Hi mguy,



Thanks for your reply. But i want it in the opposite way.Below is the scenario.



There is a catalog method to update the assigned to of a records to new person. and This change they are doing it in the script include through glide Ajax.


When there is a change in assigned to, there is a business on the same table with condition after the assigned to changes and runs   the script. So here i want set a condition in such a way that when the change is happening from the method don't run this BR. I know we can introduce a flag value and set to true in the script include and add this condition in the business for not executing. I can have one more Business rule to reset this flag value to false again and with order so that first it will check the lower order BR first and execute the other BR.



Is there a way we can achieve this with scratchpad. Or any other solution which will be possible. Our client is not accepting to create a new filed in the table.



Thanks,


Mahesh.


marcguy
ServiceNow Employee
ServiceNow Employee

could you update the record with setWorkflow(false);?



gr.setWorkflow(false);


gr.update();



this updates a record without running business rules so if you want the record to be updated 'silently' you could use this maybe?


If i set gr.setWorkflow(false); it skips running other business rules.



Thanks,


Mahesh.