calling getActionName to get a button action, it return 'undefined'.. not sure what is not right

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 10:55 PM
Hi,
Been spending so much time troubleshooting the approval button. Not sure what is not right.. there's a client script that make Comment field mandatory when reject an approval. That seems to not working for some reason.. I log a alert to check what it actually return for g_form.getActionName. The value is 'undefined', that explain why it doesn't set the 'comment' field mandatory. What I am not sure is why it return 'undefined' instead of the button action. I check the reject button action name is 'reject'. Does anyone experience this before? For rejecting a change request, this button works correctly but for rejecting a record from custom table I created this button doesn't work. Anyone has any idea?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2015 03:05 AM
Hi Abdul,
I have been using the below code in my workflow part for checking whether the UI action is clicked or not in wait for condition activity.
The same code is working fine in my DEV instance, but when I moved to PROD, getting the below error "action is not defined". Could you please check, I have checked and all looks similar to that of DEV. Could you please help me on this
if(action.getActionName() == "edmr_reopen"){
answer = true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2015 12:12 AM
Hi Vinoth,
I think in this scenario it is better to use workflow events for triggering the workflow from UI action. Please refer below link for more information.
https://community.servicenow.com/message/691399#691399
Hope this helps. Please let me know if you need more information.
Mateen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2019 02:02 PM
Hi Mateen,
I am try to get UI Action name in Business rule using action.getActionName(), but it is not working.
My requirement is, i want to stop running one specific BR after i press save Ui action on incident record.
Can you please help into this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2019 11:17 AM
It is a bit trickier. You have either use a field on table as a flag and add that as condition. Or use the feature of putSesssion and getSession
https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_ScopedGlideSessionGetClientData_String
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2015 05:15 AM
We were facing the same issue and the solution that we came up with is a below,
Update the UI Action
Modify the script to look like,
current.state = "rejected";
if(current.comments != '')//update is comments is not blank
current.update();
else{//Abort action if the comments are not filled
gs.addErrorMessage("Pls fill comments");
current.state = 'requested';
current.setAbortAction(true);
}
onLoad Client Script
Add a Client Script (onLoad) to complement the above Update made
function onLoad() {
try{
var ax = document.getElementsByClassName('outputmsg_text');
if(ax[0].innerHTML == "Pls fill comments")
g_form.setMandatory('comments',true);
}catch(error){}
}
Hope this helps.