The CreatorCon Call for Content is officially open! Get started here.

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

Iraj Shaikh
Mega Sage

Hi @Suyash Joshi 

I have created 'Set to Service Desk' UI action on incident table for your reference.


Condition: gs.hasRole('itil') && current.assignment_group != gs.getProperty('Service Desk group')
'Set to Service Desk' button will be visible only when the logged-in user has itil role and the 'Assignment group' field is not 'Service Desk' group. You can modify it as per your requirement.

Script:
Some incidents may already contain 'Assigned to' field set and that user may not be a member of service desk group. So, it causes issue. Hence, clearing assigned to field whenever the 'Set to Service Desk' button is clicked.

 

 

// Server-side script for the UI action
if (typeof window == 'undefined') {
	
    // Set the 'Assignment Group' to 'Service Desk'
    current.assignment_group = gs.getProperty('Service Desk group');

    // Clear the 'Assigned to' field
    current.assigned_to = '';

    // Update the record with the new values
    current.update();

    // Redirect the user to the updated record
    action.setRedirectURL(current);
}

 

 


Screenshot 2024-01-24 at 12.49.19 PM.png

 

You also need to create new system property that will contain sys_id of 'Service Desk' group
Screenshot 2024-01-24 at 12.50.42 PM.png

Please mark this response as correct or helpful if it assisted you with your question.

Hi @Iraj Shaikh 
It seems your logic is true but it is not working I want to display value of service desk if any assignment group is select.