- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 07:52 AM
I'm pretty sure this is possible using g_form.setVisible(fieldname,boolean) to change the order of the variable, but I'm not sure exactly how I should be coding it.
I currently have a variable set that is being used in dozens of other catalog items, so I can't change the order in the set as it would affect some other things I don't want affected...so I'm thinking I should use a Catalog Item UI Script to get what I want done.
Currently the user selects their preferred contact type from (email, pager, cell phone, desk phone), everything works as expected.
However, if the user selects anything other than email, I would still like the email to show as a secondary contact method. I have this working, but the issue is because email is set above the other fields in the variable set, it's showing above their selected contact method instead of below it...that's what I'm trying to fix.
This is what it currently looks like, I'm just trying to change this so that email shows under phone instead of above it (without making the order change in the variable set).
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 09:51 AM
Sorry no. The page is already rendered, rendered in order. the UI scripts can only show / hide, make mandatory or not and set value, set options but not changing the rendered page.
however if you set it to allow dom manipulation then you can some things to the rendered page, things normally not possible with the SN OOB options.
But again, although possible, you should not want to do this. SN support if it goes wrong will be limited. There will be a real change of it breaking after an update.
Again, if you really want it, then I would advice to look into if you cannot just change the order within the variable set. I would even prefer a clone of the variable set for just this item with a changed order over the dom manipulation.
Only reason I would do the dom part is on a PDI, just to show it is possible, never als a production solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 08:04 AM
Hello
As I you told that you are using g_form.setVisible(fieldname,boolean) in the client script. If yes, then please try to use g_form.setDisplay(fieldname,boolean).
Mark it helpful or correct, If Applicable
Cheers..!
Happy Learning:)
Tushar
Cheers..!

Happy Learning:)

Tushar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 08:08 AM
sorry, that was a pasting error on my part, I meant to say I think I should be using setDisplay. However, the question is more about how to write the script itself as that's the part I can't figure out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 09:31 AM
I dont think it change the order other then in the variable set. Not by any by ServiceNow supported means.
If you would only show 1 field based on the preferred contract type then why not just change the order?
If that is not possible and the field really needs to be lower then I guess you have to do some dom manipulation. Which I cannot recomment to do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 09:36 AM
It's not possible to change the order with a UI script?