UI Action not working on single click ,double click only it's working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2019 12:10 AM
Hi All,
I have created one UI Action button on the Contract form. When we click on UI Button then the status is changed from "Draft" to "Under review".
This UI button we saw when Status in "Draft" only.
The problem is When we click(1st time) on "Send for Approval" button status is not changing, Again we click on(2nd time) "Send for Approval" button then the Status is changed from "Draft" to "Under review".
The below one is UI Action:
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2019 12:13 AM
Hi Raj,
You are checking whether attachment is present or not; if yes then change the state
Are you clicking on this button after attachment is added or before that?
Can you check by adding log statements
Remove current.setAbortAction(false) this is not required
Mark Correct if this solves your issue and also mark 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
‎05-22-2019 12:28 AM
If the attachment is attached before er click on UI button then the status is changed from Draft to Under review
Else it shows error "Attachment is mandatory "
Script:-
var attachmentGr = new GlideRecord('sys_attachment');
attachmentGr.addQuery('table_sys_id', current.sys_id);
attachmentGr.query();
gs.log("Test1");
if(attachmentGr.next()) {
current.u_status = "Under review";
//current.insert();
gs.log("Test2");
current.update();
//current.setAbortAction(false);
action.setRedirectURL(current);
gs.log("Test3");
}
else
{
gs.log("Test4");
gs.addErrorMessage("Please attach a file as an attachment");
current.setAbortAction(true);
gs.log("Test5");
action.setRedirectURL(current);
gs.log("Test6");
}
I used logs it shows (Test1, Test2, and Test3)
UI button not working properly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2019 12:31 AM
Hi Raj,
So you are saying current.update() is not working?
Did you check the choice value is correct for Under review?
With which user you are testing? admin user or end user?
Regards
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
‎05-22-2019 12:35 AM
current.update()---> working when we double click on UI button, but we need single click only
I'm Testing Admin User.
Currently, when we Double click on UI button then Status changed, but we need single click only
Thanks