- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2020 12:08 AM
Hi all,
I have a choice field which has four values 'Low,medium,high,critical', as per the value selected I have to display background colour in that field.I have Configured styles accordingly but still it doesnt show the background colour.
Can anyone just help me figure out what might be the issue?
Solved! Go to Solution.
- Labels:
-
Policy and Compliance Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2020 01:09 AM
Hi
I am back with some information for you.The problem you are facing in the client script is because you have marked the field read only via dictionary entry.
Am I right?
I analysed it deeply & found
Other scenario where this approach fails when you have data policies defined for a field like in incident we have data policies on the priorty field.
I tried it.
If the field is custom field, you can proceed as:
Now what you can do:
- First of all if you want to achieve it don't mark it readonly via sys_dictionary entry.It is not possible if it has been marked as readonly via dictionary entry.
- Take this approach:
function onLoad() {
var rating=g_form.getValue("u_inherent_risk_score_rating");
if(rating == "1"){
g_form.getControl("u_inherent_risk_score_rating").style.backgroundColor="green";
g_form.setReadOnly('impact',true);
}
if(rating == "2"){
g_form.getControl("u_inherent_risk_score_rating").style.backgroundColor="light green";
g_form.setReadOnly('impact',true);
}
if(rating == "3"){
g_form.getControl("u_inherent_risk_score_rating").style.backgroundColor="yellow";
g_form.setReadOnly('impact',true);
}
if(rating == "4"){
g_form.getControl("u_inherent_risk_score_rating").style.backgroundColor="red";
g_form.setReadOnly('impact',true);
}
}
But you have to create a list edit view to prevemt that field to be edited in the list view.
Mark it helpful/correct.
Thanks
Sudhanshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2020 03:00 AM
Hi Sanel,
As you mentioned, you are calculating value based on other two fields can you share how you are calculating that. Is there any script you have written for this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2020 03:01 AM
As you are calculating value then there you can apply same logic.
Try same logic in that script where you are calculating value and check it once.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2020 03:47 AM
Hi
It is working for me on the read only field.
What i did create a onChange client script on the readonly field & state the color values at the respective value.
The value is being set by the other fields to this field.
As priorty field is readonly you can see in incident form.I changed impact & styling applied.
Share your script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2020 05:09 AM
Feel free to share your script!!Will make it work.
Thanks
Sudhanshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2020 05:47 AM
