CRM 2013 – Business Process Flow – How to skip the stage across multiple entities dynamically?

Dynamics CRM 2013 BPFs have many beneficial qualities.  They are available for both OOB and custom entities, can span across multiple entities. Multiple processes can be created per entity and one can switch between each process in a record.

We have a business process flow across four entities and user need to choose to skip particular stage on UI. Unfortunately switching to another stage is not supported if different entity is associated to each stage in the same process.

Our solution is to create multiple BPFs and add a flag on process bar. User can select to skip Entity A by selecting this checkbox. The JS and real time workflow will be triggered to switch to another process immediately and refresh the page. You can also define your business rule to show this field on the form. Following is the details:

Dynamics CRM Business Process Flow

Dynamics CRM Business Process Flow

Sample Java Script used:

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

// Script Type: Onchange of the field Skip Entity A

// Description: Update Skip Entity A flag

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

functionupdateSkipA (){

var type=Xrm.Page.ui.getFormType();

if(type==2){

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

Xrm.Page.data.save();

Xrm.Utility.openEntityForm(“entity name”,id);

}

}

Real time workflow is created on field change event to switch Process and Stage. You can find the details in this blog: http://develop1.net/public/post/How-to-change-process-and-stage-programmatically.aspx

I hope you find it useful!

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

Advertisements

Access the fields on Quick View Form – Dynamics CRM 2013

Quick view forms in Dynamics CRM 2013 allow you to display all the related entity information.
Is there a way to retrieve the field value on Quick View Form using JavaScript without additional OData call to the associated entity?
The answer is Yes and here is the sample of the form and JavaScript:

Access fields on Quick View Form

Access fields on Quick View Form

 

 

 

 

 

 

 

 

 

Sample Code

<copy and paste the code>
//==============================================================

 function OnLoad()
{
          // pattern seems to be ControlName_ControlName_entityname_fieldname
var quickViewTelephone1Control = Xrm.Page.getControl(“AccountQuickView_AccountQuickView_account_telephone1”);
if(quickViewTelephone1Control != null) {
var telephone1 = quickViewTelephone1Control.getAttribute().getValue();
}
if (telephone1 == null) {
quickViewMobilePhoneControl.setVisible(false);
} else {
alert(“Telephone1 from Quick View is ” + telephone1);
}
}

//==============================================================

 

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

Dynamics CRM 2013 Duplicated GUID of the merged form

We have recently upgraded our client deployment Dynamics CRM 2013 from 2011 and encountered an error while importing the solution due to the duplicated guid of label on some merged forms.

Following is the form merge step which causes this issue:

1)      Open the auto-generated CRM 2013 form

CRM Auto-generated form

CRM Auto-generated form

2)     Click merge button

Dynamics CRM Merge Button

Dynamics CRM Merge Button

3)     Remove the duplicated fields and adjust the layout

4)     Click Save As button and enter the new form name.

5)     Disable old 2011 form and the auto-generated 2013 form

The problem is the duplicated guid of label is created after saving the new form. To avoid this issue, we merged the new form by below steps:

1)      Open the auto-generated CRM 2013 form

2)     Click ‘Save As’ button and enter the new form name. This must be done before clicking merge button.

3)     Click merge button

4)     Remove the duplicated fields and adjust the layout

5)     Disable old 2011 form and the auto-generated 2013 form

 

I hope you find it useful. As I learn more, I will continue to add more on upgrade experience with CRM 2013.

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

Show Textbox border and change tab color in Dynamics CRM 2013

Show textbox border and change tab color in CRM 2013

Out client has a requirement to show the textbox border and change the color of tab on a specific page. The textbox boarder is enabled in CRM 2011 by default however it’s removed in CRM 2013.
To enable the same I create web resource for the CSS file, and override an existing class/id. Then use JavaScript to add a reference to the CSS file.

Before & After change:

 

Javascript:
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);

}

CSS:
.refresh-form h2.ms-crm-Form{color: indianred !important;}
.refresh-form td,.refresh-form h3.ms-crm-Form{color: indianred !important;}
.ms-crm-Inline-Value{ border: solid 1px lightgrey; !important; }

 

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