- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 09:24 AM
Hello.
I´m facing a challenger requirement.
We have the bellow UI Action that changes value on field "assignment_group" according to the queries bellow.
The goal is: avoid to update the record. We need to only show the result of the query, according to the conditions, onto the field "assignment_group". So, after user´s decision to really change the field to assigned group shown, he can save and update the record.
It possible to avoid the update, any kind of "setValue"... ? I´m out of ideas.
I already used "current.setAbortAction(true);", but it does not match our requirements.
Thanks in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 09:43 AM
You can't use initialize function
autoAssignedGroupGA.addParam('sysparm_name', 'initialize');
Leave the initialize as it is. And create a new function in the script include and call that function.
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 09:43 AM
You can't use initialize function
autoAssignedGroupGA.addParam('sysparm_name', 'initialize');
Leave the initialize as it is. And create a new function in the script include and call that function.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 03:57 AM
Thank you so much, Sanjiv.
I renamed the function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2024 10:17 PM
HI @Walmag Castro S ,
I trust you are doing great.
Please find the modified script as given below :
// Code to run without 'onclick'
// Ensure call to server-side function with no browser errors
if (typeof window == 'undefined') {
runServer();
}
// Server-side function
function runServer() {
// CONFIGURATION ITEM
var ciGR = new GlideRecord('cmdb_ci_business_app');
ciGR.addQuery('name', current.cmdb_ci.name);
ciGR.query();
// CATEGORY AND SUBCATEGORY
var tableGR = new GlideRecord('dl_u_assignment');
tableGR.addQuery('category', current.category);
tableGR.addQuery('subcategory', current.subcategory);
tableGR.query();
// Set the workflow to false to avoid unnecessary actions
current.setWorkflow(false);
if (current.contact_type == 'redphone') {
current.assignment_group = gs.getProperty('xpto.GROUPS.xxx');
current.assigned_to = '';
gs.addInfoMessage('Assignment Group will be set to: ' + current.assignment_group);
} else {
if (ciGR.next()) {
if (ciGR.support_group != '' && current.assignment_group != ciGR.support_group) {
current.assignment_group = ciGR.support_group;
gs.addInfoMessage('Assignment Group will be set to: ' + current.assignment_group);
} else if (current.assignment_group == ciGR.support_group) {
gs.addInfoMessage('Assignment Group already correctly assigned.');
} else {
if (tableGR.next()) {
if (current.assignment_group != tableGR.assignment_group) {
current.assignment_group = tableGR.assignment_group;
gs.addInfoMessage('Assignment Group will be set to: ' + current.assignment_group);
} else {
gs.addInfoMessage('Assignment Group already correctly assigned.');
}
} else {
gs.addInfoMessage('No Assignment Group.');
}
}
current.assigned_to = '';
} else {
if (tableGR.next()) {
if (current.assignment_group != tableGR.assignment_group) {
current.assignment_group = tableGR.assignment_group;
gs.addInfoMessage('Assignment Group will be set to: ' + current.assignment_group);
} else {
gs.addInfoMessage('Assignment Group already correctly assigned.');
}
} else {
gs.addInfoMessage('No Assignment Group.');
}
}
}
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 03:10 AM
Thanks, Amit. But it didn´t work. The info message shows the sys_id, but it does not populate the field assignment_group.