Based upon assignment group, category fields to show dynamically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2021 02:33 AM
Create a category- assignment group mapping table and write client script and script include to handle the show hide if the category, if assignment group is not "software", category and subcategory related to software are not supposed to show up in the incident form.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2021 12:24 AM
Hi,
So where are you stuck?
which script are you using?
Did you try to debug those?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2021 11:05 PM
Create a reference field named 'Assignment group manager' referring to sys_user table on the incident form.
Place it next to assignment group field in the form.
After you update the form with group value in assignment group field,the related group's manager value must be displayed on the 'Assignment group manager' field.
how to do this
var ass_group = current.assignment_group;
var gr = new GlideRecord("sys_user_group");
gr.addQuery("sys_user",ass_group);
gr.query();
if(gr.next())
{
var manager = gr.assignmentgroupmanager;
current.u_assignment_group_manager=manager;
}
it didnt worked

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2021 01:05 AM
Hi
I guess you can reach what you are heading for with a NO-CODE solution using UI Policies.
Check the condition on the category assignment group and show/hide the other field using UI Policy Actions.
Using the NO-CODE way is always easier to maintain, and you should go No-Code wherever possible.
Let me know if that answers your question and mark my answer as correct and helpful.
BR
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2021 08:15 PM
Hi All,
on changing the "Assignment group", an auto "onchange" client script method will gets triggered in incident form. Here, works the scenario but getting added on each change of assignment group , instead of adding the category, need to select the required one.
Below is the code:
Clientscript:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var cat = g_form.getValue('assignment_group');
alert(cat);
var ga = new GlideAjax('clientscriptprocessing');
ga.addParam('sysparm_name', 'getAssignmentGroup');
ga.addParam('sysparm_assignmentgroup', cat.toString());
ga.getXML(getAssignmentGroup);
function getAssignmentGroup(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
g_form.setValue('category', answer);
}
}
Scriptinclude:
var clientscriptprocessing = Class.create();
clientscriptprocessing.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getAssignmentGroup: function() {
gs.info("Assignment Group set from Incident Lookup form");
var assignment_group = this.getParameter('sysparm_assignmentgroup');
gs.info("assignment_group", +'assignment_group');
var gr = new GlideRecord('u_category_assignment_group');
gr.addQuery('u_assignment_group', assignment_group);
gs.info("query on this added", + assignment_group);
gr.query();
if (gr.next()) {
return gr.u_category.getDisplayValue();
}
},
type: 'clientscriptprocessing'
});