Tuesday, June 2, 2015

Change color for text fields :Dynamics CRM 2013

Sometimes we get requirement to change the forecolor for some fields in Dynamics CRM 2013 in order to highlight them in different color. So we implemented following script:
You can add the scripts on-load or based on some condition.
For changing color during field is non-selected:
//Setting red color
$(‘#fieldname’).find(‘div[class="ms-crm-Inline-Value"]‘).css(‘color’,color);

In order to change color during field is typed:
//Setting color blue during typing of field
$(‘#fieldname_i’).css(‘color’, color);

Get/Set currency field values in JavaScript for Dynamics CRM


I noticed a scenario where currency field value on CRM forms were not accessible using Xrm.Page.getAttribute(“Currency field name”).getValue() and 
Xrm.Page.getAttribute(“Currency field name”).setValue(Value)
The resolution is in such cases you can access currency fields in below manner:
// To get currency field
Xrm.Page.data.entity.attributes.get(“Currency field name”).getValue();
// To set currency field
Xrm.Page.data.entity.attributes.get(“Currency field name”).setValue(Value);

No comments:

Post a Comment

How to Deploy your API as a web app or API app

  Before you can call your custom API from a logic app workflow, deploy your API as a web app or API app to Azure App Service. To make your ...