How to pass the variable value in redirect URL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 01:40 AM
Hello Everyone,
I have requirement when on select of "Learning" reference variable value which is one of the value of different table on current record producer it will redirect to another record producer which has same reference variable in redirect record producer which is working for me but I want populate default value "Learning" for the same reference variable in redirect record producer only in case of redirect another record producer.
I have attached screenshot Please look into those I have highlighted in screenshot where I'm expecting learning default value only at the time of redirect from another record producer.
OnChnage Catalog client script-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 03:01 AM
Hi @rmaroti
Can you try the below-mentioned code if that works for you?
location.href = 'https://rbassisttmp.service-now.com/peoplehub? id=sc_cat_item&sys_id=839689bb1bcab890b5ce9608b04bcb9d'+'variable_value='+g_form.getValue('what_is_this_request_regarding');
And once you redirected to another RP, you can write the onLoad script to get the value of variable_value using getParameter method.
Please mark this as helpful if this resolves your query and hit accepted as a solution.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 03:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 04:19 AM
@rmaroti
Try this,
This onLoad should be written in the redirected record producer to get the value from the parameter only when it's been redirected from the previous record producer
if(getParameterValue('learning')=='Yes') //I am assuming the learning keyword is coming from the previous record producer
{
g_form.setValue('field_of_redirected_record_producer','learning');
}
function getParameterValue(name) {
var url = top.location.href;
var value = new URLSearchParams(url).get(name);
if (value) {
return 'Yes';
}
else{
return 'No';
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 04:49 AM
Below is Onload client script:
and previous record producer onChange client script is: