Configuring Styles for a Particular Field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2017 10:06 PM
Hi ,
Requirement is need to configure Styles for Status Indicator field based on condition.
The condition is ,If current date < Expected closure date , the field by the name status indicator should be green
We defined by writing the value but it is not wokring
Script was javascript:gs.nowDateTime()<current.u_glide_date_time_60
Regards
Preethi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2017 11:12 PM
Hi Shishir,
As suggested tried with javascript:gs.dateDiff(gs.nowDateTime(), current.u_glide_date_time_60, true) <= 0 but it is not working
Thanks
Preethi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2017 11:46 PM
Thanks for your inputs Harsh
In List view also the status indicator field is not getting updated with color.
Also if i want the configure styles to work on list and form level then i need to leave the value as blank.
But if i leave value as blank then i cannot define the conditions here at all

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2017 11:49 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2017 11:50 PM
by the way i checked at my end and it's working on my PDI. yes i test on list view.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2017 04:58 PM
Please check if this helps.
Script Include:
var clientDateTimeUtils = Class.create();
clientDateTimeUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isDateTimeBefore: function() {
var nowdate1 = new GlideDateTime();
var dt = new GlideDateTime(this.getParameter('sysparm_date'));
var diff = gs.dateDiff(nowdate1.getDisplayValue(), dt.getDisplayValue(), true);
if(diff<0)
return true;
},
type: 'clientDateTimeUtils'
});
Client Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ajaxStartDate = new GlideAjax('clientDateTimeUtils');
ajaxStartDate.addParam('sysparm_name', 'isDateTimeBefore');
ajaxStartDate.addParam('sysparm_date', newValue);
ajaxStartDate.getXML(validateStartDate);
function validateStartDate(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer == 'true')
g_form.getControl('u_status_indicator').style.backgroundColor = "#32cd32"; //Changes the field color to LimeGreen.
}