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

@SANDEEP28 could you please help me on this, i have shared the code written in script include in the below comment.

 

 

Thanks,

Abdul

SANDEEP28
Mega Sage

@Abdul333 Your code contains multiple logics. I can see you checking incident update time, user is part of previous assignment groups, incident state, work schedule of assignment group. Now you want to add new logic of 2 hours.

 

Could you please brief you requirement here

@SANDEEP28 yeah sure.

If an incident 

State is In-Progress

Assignment group is Not Empty

Assigned to is empty.

 

If the ticket is not updated upto 5hours and then the Reminder button will be visible for previous assignment group members.

Once reminder sent, the next 2hours button will not be visible for previous assignment group members.

 

All these scenarios work under Business hours(SLA) of current assignment group.

 

 

Thanks,

Abdul

SANDEEP28
Mega Sage

@Abdul333 In your requirement one part is if ticket is not updated for 5 hours then show the "Send reminder" UI action and second part is show "Send reminder" UI action after 2 hours once reminder is sent. 

 

If we build code with both these conditions then Send reminder UI action will be visible after 2 hours even if ticket is not updated for 2 hours. 

 

these are contradictory statements