MRVS on load Not fetching its own value from g_form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 03:39 AM - edited 11-09-2023 04:03 AM
Hello Experts,
I'm stuck in a situation where i've a mrvs backend name "isp" i wrote a small on load catalog client script inside that mrvs that will fetch the value of its own at on load,
it has two record already but its not fetching those records i want that when i click to "add" button in mrvs
then this on load should trigger and bring me that mrvs array
'[{"id_isp":"ISP02139- 1","isp_component_type":"Primary"},{"id_isp":"ISP02139- 2","isp_component_type":"Secondary"}]'
this is the output of that mrvs i expect in alert where it has two records.
and this is the script i'm trying to fetch
function onLoad() {
alert('test');
alert(g_form.getValue(JSON.parse(g_form.getValue('isp'))[0].isp_component_type));
}
this is my catalog client script on mrvs
please help me in this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 05:11 AM
This is likely due to the fact that the MRVS is loaded after the form, so the script is running too soon. Try adding a delay like this:
function onLoad() {
//MRVS is loaded after the form is loaded. Hence setting a delay of 2 secs.
setTimeout(function() {
getMRVS();
}, 2000);
}
function getMRVS() {
alert('test');
alert(g_form.getValue(JSON.parse(g_form.getValue('isp'))[0].isp_component_type));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 05:41 AM - edited 11-09-2023 05:44 AM
// function onLoad() {
// alert('test');
// alert(g_form.getValue('producer.isp'));
// alert(g_form.getValue(JSON.parse(g_form.getValue('isp'))[0].isp_component_type));
// }
function onLoad() {
//MRVS is loaded after the form is loaded. Hence setting a delay of 2 secs.
setTimeout(function() {
getMRVS();
}, 2000);
}
function getMRVS() {
alert('test');
alert(g_form.getValue(JSON.parse(g_form.getValue('isp'))[0].isp_component_type));
}
no luck on this brad.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 05:57 AM
Sorry, I missed that you were running this script onLoad of the MRVS (when adding a row). Keep this in your back pocket for when you want to retrieve/modify the MRVS contents when the RITM or Catalog Task form loads. To get the MRVS contents onLoad of the add a row dialog, use g_service_catalog
function onLoad() {
alert('test');
alert(JSON.parse(g_service_catalog.parent.getValue('isp'))[0].isp_component_type);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 01:31 AM
Brad this works fine but now i'm unable to access main record producer
variables.
just trying to access iata code from main record producer