Is there any way to change the icons of the cases created in Dynamics according to predefined condition? Example I want different icons for the cases based on their priority.
Asked
Active
Viewed 82 times
1
-
Was my answer helpful? – Arun Vinoth-Precog Tech - MVP Sep 21 '19 at 13:53
1 Answers
0
That icon is a placeholder for uploading image to be record specific. Either default entity image icon can be showed or we can upload any image by clicking that icon in entity record level. It will be stored in entityimage
attribute of each record. Read more
What you want is uploading image dynamically based on record field value, may be a webresource icon to that entityimage
everytime when update happens from a plugin. Refer this code sample:
string m_statusImageRed = @"C:\\Images\\Incident\\status_red.jpg";
string m_statusImageGrey = @"C:\\Images\\Incident\\status_grey.jpg";
if(entity.Attributes.Contains("statecode"))
{
OptionSetValue stateCodeValue = entity.Attributes["statecode"] as OptionSetValue;
byte[] imageBytes = null;
switch (stateCodeValue.Value.ToString())
{
case "0": // active
if (File.Exists(m_statusImageRed))
{
imageBytes = File.ReadAllBytes(m_statusImageRed);
entity.Attributes["entityimage"] = imageBytes;
}
break;
case "1": // resolved
if (File.Exists(m_statusImageGrey))
{
imageBytes = File.ReadAllBytes(m_statusImageGrey);
entity.Attributes["entityimage"] = imageBytes;
}
break;
}
service.Update(entity);
}

Arun Vinoth-Precog Tech - MVP
- 22,364
- 14
- 59
- 168