Label Variable Set Value (Service Portal)?

stevejarman
Giga Guru

I have a Label type variable in a catalog item that I'm displaying through Service Portal.

I want to set the text of the label (called "change_window") through an onLoad Catalog Client Script.

I've tried g_form.setValue("change_window", "Whatever") and g_form.setLabelOf("change_window", "Whatever") but neither of those work (though they work fine for text fields).

Can anyone tell me how to set the text of the label?

13 REPLIES 13

stevejarman
Giga Guru

Nope. Doesn't look like it. None of that stuff works. Maybe it's just different in Service Portal?


reginabautista
Kilo Sage

Hi Steve did you get this resolved? It's not working for me either.



Unable to set value to a Catalog Item Variable in Service Portal


mike_allgire
Giga Guru

From what I have found; the former method provided by SNGuru will not work with Service Portal due to the usage of $.


Supported and unsupported client scripts


Steven Parker
Giga Sage

Did you ever find a solution to this?



Mark's solution works great if you aren't using the Service Portal.   But how do you change the field label in the Service Portal in an onChange Catalog client script?



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

patricklatella
Mega Sage

Same goal here...has anyone figure out how to dynamically change the "Question" for a variable on a catalog item in Service Portal?

One thought I had was to create simple widgets with the necessary text and have that appear above my variable field, which could then have a blank "Question".

Then based on my logic, I can present whichever text (via the widget in a macro field).

But that said, is there any script that could handle changing the variable's Question?

Thanks!