Comments on: Field Styles for Service Catalog Variables https://servicenowguru.com/system-ui/field-styles-service-catalog-variables/ ServiceNow Consulting Scripting Administration Development Thu, 07 Mar 2024 19:31:52 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Diogo https://servicenowguru.com/system-ui/field-styles-service-catalog-variables/#comment-7912 Wed, 21 Jun 2017 20:40:56 +0000 https://servicenowguru.wpengine.com/?p=3012#comment-7912 In reply to Mark Stanger.

This works just fine!

I’ve tried this solution on a ‘select box’ variable type and on a ‘date/time’ variable type and reduced the field size.

]]>
By: János Szentpáli https://servicenowguru.com/system-ui/field-styles-service-catalog-variables/#comment-7911 Fri, 09 Jun 2017 16:08:45 +0000 https://servicenowguru.wpengine.com/?p=3012#comment-7911 Sorry to barge in, but how about extracting the id attribute of fields one wants to style, creating a variable of type macro (first in order) and just adding plain CSS to the macro’s Jelly (I mean scripting is cool, but the less the merrier – and faster)?

Example Jelly:

[code]

input[id=”IO:********************************”] {
background-color: orange;
color: black;
}

[/code]

The „IO:********************************” token could be found by examining the DOM or could be deduced knowing that it is in fact the sys_id of the variable to be styled prepended by the suffix „IO:”.

In case of reference variables one should use the prefix „sys_display.IO:” instead of „IO:”; e.g:

[code]

input[id=”IO:********************************”] {
background-color: orange;
color: black;
}

input[id=”sys_display.IO:********************************”] {
background-color: orange;
color: black;
}

[/code]

Of course this could be enhanced by employing all sort of CSS selectors and pseudo-classes; simple example:

[code]

input[id=”IO:********************************”] {
background-color: orange;
color: black;
}

input[id=”sys_display.IO:********************************”] {
background-color: orange;
color: black;
}

input[id=”sys_display.IO:********************************”]:hover {
background-color: pink;
color: black;
}

[/code]

All of the above works in Helsinki – haven’t tested with other versions.

]]>
By: Dave Edgar https://servicenowguru.com/system-ui/field-styles-service-catalog-variables/#comment-7910 Wed, 10 May 2017 13:33:43 +0000 https://servicenowguru.wpengine.com/?p=3012#comment-7910 In reply to Dave.

Did anyone ever figure this out?

]]>
By: Mark Stanger https://servicenowguru.com/system-ui/field-styles-service-catalog-variables/#comment-7909 Mon, 24 Apr 2017 15:04:59 +0000 https://servicenowguru.wpengine.com/?p=3012#comment-7909 In reply to Saran.

No. g_form.getControl isn’t currently available in the Service Portal scripting API.

]]>
By: Saran https://servicenowguru.com/system-ui/field-styles-service-catalog-variables/#comment-7908 Mon, 24 Apr 2017 12:14:34 +0000 https://servicenowguru.wpengine.com/?p=3012#comment-7908 will this work in service portal?

]]>
By: Mark Stanger https://servicenowguru.com/system-ui/field-styles-service-catalog-variables/#comment-7907 Wed, 21 Sep 2016 12:00:01 +0000 https://servicenowguru.wpengine.com/?p=3012#comment-7907 In reply to Dave.

I don’t have any other Helsinki workaround at the moment unfortunately. If anybody else can figure it out I’d love to post a solution here.

]]>
By: Dave https://servicenowguru.com/system-ui/field-styles-service-catalog-variables/#comment-7906 Wed, 21 Sep 2016 03:27:09 +0000 https://servicenowguru.wpengine.com/?p=3012#comment-7906 Hey Mark,

I’m also working in Helsinki and your suggestion of using the following syntax g_form.getControl(‘yourvariablename’).setAttribute(‘style’, ‘width:450px !important’); doesn’t seem to work. Do you have any other suggestions or new findings? Thanks!

]]>
By: Blair https://servicenowguru.com/system-ui/field-styles-service-catalog-variables/#comment-7905 Thu, 25 Aug 2016 13:54:00 +0000 https://servicenowguru.wpengine.com/?p=3012#comment-7905 In reply to Mark Stanger.

Thanks Mark. I’ll give it a try.

]]>
By: Mark Stanger https://servicenowguru.com/system-ui/field-styles-service-catalog-variables/#comment-7904 Wed, 24 Aug 2016 21:48:19 +0000 https://servicenowguru.wpengine.com/?p=3012#comment-7904 In reply to Blair.

Helsinki continues ServiceNow’s march towards breaking any sort of configuration flexibility in the tool. Very frustrating, but there are still some workarounds you can try. You can try something like this but it might cause other problems with field decorations, etc.
g_form.getControl(‘yourvariablename’).setAttribute(‘style’, ‘width:450px !important’);

]]>
By: Blair https://servicenowguru.com/system-ui/field-styles-service-catalog-variables/#comment-7903 Wed, 24 Aug 2016 19:51:56 +0000 https://servicenowguru.wpengine.com/?p=3012#comment-7903 It seems that Helsinki breaks the style.width setting on catalog forms. Is there different syntax that needs to be used?

]]>