CRM 2013 – Business Process Flow – Access to multiple entities on the same business process flow

Dynamics CRM 2013 BPFs have many beneficial qualities.  They are available for both OOB and custom entities, can span across multiple entities. You can associate business process flows with security roles so that only people with those security roles can see or use them. Also there could be multiple entities associated with the same business bar for different security roles. What’s the behavior if user doesn’t have write access to one of the entity? Can this user click next stage to move the process forward without the write access to next entity?

We have two entities (Entity A & Entity B) added into the same business process flow. Below are our observations:

1)      If user has write access to Entity B, he is allowed to click on the Next Stage to create a new Entity B record or select an existing entity B record to make it associated to the business process flow:

CRM Business Prooces  Flow 1

CRM Business Prooces Flow 1

2)     If user has only read access to Entity B, the ‘create’ button will be hidden:

CRM Business Prooces  Flow 2

CRM Business Process Flow 2

After selecting an existing Entity B record, the entity B form shows up without process bar. This makes sense as this user is not allowed to update the process id on Entity B without the write access.

CRM Business Process  Flow 3

CRM Business Process Flow 3

 

I hope you find it useful!

Author: Zhe Chen
Title: Lead Dynamics CRM Consultant @ Adisys
Email: zhechen@adisys.co

Advertisements

CRM 2013 – Lookup Control Pre Search Event

Lookup Control PreSearch Event is the new feature in CRM 2013 and we can simply use it to apply the filter immediately when the lookup is clicked.

The lookup control has a PreSearch event that occurs just before the control launches a dialog to search for records. Unlike other form events, the Form Editor does not provide a UI to set event handlers for this event. We must use the addPreSearch and removePreSearch methods on the lookup control to add or remove event handlers for this event. Use this event with other Lookup Control Methods to change the results displayed in a lookup based on the form data current just before the lookup control shows search results for a user to choose from.

Use addPreSearch method to apply changes to lookups based on values current just as the user is about to view results for the lookup.

JavaScript

Xrm.Page.getControl(arg).addPreSearch(handler)

Sample of JavaScript:

 // Trigger(s): onLoad form

// Description: Lookup to filter the Verification Tracking Information records

function preFilterLookup() {

   Xrm.Page.getControl(“test_verificationdocument”).addPreSearch(function () { addLookupFilter(); });

}

// Description: Put your custom filter condition

function addLookupFilter() {

   var id = Xrm.Page.data.entity.getId();

   if (locmanageID != null) { 

       fetchXml = “”;

       Xrm.Page.getControl(“dodd_verificationdocument”).addCustomFilter(fetchXml);

   }

}

Add function on load of the form:

Dynamics CRM Event Handlers

Dynamics CRM Event Handlers

I hope you find it useful!

Author: Zhe Chen
Title: Lead Dynamics CRM Consultant @ Adisys
Email: zhechen@adisys.co

CRM 2013-Increase width of Process Step Label in Business Process

Business Process is the new feature in CRM 2013 and user can add multiple steps on the form. However we don’t have ability to change the layout of the process bar and the step name will be wrapped automatically.

To show the step name on the form completely, we decide to increase the width of the step name label by loading the customized CSS file. Following is the screenshot of layout change, JavaScript and the CSS file.

 

Business Process Formatting

Business Process Formatting

Sample Java Script used:

//***************************************************************************

// Script Type: Changing Process step Label width

//***************************************************************************

function LoadCSS() {

var head = document.getElementsByTagName(‘head’)[0];

var link = document.createElement(‘link’);

var path = Xrm.Page.context.getClientUrl() + “/WebResources/_cssfile”;

link.rel = ‘stylesheet’;

link.type = ‘text/css’;

link.href = path;

link.media = ‘all’;

head.appendChild(link);

 }

// End of the script

CSS:

/*Increase width of process step*/

.processControlContainer div.processStepLabel {

width: 230px!important;

}

.processControlContainer div.processStepLabel span {

max-width: 220px!important;

}

//end of CSS Script

______________________________________________________________

I hope you find it useful!

Author: Zhe Chen
Title: Lead Dynamics CRM Consultant @ Adisys
Email: zhechen@adisys.co