[DidYouKnow-45]How to Auto Populate User Defined Fields(UDF) on a Ticket

[DidYouKnow-45]How to Auto Populate User Defined Fields(UDF) on a Ticket

One of our Community users has requested the following function in ServiceDesk Plus. When a user submits a ticket. The User Defined Fields (UDF - store users AD attributes), should get auto-populated on request additional fields based on the user who submits the ticket. Through a simple script, you can auto-populate UFD fields on a ticket. Here is the script. 


$CS.setValue("WorkOrder_Fields_UDF_CHAR1",$CS.getValue("REQUESTER.user_udf_fields.udf_sline_601"));

Prerequisites:

  • Create an Incident/Service additional field and add it to the request template on which the UDF value will get populated.


  • Make note of the Column name of the particular request template additional field (Admin tab >> Incident/Service Catalog additional fields).



Steps to import AD attributes to UDF fields:

  • User additional field (Admin tab >> User additional fields)



  • Map AD field to the particular UDF (Admin tab >> Import users from AD ), upon AD import along with the user account, the AD field will be imported to requesters additional field.




  • Make note of the API field name of the particular user additional field (Admin tab >> User additional fields)



  • Modify the following script and replace the highlight lines in orange with the Column name of additional fields and API field name of the user additional field.

$CS.setValue("WorkOrder_Fields_UDF_CHAR1",$CS.getValue("REQUESTER.user_udf_fields.udf_sline_601"));

Solution:




  • Once the user submits the ticket, the particular additional field will get populated with UDF value.
Note: This script by default will work for technicians, in order to enable this function for users, as an admin you need to enable the following permissions  in (Admin tab >> Self-service portal settings) 



The particular Incident/Service additional field should be enabled with Requester can setand Requester can viewoptions




Thank you for your time, I hope you find this article useful!

Our previous article was on - Automate Set/Unset Tasks Using FAFR