UI action

Anusha Medharam
Tera Contributor

I have created one UI action when login user click that UI action remove his name from assigned to  and state changes to new but when click UI action it asking please select records. Without selecting can we remove login user name from assigned field and state changes to new.

 

gr = new GlideRecord('sn_customerservice_case');
gr.addQuery('assigned_to', gs.getUserID());
gr.addQuery("state","10");
gr.query();
var count =0;
while (gr.next()) {
    gr.assigned_to = '';
    gr.state = '1';
    count = count+1;
    gr.update();
}
if(count>0){
    gs.addInfoMessage(count+" Cases has been moved to New State and assigned to name removed too")
}else{
    gs.addInfoMessage("There are no Open Cases assigned to :"+gs.getUserDisplayName());
}
1 ACCEPTED SOLUTION

@Anusha Medharam i just checked it in my PDI .It OOB behaviour for list banner type UI action .

You have to select records and then proceed with the script .Otherwise it wont run the code.

 

Hope this helps 

Mark the answer correct if this helped you

Thanks

View solution in original post

17 REPLIES 17

Yes it is working in list view.

Why did you check client callable option in script include and UI action.

Initially I thought I am going to use it. But it turns out, doesn't required if you wish you can modify the script to run on server side as well. But I will prefer this method in case we wanna do any future modifications for example showing confirmation box before removing assigned to.