How to change variable background color
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2022 01:32 AM
I am using service portal to request adding business application record. After I request, it will send the record to approver and the record include variables in service catalog.
I would like to change the background of these variables if the value in variables match some condition.
I tried to use catalog client script such us [g_form.getControl('submitted').style.backgroundColor = 'blue';] script, but it does not work as expected.
How can I achieve these requirement?
Please advice, Thanks
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2022 05:54 AM - edited ‎10-05-2022 05:55 AM
Hi Dan
Thanks for comment.
I have tried your code. It is not able to use g_form.getfield function.
And I also tried this code, it shows the 'backgroundColor is not defined' error.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2022 05:59 AM
Give me a few minutes until I try it on my instance, wrote that of the top of my head but might actually need a getElement

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2022 06:13 AM
Sorry should also ask, where are you wanting the color change to appear?
In the catalog item request, or on the approval record? There is like a variable formatter that forms part of the approval record showing the variables passed from a request, and I'm not sure if you can apply styles to that formatter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2022 06:18 AM
I would like to see the color in the approval record.
Actually there are some hidden variables in the catalog item request, I will compare 2 variable value, if the value is not same, I would like to change the variable background color to let the approver know the value is different.