Browser extensions for Dynamics CRM

all in one post… I wrote different for each one.. !!

Thanks Yawer for this. 🙂

Yawer Iqbal

Browser extensions are great software components which increase productivity and let browser do things which they can’t otherwise.

For Dynamics CRM a few add-ons are available which do fantastic things for CRM developers, testers and power users. This post will review these extensions and their features.

 

Dynamics CRM Power Pane

PowerPane

 

Dyanamics CRM Power Pane is developed by Onur Menal (CRM technical consultant from Turkey) and is available for Chrome and Firefox.

Its features are classified as:

  • Record Actions
  • Form Actions
  • Navigation.

For any record, with a click, we can see record guid, record url, entity name and entity type id. Copying a record to clone in a new tab is another useful record action. Form actions let the user enable all fields, show hidden fields, disable value requirement, get schema names as the field label, and copy schema names in form. Other features like showing optionset or field values, highlighting the dirty field and refreshing…

View original post 378 more words

Refresh roll up field from plugin

data retrival

Roll up fields are very useful, it reduce lots of manual and coding efforts. This rolls up field will auto refresh by each hour by default, off course it can be changed any time.

But what if developer wants to refresh it on fly from plugin itself to make following logic to work perfectly, which is dependent on this roll up field? Is there any way for this? or roll up fields are not useful in such a condition.

Yes, there is way we need to execute “CalculateRollupFieldRequest and CalculateRollupFieldResponce” functions to refresh roll up attributes.

Call to refresh the roll up field, here is sample code….

Entity incident = new Entity(“incident”)
{ Id = incidentId };

int refreshedExAssetRequested = RefreshRollup(context, incident, “soft_exassetrequested”);
context.Trace(“new soft_exassetrequested: ” + refreshedExAssetRequested);

Function to execute

/// <summary>
/// refresh attribute
/// </summary>
/// <param name=”context”></param>
/// <param name=”entityToRefresh”></param>
/// <param name=”fieldToRefresh”></param>
/// <returns></returns>
internal static int RefreshRollup(SelectContext context, Entity entityToRefresh, string fieldToRefresh)
{

// print the old value of the roll-up field
context.Trace(“Total Accepted Qty (updated)= ” + entityToRefresh.GetAttributeValue<int>(fieldToRefresh));
// create a request by passing an entity reference and the targeted rollup field name
CalculateRollupFieldRequest crfrRequested = new CalculateRollupFieldRequest
{
Target = new EntityReference(entityToRefresh.LogicalName, entityToRefresh.Id),
FieldName = fieldToRefresh
};

CalculateRollupFieldResponse responseRequested = (CalculateRollupFieldResponse)context.OrgService.Execute(crfrRequested);

// read the entity and value of the rollup field
entityToRefresh = responseRequested.Entity;

// print the new value of the roll-up field
context.Trace(“Total Accepted Qty (updated)= ” + entityToRefresh.GetAttributeValue<int>(fieldToRefresh));

return entityToRefresh.GetAttributeValue<int>(fieldToRefresh);
}

Also, same rollup can be refreshed from JavaScript, here is sample code for it. Only thing you need to keep in the memory is that this refresh is async call and may take 10 second to refresh.

function RefreshSHRollup(entityToRefresh, entityId, rollupField) {

    //var requestUrl = Xrm.Page.context.getClientUrl() + "/api/data/v9.0/CalculateRollupField(Target=@tid,FieldName=@fn)?@tid={'@odata.id':'" + entityToRefresh + "(" + entityId + ")'}&@fn='" + rollupField + "'";
    var requestUrl = Xrm.Page.context.getClientUrl() + "/api/data/v9.0/CalculateRollupField(Target=@p1,FieldName=@p2)?@p1={'@odata.id':'" + entityToRefresh + "s(" + entityId + ")'}&@p2='" + rollupField + "'"

    try {

        var req = new XMLHttpRequest();
        req.open("GET", requestUrl, false);
        req.send();

    } catch (e) {
        console.log(e.message);
    }   

}

That’s it!

Thanks.