Auto populate info on catalog item form

Balaji Ramanath
Kilo Contributor

Hi,

I am a newbie to catalog item form configuration and the below areas holding me to complete the form. 

1. Variable set - Reporting User Email/(would like to auto populate based on reporting user name from user table) - I have given the default value for 'Reporting User Email' as 'javascript:gs.getUser().getRecord().getValue('email');' but it still shows empty on the form. 

2. Variables - Affected User Name / Affected User Department - would like to auto-populate the user department info from the user table upon selecting the 'Affected user name'. 

Thanks. 

11 REPLIES 11

Hi,

so you will have to write onChange on Affected User name variable and use GlideAjax

Did you write script include and client script for that?

Regards
Ankur

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

Balaji Ramanath
Kilo Contributor

Ankur, I tried and but I am missing something. can advise? Screenshot attached.

Hi,

share script include script

also line 13 is incorrect because of this AffectedUser.Department

you are splitting the answer with | but not using the array element

Regards
Ankur

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

Hi,

Attached is the script ut am not too sure this is the script include you are referring. But help/let me know how to fix this. And what am i missing in the default variable to populate 'Reporting user Email' which is still showing the name but not email address?

var IncidentAlertAjax = Class.create();IncidentAlertAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {  getSummary: function() { var source_inc = this.getParameter('sysparm_source_inc');  if (!source_inc) return '';  var inc = new GlideRecordSecure('incident'); inc.get(source_inc); var notes = inc.work_notes.getDisplayValue(); var comnt = inc.comments.getDisplayValue();  var summary = 'Source Incident Details\n\nNumber: ' + inc.number + '\nCaller: ' + inc.caller_id.name  + '\nConfiguration item: ' + inc.cmdb_ci.name + '\nDuration: ' + inc.calendar_duration.getDisplayValue()  + '\nOpened: ' + inc.opened_at + '\nOpened by: ' + inc.opened_by.name + '\nResolved: ' + inc.resolved_at  + '\nShort description: ' + inc.short_description + '\n\n' + comnt + notes;  return summary; },  isPublic: function() { return false; },

Hi,

As per screenshot default value in the variables are working fine, I could see that

Can you share the script include by properly formatting it using this

Also what debugging have you performed?

find_real_file.png

I could see that script include function is not returning any value

Regards
Ankur

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