The CreatorCon Call for Content is officially open! Get started here.

Field styles for the field

amaradiswamy
Kilo Sage

Hi All,

We have "Requested_for" field in "Request(sc_request) table. In requested item table instead of creating a new field we have used this field by using the dot walking functionality(request.requested_for), same for the catalog tasks.

Now we have requirement like defining field style for the VIP users in "catalog Tasks" list. We have defined the style for "requested_for" for request table and it works great. But, for requested item and catalog tasks the field styles are not working because the field(requested_for) is not available in these table.

Is there any way to define styles(highlighting) for VIP users in the list of request item and catalog task records?

Thanks in advance

Thanks & Regards,

Swamy

1 ACCEPTED SOLUTION

Oh, I see, my apologies for misunderstanding.



You can make styling work with dot-walked fields by customizing the style in the following way:


hero3.png


I've added sc_task.request.requested_for to the list and the styling works:


hero2.png


View solution in original post

14 REPLIES 14

The SN Nerd
Giga Sage
Giga Sage

Have you tried using addDecoration (available in Fuji)



http://wiki.servicenow.com/index.php?title=GlideForm_(g_form)#addDecoration



Example


g_form.addDecoration('request.requested_for', 'icon-star', 'preferred member');



Since requested_for is not going to be changing, I would create a Display Business Rule that checks if the user is VIP and puts it into the scratchpad.



if (request.requested_for.vip == true) {


g_scratchpad.vip = true;


}



Then put the code in your onload client script:



function onLoad() {


if (g_scratchpad.vip == true) { //See display business rule


g_form.addDecoration('request.requested_for','icon','text');


//OR DOM manipulation to change the style


}


}



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Hi Morris,



Many thanks for your reply.



We are currently using Eureka version.



On the form we are getting VIP icon because we have written client script for that. We want to show the VIp icon in the LIST view instead of from view.



Is there any possible way to acheive the states requirement in Eureka version?



Regards,


Swamy


I think you could achieve this via a UI macro



Creating a Formatter - ServiceNow Wiki



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Hi morris,



We can add formatters to the form only,


how can i apply this to the list?



Regards,


Swamy