UI action should update 2 times

Vinay49
Tera Expert

Hello all,

 

we have UI action(propose resolution) on case form. When we click on it, case state will go to "resolved"
now my requirement is when we click on ui-action, intially state should go to "open" after 2/3 seconds state should change to resolved.
exisiting code in UI action:

if(current.close_notes.nil()){
    gs.addErrorMessage(gs.getMessage("Please specify solution in close notes"));
    action.openGlideRecord(current);
    current.setAbortAction(true);
}
else {
    current.state.setValue('6');
    current.u_awaiting_for.setValue('');
    current.update();
}

Why this:
We have an integration b/w 2 snow instances. when case is created, incident is created in other instan(with state mapping).
Case                    Incident
Open                    inprogress
awaiting info       onhold
resolved               resolved

closed                    closed 
when case is in awaiting info, there is posiblity to resolve the case. howevere, it is not possible to move the state from onhold to resolved on incident form.

So we thought of changing the UI action like this. Please suggest.

2 REPLIES 2

Tony Chatfield1
Kilo Patron

Hi, I would not consider this to be a best practice approach.
A better solution would be to check the state of the parent\driving record and set the available UI actions according to your state flow. IE if your Incident is not in a suitable state to allow state X to be chosen in case, then use a client script to hide it/prevent it from being selectable.

Ankur Bawiskar
Tera Patron
Tera Patron

@Vinay49 

I won't recommend this.

Why not have a flow configured to trigger when record is updated to Open? flow runs async so it will run after sometime

If my response helped please mark it correct and close the thread so that it benefits future readers.

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