Catalog client script to do a table lookup then insert the results in a multi-row variable set on the intake form.

Jeff316
Kilo Guru

Back to the well again. I'm liking the new multi-row variable sets. I have a catalog item to request new servers. Originally, the requester said, if the user picks Windows then automatically populate the "drives" mrvs with a C drive and some values. They can add others to the mrvs but we need this required drive to automatically be there and if they pick Linux as the OS then automatically add "/", the size, the tier into the mrvs. I have the script that assumes I will hardcode either C or /.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var OSdrive = [
{
drive_letter_os: "CC",
drive_size_os: "test",
unit_os: "GBs",
disk_tier_os: "Premium_LRS",
sizeingbs_os: "333"
}
];
g_form.setValue('INTERNAL_NAME_OF_MRVS', JSON.stringify(OSdrive));
}
But now they added a custom table called "recommended drives" where they will dynamically store the C drive and / drive attributes as well as others. So now when the user selects the OS of Windows or Linux on the catalog item I can't just use my cat script and populate the mrvs, I have to lookup which drive or drives to insert into the mrvs based on what is in the Recommended Drive table. So today when I select the OS of Windows there might be Drives C and F with drive_letter, drive_size, unit, dis_ticket, sizeinbgs, I then need to insert those 2 rows into the mrvs on the intake form.

21 REPLIES 21

I have to use a script include then use glide ajax in a catalog client script, but have no idea how.

I read that I need to use a script include and call it from my catalog client script using glide ajax. Have no idea how for this type of query.

To call a script include you would use 

var scriptInclude = new scriptIncludeName();
scriptInclude.theFunctionYouWantToCall('parameter');

Thanks. I'm hopeless.

Haha, no! We all start somewhere!