How to populate user names in a request additional field

How to populate user names in a request additional field

This sample script is to populate both technician and requester names in a request additional field

Use Case:
Populate all user name in a request additional field.

Execution Steps: 
1.  Create a new 'Single Line' additional field and add them in the request template to hold the user field information.  Copy the "column name" of the additional field created.
2.  Modify the attached script to update the additional field informations.  Please follow the comments added in the script.
3.  Go to Admin > Incident Templates > Select a particular template > Field and Form Rules > Rule execution - On Form Load > Rule execution - "On Create/Edit" > Event - "On Form Load"  > Actions - Execute Script - Copy Paste the attached content and save the rule with a name.
4.  All users of SDP will get listed in the new additional field created.

How to find the UDF name of a field in the Request Form:

Open a template to which this functionality has to be added and make sure that the necessary request additional field is a part of it.  To get its UDF name ,click on the Field and Form Rules tab and then click on New Rule.  In the Actions section select Execute Script and click on the Write Custom Script option.  Type the name of the field in the Refer Template Fields text box and click on the name of the field, once a match is found.  This will show the Field Label , Field name and Type in the right pane.The value provided against 'Field Label' is the UDF name which will be used in the javascript



Incident Template > Field And Form Rules




New Incident:




Note : Version below 11.0, use the script.txt and from version 11.0, use the script (script_11000) 

With ESM (11000) release, requesters can be given access for GET and GET ALL users api operations to achieve certain requirements. This will be disabled by default and needs to be enabled by executing the below query in the database,

update globalconfig set paramvalue='true' where parameter = 'AllowUserAPIInRequesterLogin';

Refer to this article for the instructions to connect to the database.
‚Äč
Refer to this post for further information.