How to hide a button once it is submitted

Abdul333
Tera Contributor

Hello All,

 

I created a button in incident form called "Send Reminder".

Once it is submitted need to hide the button, generally while refreshing it is hiding.

it is needs automatically refresh the form once submitted.

 

function onClick(g_form) {
    var answer = confirm('Should reminder be sent to all agents of currently assigned group?');
    if (answer == false) {
        return false;
    }
    //gsftSubmit(null, g_form.getFormElement(), 'send_reminder');
g_form.submit(g_form.getFormElement());
//alert('Submit button testing');
}
if (typeof window == 'undefined')
    runServerCode();
 
function runServerCode() {
    gs.eventQueue('incident.sendreminder', current, 'current.assignment_group');
//alert('testing incident assignment group');
    action.setRedirectURL(current);
    gs.addInfoMessage("Reminder sent successfully");
//alert('checking add info message');
}
 
please check my code and correct me so that it will get auto hidden once submitted.
 
 

please help me on this.

 

@SANDEEP28 @Ankur Bawiskar 

 

Thanks,

Abdul

 

13 REPLIES 13

Mohith Devatte
Tera Sage
Tera Sage

Hello @Abdul333 ,

Is there any field change on the form happenng when you click this button ?

 

if yes , you can use that field as a visibility condition of your UI action and then hide it 

 

 

@Mohith Devatte no field is changing, it will send the notification.

please help me on this, can we write directly in UI Action Script so that it will hide automatically once submitted?

 

 

Thans,

Abdul

M Ismail
Tera Guru

Hi @Abdul333 ,

For UI action you could do: action.setRedirectURL(current);

For client script you could do: location.reload() Location Reload Method

Please mark reply as Helpful/Correct, if applicable. Thanks!

Please mark my reply as Helpful and/or Accept Solution, if applicable.

Thanks!

SANDEEP28
Mega Sage

@Abdul333 Refer my solution in below post. It will help you.

 

https://www.servicenow.com/community/itsm-forum/how-to-make-custom-ui-action-disable-on-condition/m-...

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!