- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 07:54 AM
I have an "Account" variable (reference field) to customer_account table and i have a "Site" variable (reference field) to cmn_location table. The "Site" variable sits in a MRVS. When account is selected and i click into the MRVS and select "Site" i should only see sites relating to the account.
The relationship is, there is an account field within the location table which captures the account.
I thought this would be simple with Ref qualifier and variable attributes but cannot get it to work
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 07:31 AM
Its sorted. Managed to populate the account field from the below script
function onLoad() {
//populates the Account_capture variable with the Account variable selected.
g_form.setValue('account_new', g_service_catalog.parent.getValue('account'));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 01:41 AM
Hi @BharathChintala appreciate the script but would you mind explaining what the they do? Im a bit confused by the first one and not sure where to put the account_new (which is within the MRVS) and the account variable which is outside the MRSV.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 07:16 AM
That has not worked unfortunately. Below is what was done.
1. Create Client script on catalog item for onChange and onLoad
onChange
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (typeof(Storage) !== "undefined") {
sessionStorage.setItem("account", "" + g_form.getValue('account'));
} else {
alert("Sorry, your browser does not support Web Storage...");
}
}
onLoad
function onLoad() {
/*
Check the "Account" value
Update "Parent account" with "Account, Parent account" value
*/
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (typeof(Storage) !== "undefined") {
sessionStorage.setItem("account", "" + g_form.getValue('account'));
} else {
alert("Sorry, your browser does not support Web Storage...");
}
}
}
I then created an onLoad client script within MRVS
function onLoad() {
var account = sessionStorage.getItem("account");
g_form.setValue('account', account);
}
And then set the ref qual for the site variable to the below.
javascript:"site="+current.variables.account_new
Nothing has worked but your help is much appreciated