UI action script for change any value to Service Desk

Suyash Joshi
Tera Contributor

Hello Everyone,

I need a requirement of UI action in which If user is select any group in assignment group the group changed to 'Service Desk' i try many time but it is not display my field just getting empty.

For the help Thanks in advance

Best Regards,

Suyash

11 REPLIES 11

Hello @Suyash Joshi ,

 

Please add below script.

var selectedAssignmentGroup = current.assignment_group;
if (selectedAssignmentGroup != '') {
	gs.info('assigned_to:'+current.assigned_to)
    if (current.assigned_to != ' ' || current.assigned_to != '')
    {
        current.assigned_to = '';
    }
    current.assignment_group = 'd625dccec0a8016700a222a0f7900d06'; //Add the sys_id of group or create property 
    current.update();
	action.setRedirectURL(current);
} else {
    gs.addInfoMessage('No assignment group specified. Nothing to update.');
}

 

Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Vaishnavi Shinde

 

Hi @VaishnaviShinde 

It still not change anything what I select previous is not change to service desk

Hello @Suyash Joshi ,

 

Is it possible to share the screen shots? Because the script is working properly at my end. Is there any Business rule or anything that is already written for this table?

 

Regards,

Vaishnavi Shinde

  

Hi @VaishnaviShinde 

There are no business rule active.

I want to ask one more thing when I am debugging my script I check the error and info message not display in the form but the same script run in business rule were able to be displayed, and after using background script the answer i am getting is false. I don't know whats the meaning of false but my script is:-

var gr = new GlideRecord('incident');
var a = 'current.assignment_group';
gr.query();
if(gr.next()){
gs.print('The answer will be :'+(a == 'Service Desk'));
}
gr.update();
I also send the ss to you can you help its an urgent business requirement purpose.

Best Regards,

Suyash

Hello @Suyash Joshi ,

 

Script is write. Have you change the SYS_ID of service desk assignment? Instead of adding gs.addInfoMessage() add gs.info() in UI action and check that in syslog table. what type of error are you getting while debugging? also add this info to line number 2 gs.info('selectedAssignmentGroup:'+selectedAssignmentGroup) also add one info inside the if.

 

Add watcher to assignment group field to check the scripts used for update assignment group or else you can also use script debugger. 

 

Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Vaishnavi Shinde