Populate user names along with their other informations in a request additional field

Populate user names along with their other informations in a request additional field

Requirement:
This sample script is to populate both technician & requester names with their other informations, (eg: MobileNumber, Jobtitle, Department etc) in a request additional fields

The username will appear in an additional field within a request, and upon selection, all associated user informations ie. "email_id", "first_name", "last_name", "employee_id", "mobile", "department", "reporting_to", will be auto-populate in the respective additional fields.

These can be updated as per requirement.

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 > Self Service Portal > Requester > Enable the below in their instance.
  
4.  Go to Admin > Incident/Service 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.
5.  All users of SDP will get listed in the new additional field created. Depending on the selected user, other informations will be fetched to the respective request additional fields configured in the script.

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

Field and Form Rule:


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?

                    • Related Articles

                    • 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 ...
                    • How to populate requester details in request additional field

                      Requirement: Populate requester additional field information into request additional field. Usecase: Let us consider a scenario where certain employee details are imported from the Active Directory into User - Additional Fields. The business ...
                    • Script to Populate User Additional Field under Incident Template using FAFR

                      The script load the Requester Name under Incident Additional field ( As a pick list), by choosing the requester name under additional field the script populates the user additional field value. * Kindly create two additional fields under Admin -> ...
                    • 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 ...
                    • Request with ServiceCatalog Additional fields

                      Service catalog additional fields are category specific fields. These fields are stored in a dynamic table, so we need to join the specific template to get the resultant.  To make any changes to a query, refer to the KB article below. ...