How to get action name in a Business Rule (Server Side script)

harinalamalapu
Giga Expert

I know 'g_form.getActionName()' can be used in client-side script to identify the action name, what is the equivalent command on a server-side script ? I will need to identify the action that triggered the business rule to add a condition (on the business rule condition field or the script) based on that.

11 REPLIES 11

Mihir Mohanta
Kilo Sage

Use current.operation() function to get the action name in server sided script.



Please go through below link for your reference.



Scripting in Business Rules - ServiceNow Wiki



Thanks,


Mihir


Thank you Mihir for your quick response. I used the 'current.operation('copy_change_request')' in the following context and found it returned null. Any thoughts?



I am implementing a Business Rule as discussed in the question - Point Create New to Record Producer. I am adding a condition in the business rule (when action='copy_change_request') to not to redirect to Record Producer when the 'Copy Change' (It also creates a new Change but copies from another change) is the UI Action or the Trigger.


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Hari,



current.operation(): // It retrieves the current operation being performed, such as insert, update, delete, etc.


In your use case you have to identify the field you want to decide the action upon.


Thank you Pradeep. I will need to identify the event causing the new record being created on the change and handle accordingly. In this case, I need to identify the 'Copy Change' UI Action as the trigger creating the new change. Do you have any thoughts on how to achieve this ?