Need help regarding a requirement. On Applications(cmdb_ci_appl) table we want to have a field called Security role as a drop down(not unique for all applications) with different values.Each Application will have different security roles and we want
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2020 01:03 AM
Hi All,
Need urgent help regarding a requirement. On Applications (cmdb_ci_appl) table we want to have a field called Security role as a drop down(drop down values will not be unique for all applications) with different values. Each Application will have different security roles and we want to display these security roles on a catalog item form when an application (referenced to Application field on cmdb_ci_appl table) is selected.
Example application and their respective security roles as below. When Application is selected as 'Active Directory' on catalog form relevant security roles to be displayed under 'Security Role' field.
My question is how to populate 'Security Roles' for applications on cmdb_ci_appl table, once this data is sorted I can easily bring them on catalog form by referencing fields to cmdb_ci_appl table. Sicne the security roles are not unique for the applications, how do I populate them? Do I need to have another table to maintain these Security roles, if yes how can I populate them on cmdb_ci_appl table.
Anyone please through some light on this requirement.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2020 11:43 PM
Hi Ankur,
Thanks for your reply!
I tried putting advanced reference qualifier on to my Security roles field, but it did not show any values on catalog form when application is selected.
I also tried creating a Script Include and calling it in advanced reference qualifier of Security roles variable, ut it is not working shows all applications from cmdb_ci_appl on security roles field.
Below is the script, please check if this way works or suggest how could I achieve it
var CalSecurityroles = Class.create();
CalSecurityroles.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getNextAction: function() {
var securityList = '';
var applicationinfo = current.variables.application; // variable name of Application
var gr = new GlideRecord('u_application_security_roles'); // table name which is getting referred in the Security Roles field
gr.addQuery('u_security_role', applicationinfo); // field name of the table with which the query will be executed
gr.query();
while (gr.next()) {
if (securityList.length > 0) {
//build a comma separated string of groups if there is more than one
securityList += (',' + gr.sys_id).toString();
} else {
securityList = gr.sys_id.toString();
}
}
// return a list of card category available
return 'sys_idIN' + securityList;
},
type: 'CalSecurityroles'
});
Security Roles field referenced to: cmdb_ci_appl
Advanced Reference Qualifier on Security Roles field: javascript:CalSecurityroles();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2020 11:56 PM
Hi,
I assume your 2nd variable is of type list referring to custom table of security roles
to which variable you are applying the ref qualifier?
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-20-2020 11:59 PM
Hi,
try this in advanced ref qualifier of 2nd variables
javascript: 'sys_idIN' + current.variables.<variableName><list_field>;
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-21-2020 01:09 AM
Hi Ankur,
I tried below reference qualifier, it did not work for me.
javascript: 'sys_idIN' + current.variables.security_roles; // security_roles is the variable name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2020 01:53 AM
Hi,
so security_roles is variable which refers to cmdb_ci_appl table
you should use the list field from that in the advanced ref qualifier
javascript: 'sys_idIN' + current.variables.security_roles.<listField>;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader