Need to populate the values from another table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 07:35 AM
Hi Team,
I am creating the Standard change request through the Request item table using UI action (create Standard Change)
Once the user clicks the standard change menu, it goes to the catalog item form.
The user selects one item from the list, it goes to the change form.
We have one field called "Related Sr" in the change form.
We need to populate this field automatically with the request item number.
Regards,
Manasa.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 07:48 AM
If you look at some of the OOB "Create change" UI actions, you'll see they pass a sysparm_query that includes parent=sys_id_of_the_record. This ends up in the URL on the target change as "sysparm_link_parent" - you can parse the url to grab that parameter and use that to set the field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 06:25 AM
Hi Kristen,
Thanks for the reply.
Could you please explain with details.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 09:10 AM
This is one option:
function onLoad() {
var gUrl = getParameterValue('sysparm_link_parent');
g_form.setValue('your_field_name', gUrl);
function getParameterValue(name) {
var url = top.location.href;
var value = new URLSearchParams(url).get(name);
if (value) {
return value;
}
if (!value) {
var gUrl = new GlideURL();
gUrl.setFromCurrent();
value = gUrl.getParam("view");
return value; //this will give you the value
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 06:45 AM
Hello Kristen,
We have tried the above solution, but it is not working in the reference field.
In the change form, I have created the string field (Service Request), which shows the system ID of the request.
Please help me on this.
Regards,
Manasa.