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

jyotsna1
Giga Contributor

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.

find_real_file.png

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!

28 REPLIES 28

jyotsna1
Giga Contributor

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();

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi,

try this in advanced ref qualifier of 2nd variables

javascript: 'sys_idIN' + current.variables.<variableName><list_field>;

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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  

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader