UI Action not working on single click ,double click only it's working

Raj90
Tera Guru

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".

find_real_file.png

The below one is UI Action:

find_real_file.png

 

Thanks

11 REPLIES 11

Ankur Bawiskar
Tera Patron
Tera Patron

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

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.

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

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