- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 04:43 AM
Hello Everyone! I have a question about MRVS.
I have this Record Producer, and when this "reason of payment" field is "account payables" or "T&E", I need to autofill all variables on MRVS with a "0" or "1" (doesn´t matter if is 0 or 1).
The MRVS name is "booking_details".
Anyone has done something similar?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 07:03 AM
In addition to Brad's comment, let's try to modify line 14 and 15 in your script.
From
var mrvs = '[{"sap_booking":"1","profit_centre":"1"}]';
g_form.setValue("booking_details", mrvs);
To
var mrvs = [{"sap_booking":"1","profit_centre":"1"}];
g_form.setValue("booking_details", JSON.stringify(mrvs));
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 05:26 AM - edited 01-25-2024 05:27 AM
You can use an onChange Catalog Client Script that applies to the Catalog Item when the "reason of payment" variable changes. Your script would look something like this, depending on your variable names and the select box actual values:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (g_form.getValue('reason_of_payment') == 'account payables' || g_form.getValue('reason_of_payment') == 'T&E') {
var mrvs = '[{"variable_name_1":"0","variable_name_2":"0"}]';
g_form.setValue("mrvs_internal_name", mrvs);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 06:07 AM - edited 01-25-2024 06:18 AM
Is not working. I´ve just tried some other things, but I cannot figure it out.
We used to use the JSON.parse() to call and read the MRVS, but we cannot use JSON on OnChange client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 07:03 AM
In addition to Brad's comment, let's try to modify line 14 and 15 in your script.
From
var mrvs = '[{"sap_booking":"1","profit_centre":"1"}]';
g_form.setValue("booking_details", mrvs);
To
var mrvs = [{"sap_booking":"1","profit_centre":"1"}];
g_form.setValue("booking_details", JSON.stringify(mrvs));
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 07:25 AM - edited 01-25-2024 07:27 AM
Great!!! It worked... So, I need to change it to an OnSubmit client script... It could be that the JSON is not supported on an OnSubmit?