Remove Decoration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2019 03:41 AM
Hi team,
I am trying to write script in ui policy with certain conditions, in the part i tried to write remove decoration logic but still it is showing 2 times instead of clearing other one please suggest
function onCondition() {
g_form.removeDecoration('assigned_to','icon-star','Please update the Assigned to with valid user name','color-red');
g_form.hideErrorBox('assigned_to');
if (!g_form.isNewRecord()){
g_form.addDecoration('assigned_to','icon-star','Please update the Assigned to with valid user name','color-red');
g_form.showErrorBox('assigned_to','Please update the Assigned to with valid user name','info');
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2019 03:47 AM
Hi Deepthi,
Try using something as below.
function onCondition() {
g_form.removeDecoration('assigned_to','icon-star','Please update the Assigned to with valid user name','color-red');
g_form.hideErrorBox('assigned_to');
var createdonis=g_form.sys_created_on;
if (createdonis!='')
{
g_form.addDecoration('assigned_to','icon-star','Please update the Assigned to with valid user name','color-red');
g_form.showErrorBox('assigned_to','Please update the Assigned to with valid user name','info');
}
}
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2021 09:20 PM
I was not able to get removeDecoration working when I used a COLOR with my decoration. Perhaps that is some sort of limitation/bug?
if (! g_form.getValue("cmdb_ci") && !g_form.getValue("business_service")){
//g_form.addDecoration("cmdb_ci", "icon-star", sDecorationMessage, "color-blue"); //It seems like docorations with COLORS can't later be removed.
//g_form.addDecoration("business_service", "icon-star", sDecorationMessage, "color-blue"); //Can't later be removed.
g_form.addDecoration("cmdb_ci", "icon-star", sDecorationMessage); //Works
g_form.addDecoration("business_service", "icon-star", sDecorationMessage); //Works
}
else
{
g_form.removeDecoration("cmdb_ci", "icon-star", sDecorationMessage);
g_form.removeDecoration("business_service", "icon-star", sDecorationMessage);
}