Change display value in list collector without changing display value on referenced table

triborro
Tera Contributor

I have a specific workflow in which we are taking SAM account names, plugging them into a PS script and running some functions on user accounts. I have a record producer that allows a user to select the accounts that need to be reported to IT for updating, which copies the values selected from sys_user to an incident ticket.

 

Currently this works just fine with one hang-up: the displayed value in the list collector, and the value sent to the incident ticket, are both from the 'name' column on sys_user. I would prefer the displayed value and returned value to both be the 'user_name' field from sys_user without having to change the display value on the sys_user table.

 

In other words, my question is: Can we have an individual list collector display from a different column than what is set as the display value on the referenced table?

 

For reference, I copied the OOB incident script to the RP with some slight modification:

 

var isMobile = GlideMobileExtensions.getDeviceType() == 'm';
var link = isMobile ? '#/!list/incident/q:active=true%5Ecaller_id=javascript:gs.user_id()%5EEQ' : 'home.do';

var linkLbl = isMobile ? "List" : "Homepage";
var br = '<br/>';
var linkURL = '<a href="' + link + '">' + gs.getMessage(linkLbl) + '</a>';
var msgArgs = [br, linkURL];

var info = gs.getMessage("This incident was opened on your behalf{0}The IT department will contact you if they need any further information{0}You can track status from this {1} {0}", msgArgs);

gs.addInfoMessage(info);
var caller = gs.getUserID();
var parent_table = RP.getParameterValue('sysparm_parent_table');
if (JSUtil.notNil(parent_table)) {
	var parent_map = new GlideRecord('request_parent_mapping');
	parent_map.addQuery('parent_table', parent_table);
	parent_map.query();
	if (parent_map.next())
		var requested_for_field = parent_map.getValue('requested_for_field');
	var parentGR = new GlideRecord(parent_table);
	parentGR.addQuery('sys_id', RP.getParameterValue('sysparm_parent_sys_id'));
	parentGR.query();
	if (parentGR.next())
		caller = parentGR.getValue(requested_for_field);
}

current.contact_type = 'self-service';
current.caller_id = caller;
// if (producer.comments.length > 80)
// 	current.short_description = producer.comments.substring(0, 79);
// else
// 	current.short_description = producer.comments;
current.short_description = "Extend accounts for the following contractor(s)";

var names = producer.u_contractor_name.getDisplayValue();

names = names.split(',');

for (var i = 0; i < names.length; i++) {
    current.description += names[i].trim() + '\n';

}
	
current.impact = 3; // Set Impact to Low
current.urgency = 3;
current.assignment_group = '2617f6ae1bd98c10485cdb1dcd4bcb1f';

var incRPUtil = new LinkRecordProducerToIncident();
incRPUtil.linkRecordProducerToParentIncident(RP.getParameterValue('sysparm_parent_sys_id'), current);

 

0 REPLIES 0