- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 07:24 AM
Hello @Honor_ Lagaza -
I am not sure you can do this using a client script, as you should see the message within a new client script form, and your script would be effected:
Are you able to offer the use case as to why you are looking to change the field font color to red?
If you are looking to make the field mandatory, you could do so easily using a UI Policy. So that when Priority changes to Critical (1), Service field becomes mandatory with a red asterisk next to it.
Or if you are looking to call out the field even more, you could display a message box above/below it to call out it using a client script.
Not Critical:
When changed to critical:
onChange Client Script:
Script (Example):
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var priority = g_form.getValue('priority');
if (priority == '1') {
g_form.showFieldMsg('business_service', 'Priority is Critical!', 'error');
} else {
g_form.hideFieldMsg('business_service', 'error');
}
}
I am interested in understanding your Use Case to make the font red from the Service field.
If it is truly to just call it out more/make the person working on the Incident pay attention to the field. I would make it Mandatory using a UI Policy based on the Priority Field.
Or you could use the showfieldmsg option within a Client Script (onChange) based on the Priority Field.
Or even combine both. UI Policy to make the field mandatory AND display a message informing the person working the ticket.
I hope this helps you out -
Cheers,
-Rob