Show/Hide variable in MRVS based on variable change out of MRVS

Dennis17
Tera Guru

Hi guys,

I'm struggling  to achieve the following: based on a variable value change (select box variable) in a catalog item (located directly on the catalog item), I need to display or hide another variable inside of one MRVS.

Is that possible?

 

Thanks in advance!

1 ACCEPTED SOLUTION

Rishi_11
Kilo Sage

Hi @Dennis17 ,

Try creating a duplicate hidden (select box) variable in the MRVS. Use a onLoad client script(in the MRVS) to populate its value in the MRVS. Once this is done you can use UI policies on the MRVS to conditionally show the fields. Sharing onLoad script for your reference.

function onLoad() {
    //Type appropriate comment here, and begin script below
    var type = g_service_catalog.parent.getValue("Variable on the catalog item"); //replace with variable on the catalog item
    g_form.setValue("Variable on the MRVS", type); //replace with variable on MRVS
}

This has worked for me in the past. Hope this helps.

 

Please mark this response as correct or helpful if it assisted you with your question.

Thanks,

Rishi.

View solution in original post

6 REPLIES 6

jcmings
Mega Sage

I don't know that this is possible. Can you have two MRVS and display one or the other based on your trigger variable?

Hello!

It's a good workaround but I need to display as mandatory or readonly other variables on SCTASK level and I would have to duplicate all developments...

Rishi_11
Kilo Sage

Hi @Dennis17 ,

Try creating a duplicate hidden (select box) variable in the MRVS. Use a onLoad client script(in the MRVS) to populate its value in the MRVS. Once this is done you can use UI policies on the MRVS to conditionally show the fields. Sharing onLoad script for your reference.

function onLoad() {
    //Type appropriate comment here, and begin script below
    var type = g_service_catalog.parent.getValue("Variable on the catalog item"); //replace with variable on the catalog item
    g_form.setValue("Variable on the MRVS", type); //replace with variable on MRVS
}

This has worked for me in the past. Hope this helps.

 

Please mark this response as correct or helpful if it assisted you with your question.

Thanks,

Rishi.

Hello!

It looks a good solution but I think we still have the issue to get the change from catalog item... I would need to get the variable value change on catalog item level and based on that, display or hide a variable on MRVS level.