The CreatorCon Call for Content is officially open! Get started here.

Auto population of fields

Community Alums
Not applicable

Hi community,
So I have a requirement I need a client script for my variable set which has few variables the first variable is "is_this_request_for_you" which is yes/no type. By default it is yes and that time the requested_for variable is not seen but in backend it should populate with the current user name. If the user selects no then the requested_for variable is shown and user can the choose the person they want to want to choose. the rest variables are line_manager , location , contact_number which shoudl auto-populates based on whose name is present in the requested_for variable which could be the current user or someone else whose name is mentioned

Thank you in advance for helping

5 REPLIES 5

Rahul Talreja
Mega Sage

Hi @Community Alums ,
Which Version you are in? From Utah onwards, this requirement doesn't needs any scripting. You can achieve by using OOTB "AutoPopulate" Option.
Refer: Auto-populate a variable based on a reference type... - ServiceNow Community
If you are still looking for a script, let me know.

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

Community Alums
Not applicable

Thank you for the quick response but the auto population of the manager, location and phone depends on whose name is present in the requested_for variable which should happen dynamically 

@Community Alums ,
Yeah, ServiceNow Utah and after is equipped with the same functionality you desire for!

Just check the link, you can an option to choose "Dependent Field" and all other fields will be auto populated according to it.

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

Community Alums
Not applicable

Yes it worked thank you soo much!