Change HRC Number Field BG Color When Worknote is Added

amielalcala
Kilo Sage

Hi,

 

We have this requirement where an HR Case number field BG color must turn light blue whenever a worknote or comment is added to the case. 

 

I tried creating an onChange client script but it didn't work:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
    // Get the HR number field
    var hrNumberField = g_form.getControl('number'); 

    if (hrNumberField) {
        hrNumberField.style.backgroundColor = 'lightblue';
    }
   
}

 

Am I missing something here?

1 ACCEPTED SOLUTION

Gangadhar Ravi
Giga Sage
Giga Sage

You need to do two script 1)  additional comments 2) Work notes. Please check below example I did on incident. it worked fine for me on Incident.

 Please mark my answer correct and helpful if this works for you.

 

GangadharRavi_0-1716137710110.png

 

View solution in original post

4 REPLIES 4

Gangadhar Ravi
Giga Sage
Giga Sage

try like below. Please mark my answer correct and helpful if this works for you.

var control = g_form.getControl('number');
control.style.backgroundColor = "lightblue";

Hi @Gangadhar Ravi, I tried this but unfortunately, still didn't work. This is some of the configurations I did:

 

amielalcala_0-1716130487620.png

 

Gangadhar Ravi
Giga Sage
Giga Sage

You need to do two script 1)  additional comments 2) Work notes. Please check below example I did on incident. it worked fine for me on Incident.

 Please mark my answer correct and helpful if this works for you.

 

GangadharRavi_0-1716137710110.png

 

Hey @gangadhar, appreciate the fast response. On the instance I'm working on, it's still doesn't work BUT on my PDI, it does work with Incident table. I might have to escalate this to support. Thanks for the help!