Auto populate not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have been tasked with creating a catalog item of which i have the following acceptance criteria
As a user, I need the following fields to display if "New User Account" is selected for "What is your account request?"
- (show the following fields from the user record);
- Employee Phone Number
- Employee Number
- Email
So if i select New User account from a drop down menu selection it should automatically populate those three fields with the Requested for user's information, i presume. Do i make them all display only reference fields, and auto populate based on the requested for value. ? This is assuming i create another custom variable called requested for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
There are two possible approaches depending on the requirement:
1. Request should always be for the logged-in user
If only the current logged-in user can raise the request for themselves, you don't need a separate Requested for variable. You can use the current logged-in user's sys_user record and automatically populate the Employee Phone Number, Employee Number, and Email fields. These fields should be read-only/display-only.
2. Request can be raised for a specific user
If the requester needs the ability to create the account for another user, create a Requested for variable as a Reference variable referencing the sys_user table. Once a user is selected, you can retrieve that user's information and populate the Employee Phone Number, Employee Number, and Email fields automatically. Again, these fields should be read-only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Yes, your understanding is correct.
A typical approach would be:
- Create a Requested For reference variable (referencing the sys_user table).
- Create variables for:
- Employee Phone Number
- Employee Number
- Create UI Policy to handle the visibility of the variables.
The variables which needs to be auto populated, you need to select the field in auto populate form section of variable like below:
Thanks and Regards,
Alok
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @oluseyiasol , The 'requested for' variable is for populating the logged in user which comes as OOB variable.
As for you're requeirement I have few questions -
1. The variable in which the selected user's information should be populated they are going to be different right? : in this case you should be using a combination of catalog client script and script include to acheive this.
Here, refer to this article : auto populate users details
2. If you want to only populate the logged in users details into the variables then you can use the variable's default value related tab and use glide system API, they can fetch the logged in user's detials and populate them in the variable automatically - Note- This only works for logged in user's details.Please feel free to let me know if you want help with configuring the variables as well.
If this response helps you mark it as accepted solution and give it a thumbs up 👍. This help me and community to find answers quickly.
Best Regards,
Saurabh V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
So based on menu selection, it will populate the following fields - email, employee number and phone based on the currently logged on user. Those fields will be display only single line text files and there is an existing reusable variable set for the requested user...
