How to populate requester details in request additional field.

How to populate requester details in request additional field.

This sample script is to populate the requester details in a request additional field. 
Based on the requester name selected, we can fetch the user additional field informations using Field and Form Rules (FAFR) and populate the content in request additional field.

Use Case:
We have considered a user additional field named "Country" and this information has to be populated in our request additional field "Requester Country".

Execution Steps: 
1.  Create a new 'Single Line' additional field for the request to hold the user additional field information.  Copy the "column name" of the additional field created.
2.  Go to Admin > Incident Templates > Select a particular template > Field and Form Rules > Rule execution - On Create / Edit > Event - "On Field Change" - "Requester" > Actions - Execute Script - Copy Paste the attached content and save the script.
3.  Modify the attached script to update the request and user additional field informations.  Please follow the comments added in the script.
4.  The request additional field will get updated when the requester field is modified, while creating a request.

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 Name' is the UDF name which will be used in the javascript

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.

                    New to ADSelfService Plus?