Change the Background Colour

pragatishendre
Tera Contributor

Change the number field background color of the incident if the priority is Critical.

Write onChange Client Script.

1 ACCEPTED SOLUTION

Hitoshi Ozawa
Giga Sage
Giga Sage

@pragatishendre 

Create a client script.

  1. Open an incident
  2. Right click on the header section and select "Configure" > "Client Scripts"
    HitoshiOzawa_0-1730763918731.png

     

  3. Click on the "New" button at the top right corner
    HitoshiOzawa_1-1730763992615.png

     

  4. Enter script
    function onChange(control, oldValue, newValue, isLoading, isTemplate) {
        var number = g_form.getControl('number');
        if (newValue == 1) {
            number.style.backgroundColor = 'red';
        } else {
            number.style.backgroundColor = '';
        }
    }​

    HitoshiOzawa_2-1730764090001.png

     

Result:

HitoshiOzawa_3-1730764138761.png

 

View solution in original post

2 REPLIES 2

AshishKM
Kilo Patron
Kilo Patron

Hi @pragatishendre , 

I am not sure, if you are sharing the logic or asking. 

This can be done via Style [sys_ui_style ] also, you can check some existing style and replicate for priority field

 

AshishKM_0-1730752497445.png

 

-Thanks,

AshishKM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Hitoshi Ozawa
Giga Sage
Giga Sage

@pragatishendre 

Create a client script.

  1. Open an incident
  2. Right click on the header section and select "Configure" > "Client Scripts"
    HitoshiOzawa_0-1730763918731.png

     

  3. Click on the "New" button at the top right corner
    HitoshiOzawa_1-1730763992615.png

     

  4. Enter script
    function onChange(control, oldValue, newValue, isLoading, isTemplate) {
        var number = g_form.getControl('number');
        if (newValue == 1) {
            number.style.backgroundColor = 'red';
        } else {
            number.style.backgroundColor = '';
        }
    }​

    HitoshiOzawa_2-1730764090001.png

     

Result:

HitoshiOzawa_3-1730764138761.png