How to use a 'reference' field as an item selector in an Order Guide ?

Jeff60
Kilo Expert

Hello everyone.

My question is about Script on an Order Guide.

I would like to use a variable (type: Reference) linked to the table "sc_cat_item" on the first step to add the item selected on the second step "Choose Options".

For example, as you can see on the screenshot, if i enter a catalog item on theses two variables, after i have click on NEXT, i can fill this two items on the step "Choose Options".

Thanks for your help !

22 REPLIES 22

Ammad Satti
Kilo Guru

Hi

You can try below code

var value =  g_request.getParameter('IO:sys_id');
guide.add(vaule);

 

 

Hello @Ammad Satti,

I'm not sure to understand..

I have created a "Catalog client scripts" with this code :

function onSubmit() {
	var value =  g_request.getParameter('IO:84dabf301bd1689097ce31e5464bcbc2');
	guide.add(value);
}

I took a sys_id of one of my catalog item for example.

And i have this error :

find_real_file.png

One other question, how can i get the sys_id of my order guide variable "Catalog Items" and put it on this script ?

Thanks for your help. 🙂

Ammad Satti
Kilo Guru

Hi Jeff

g_request will not work in client script, you can use it in order guide script. If script field is not available on form you can add using Form Layout.

g_request.getParameter('IO:SysID of varaiable') can get you value for order guide variable. 

 

Thanks.

Hello @Ammad Satti,

I indeed had to add the "script" part in the "Order Guide" form.

I then added the following script:

// Get the value of my variable reference type.
var value1 = g_request.getParameter('IO:13a97e561b4fcd184c16a938bd4bcb91');
// Add the catalog item filled on the variable reference type in the options.
guide.add(value1);

But unfortunately it doesn't work.

As a reminder, I have a reference type field linked to the "sc_cat_item" table which is filled in and which must then appear in the next step as an Item to fill in.

Thanks !