- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 05:58 AM - edited 11-01-2024 06:02 AM
I am creating a Record Producer (though I suspect the same would be true for a Catalog Item) where I have three fields at the beginning:
- Requestor
- Requestor Email
- Requestor Department
These should all be auto-populated when the Record Producer is opened on the Service Portal to be filled out.
For the Requestor field, I have a default value of:
Then, I set up the Requestor Email variable to be Single Line Text, with the Auto Populate tab filled out like this:
And I set up the Requestor Department variable to be a Reference field, with the Auto Populate tab filled out like this:
The goal is when you open the form from the Service Portal, all three of these fields will be automatically populated (I ultimately want to make them all Read-Only so the Requestor cannot change their values).
The issues is when you open up the form, it populates the Requestor with the correct value, but does not pre-populate the other two fields. It only populates them if you change the Requestor value (so it does not appear that this "Auto Populate" feature works "On Load" - it behaves more like "On Change" of the Dependent field).
Is there an easy way to get these fields to behave properly, and all 3 automatically populate when the form loads, without having to go back to the old method of using Catalog Client Scripts?
This auto-populate seems like a nice feature, if we could get it to work properly!
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 08:31 AM - edited 11-01-2024 08:32 AM
Figuring it might be the Order Guide (as I know that has a lot of limitations), I removed the Auto Populate features for those two fields, and created a Catalog Client Script that runs On Change of my "Requested Name" field that has a callback function that looks like this:
function onChange(control, oldValue, newValue, isLoading) {
// if (isLoading || newValue == '') {
// return;
// }
var req_for = g_form.getReference('requestor_name', setUserFields);
function setUserFields(req_for){
g_form.setValue('requestor_email',req_for.email);
g_form.setValue('requestor_department',req_for.department);
}
}
This works as expected, so I think I will just go with this option.
Thanks for looking into it though!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 07:04 AM
I am very familiar with expected behavior, and did just now validate in a Washington DC instance. What happens if you change Requestor Name to another user, and then back to you? I assume you have an email and department on your user record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 07:20 AM
Yes, I have information in those cells, and see it populate when I change to someone else and then change back to myself.
BTW, we are doing this in Xanadu. Can you test it out on Xanadu?
Also, is there any sort of Configuration setting that could be affecting this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 07:54 AM
Same behavior in Xanadu (Patch 1, Hotfix 2a). I am not aware of any configuration setting that could be affecting this. Did you check the console and JavaScript log?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 08:03 AM
Here is the release we are on:
Build tag: glide-xanadu-07-02-2024__patch2-09-25-2024
I just thought of two things that might be impacting this:
- This is creating a record against the SAFe Epic table
- This Record Producer is part of an Order Guide
I know that certain things do not work the same in Order Guides. Could that perhaps be the issue? If you add your example to an Order Guide, can you get it to work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 08:31 AM - edited 11-01-2024 08:32 AM
Figuring it might be the Order Guide (as I know that has a lot of limitations), I removed the Auto Populate features for those two fields, and created a Catalog Client Script that runs On Change of my "Requested Name" field that has a callback function that looks like this:
function onChange(control, oldValue, newValue, isLoading) {
// if (isLoading || newValue == '') {
// return;
// }
var req_for = g_form.getReference('requestor_name', setUserFields);
function setUserFields(req_for){
g_form.setValue('requestor_email',req_for.email);
g_form.setValue('requestor_department',req_for.department);
}
}
This works as expected, so I think I will just go with this option.
Thanks for looking into it though!