I want to create a Script Include that forces a Field Style on Callers who submit a ticket within 2 weeks of their start date.

Justin Gilmour
Tera Contributor

I have written the following Script Include to change the color of a Caller based on their start date and if they are submitting a request within 2 weeks of their start date. Basically I want to use the u_start_date that I have defined in a Form to check for this parameter. I'm not quite sure where I am going wrong but I cannot get the Caller field to show a green dot if their circumstances are true. Does anyone have any suggestions as to how I can pass the u_start_date as a parameter to my greenLight function and then compare it to a date 14 days in the future? I can try to provide further details if needed and have included screenshots as well.

1 ACCEPTED SOLUTION

Weird
Mega Sage

For starters you should be good to go if you change the value to:

javascript: new NewHireCheck().greenLight(current.u_start_date);

 

I think the field styles also apply on list view level, so you can check if it works there. It should generate a small ball next to the field.

If you can't get the field style to work, consider using a client script.
There's an OOB client script "Highlight VIP Caller" on incident table and it can give an idea on how to do this.

So something like this might work:

var element = g_form.getElement('caller_id');
element.style.backgroundColor = "green";

You might also have to check/uncheck the "isolate script" option on the client script, but it might not be necessary when using g_form.getElement. Though I'd like to note that this is something I digged up from my old archives so I don't know if it still works or has been blocked. Using the "Highlight VIP Caller" script as an example should work no problem: $('label.incident.caller_id');

View solution in original post

2 REPLIES 2

Weird
Mega Sage

For starters you should be good to go if you change the value to:

javascript: new NewHireCheck().greenLight(current.u_start_date);

 

I think the field styles also apply on list view level, so you can check if it works there. It should generate a small ball next to the field.

If you can't get the field style to work, consider using a client script.
There's an OOB client script "Highlight VIP Caller" on incident table and it can give an idea on how to do this.

So something like this might work:

var element = g_form.getElement('caller_id');
element.style.backgroundColor = "green";

You might also have to check/uncheck the "isolate script" option on the client script, but it might not be necessary when using g_form.getElement. Though I'd like to note that this is something I digged up from my old archives so I don't know if it still works or has been blocked. Using the "Highlight VIP Caller" script as an example should work no problem: $('label.incident.caller_id');

This worked. Thank you!