Auto populate info on catalog item form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2022 08:37 PM
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.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2022 09:38 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2022 09:49 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2022 10:02 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2022 11:00 PM
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; },
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2022 12:02 AM
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?
I could see that script include function is not returning any value
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader