Trigger plugin on Action Execution in Dynamics CRM

Hi ,

I am going  to show in the following steps how to trigger plugin on Action execution in CRM

Steps

1) Create Action

CreateAction

2) Register plugin

RegisterPlugin

3) Call Action

The following code will show how to call the action using C#

OrganizationRequest callActionRequest = new OrganizationRequest("qdrn_setcustomervip");

callActionRequest["Target"] = new EntityReference("contact", {GUID});

OrganizationResponse callActionResponse = service.Execute(callActionRequest);

How To : Set A Fields On A Form Required Or Recommended Using Java Script in CRM

// Required

Xrm.Page.getAttribute("FieldSchemaName").setRequiredLevel("required");

//Recommended

Xrm.Page.getAttribute("FieldSchemaName").setRequiredLevel("recommended");

// None

Xrm.Page.getAttribute("FieldSchemaName").setRequiredLevel("none");

Invoke Rollup Fields Calculation programatically in CRM

Hi,

Rollup field calculation is done by an async CRM Workflow , however in many scenario you may want to perform run time calculation , the following code illustrate how to invoke the calculation prgroamtically.

CalculateRollupFieldRequest rollupRequest=

new CalculateRollupFieldRequest { Target = new EntityReference("new_customentity", entityId), FieldName = "new_rollupfield"};

CalculateRollupFieldResponse response =(CalculateRollupFieldResponse)service.Execute(rollupRequest);

MS CRM - What is the "IsDirty" Method ?

Hi,

The "IsDirty()" Method returns a Boolean value indicating if there are unsaved changes to  attributes values.

Code:

//To Check if the entity is dirty
var ismodified=Xrm.Page.data.entity.getIsDirty();

//To Get Dirty Fields
var attributes = Xrm.Page.data.entity.attributes.get() ;
for (var i in attributes)
{
var attribute = attributes[i];
if (attribute.getIsDirty())
alert("attribute dirty: " + attribute.getName());
}