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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Jyotsna,

If you want to show only Security role information on catalog then separate table would be required.

In that table store all the Security roles since you don't have unique mapping.

Then on cmdb_ci_appl table create List type of field which would hold multiple values i.e. Read Only, Update

Remember creating custom table will have cost implication as per your ServiceNow subscription

please create 2 variables

1) application -  referring to cmdb_ci_appl table

2) Security Role - String type

onChange of application variable bring the Security role values on that string field as comma separated values

Regards
Ankur

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

jyotsna1
Giga Contributor

Hi Ankur,

Thanks for your reply!

I Stored all the security roles in a separate custom table and created a list field on cmdb_ci_appl table, but unable bulk upload data into my List field through transform maps though my data is in excel is comma separated. Its not taking all the values into Security ROles field on Application (cmdb_ci_appl) table

find_real_file.png

Its showing as below only 2 values are updated

find_real_file.png

Bulk upload should work if you send the values as comma seperated only in the excel.

Do one thing , right click Personalize the Dictionary of this Security Roles field, and increase the field length to 500 or something.

it should then hold all the values.

Let me know if it works.

Thanks,

Saji

Hi,

I believe the issue would be the length of your Import set field which holds the comma separated names; It might be truncating.

Please increase the field length of import set field which holds the names to 500

please use onBefore transform script instead of field map

sample script below

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

	// Add your code here

	var arr = [];
	var incomingValues = source.u_flare; // give here the import set field name

	var rec = new GlideRecord('custom table'); // give here the custom table name
	rec.addQuery('u_name', 'IN', incomingValues); // give here the name field on custom table
	rec.query();
	while(rec.next()){
		arr.push(rec.sys_id.toString());
	}

	target.security_roles = arr.toString(); // give here the field from cmdb_ci_appl table

})(source, map, log, target);

Regards
Ankur

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