Auto population of fields

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2023 11:02 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2023 11:07 PM
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.
Thanks and Regards,
Rahul

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2023 11:12 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2023 11:15 PM
@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.
Thanks and Regards,
Rahul

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2023 01:51 AM
Yes it worked thank you soo much!