Hide ‘See associated records’ and ‘See all records’ on Sub Grid

As part of UCI two new buttons has been added to the Sub-grid, these are ‘See Associated records’ and ‘See all records’. On click of ‘See Associated records’ will lead us to Associated view of the open record and ‘See al record’ will lead to all records view.

But some time we need to hide those buttons then these button wont show up in ‘Ribbon Workbench’. Thus, to hide these buttons we need to remove from ‘Navigation’ from ‘entity’s form’, you need to just remove only respective navigation not all, ref below image ..

Continue reading “Hide ‘See associated records’ and ‘See all records’ on Sub Grid”

Open create ‘Form’ from sub-grid directly by avoiding associated records between entities

In MSD 365, when we add sub-grid on form by creating relation between two entities, it will gives Create (+) button and associate view button. When we click on Create (+) button, dynamics shows already created associations between these two entities, ref below screen shots…

Association

Some time we don’t require this associated records and always want to create new record by avoiding all those clicks. We can achieve it by making relation mandetory, just as shown in below image.

make it relation required

…and you are done, now go back to the subgrid and click on the ‘Create’ (+) button, it will launch new create window and won’t ask to select existing association.

Thanks.

Document creation in MSD 365

Many times we need to create document in MSD CRM and or MSD 365, ex. Quote. In earlier CRM version it was not available out of the box. But as part of MSD CRM 2016 and MSD 365 its has been introduced out of the box, in few clicks we cam create document or automate the process with the help of out of box workflow.  Continue reading “Document creation in MSD 365”

Setting up a visual hierarchy on a custom entity

hier-main

Hierarchy visualisation can be configured in MSD 365, its pretty easy. Here are the steps for it. Continue reading “Setting up a visual hierarchy on a custom entity”

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.

Editable Grid on Form and Workflow issue

new things

In the earlier post, it’s explained that how to make a view to be editable (Click here to explore that article). In this post, I will explain how to make any entity grid editable on form where it has been used as Sub-grid.

Its as well a simple configuration, here are the steps for it,

  1. First of all, that particulate entity must be enabled for an edit on entity level, if you don’t know how to make it, please explore it here.
  2. well, one entity is enabled for it now, open that particular form where you want make sub-grid as editable
  3. select that sub-grid and click on change property button on ribbon or simply double-click on that sub-grid. Refer below screenshot for same…..
  4. editble grid 4
  5.  once you open Sub-grid property, please click on Control tab ==> Add Control, please refer below screen shot for it…..
  6. editble grid 5
  7. It will add control, now set the properties for the sub-grid for the form, ref below screenshot …..
  8. editble grid 6
  9. Now, please save and publish the entity.

 

but there is one issue with the editable grid when we add that on from then Workflow dynamic values will be completely blank, just like below …

This slideshow requires JavaScript.

Resolution for the issue is…

  1. deactivate the editable grid form then create the workflow, re-activate the editable grid form
  2. Remove the editable grid feature from the form then create workflow and enable the editable grid feature on the form

That’s it!!

Thanks !!

Editable Views in MSD 365

In MSD 365, developer’s life is much easier than earlier. I do remember my team invested days to developer editable grids for an entity on from.

But now it’s just out of the box feature, it’s cool, isn’t it?

This feature has been introduced in MSD CRM 2015 but it was for very limited entities. But now it’s available for almost all entities including custom entities.

For this we need enable entity to be editable. Here are the steps to make it enable

  1. Go to customisation
  2. Open entity configuration
  3. editble grid 1
  4. Click on Control to add editable grid for the entity
  5. editble grid 2
  6. now  select it behaviour
  7. editble grid 3
  8. After behaviour selection, publish the entity.
  9. It will make main view as editable on the fly.
  10. You can undo this editable grid any time in future,  for that just delete added control and publish the entity
  11. That’s it.

Thanks !!

Plugin debugging

solution-mgmt

Have you ever stuck in a situation where the plugin working perfectly in a test environment but not the SIT/UAT/Production environment?

Remote debugging might be a tricky setup in most of the production server because of the firewall constraint or even many times developer does not have access to the following environment. In such situation how we can survive, Debugging skills will save us in this situation.

Debugging is must skill for every developer while updating or fixing any code; we need debugging skills.  Continue reading “Plugin debugging”

Configure and visualise hierarchical data

In MS Dynamics CRM, Self join has special powers, with self join we can create hierarchical data structure, as shown below,

hirarchy Continue reading “Configure and visualise hierarchical data”