This project is read-only.

Installing the solution

Import the managed solution just like any other CRM solution. You need to make sure that the user importing the solution has the Deployment Administrator privilege (which you can grant via the Deployment Manager) and the System Administrator role. (Thanks to maatthias for pointing this out)

 

CRM Online Update: This solution is now available for CRM Online. Make sure you use version 2.0.2.0 or newer and download the solution file marked as Sandboxed for CRM Online.

 

 

Adding a custom step in a process

The custom workflow activities included in this project can be used in either dialogs or workflows and work with CRM OnPremises and CRM Online.

 

image

 

 

Delete primary entity:

If you want your process to delete the primary entity of the workflow you must select True for the first argument. The second argument will be ignored.

 

Delete related entity:

You can delete related entities if you specify False to the first argument. You will then need to provide the attribute that links the related entity. For example, if the workflow is defined on account, and you want the workflow to delete the parent account (instead of the primary entity) you provide the "parentaccountid" as the linking attribute in the step configuration:

 

Share Step:

A share step is used in order to share the primary entity of the workflow (or a related entity) with a user or team. You must specify which record you want to share (primary vs. related) and who you want to share the record with (user and/or team). Note that you can specify both a user and a team, in which case the record will be shared with both. When sharing a record, all the privileges that are available will be shared. For example, if the workflow user has create, update and assign privileges on the record, it will share all of them.

 

Share primary entity:

The following example shares the primary record with another user:

 

Share related entity:

The following example is for a workflow whose primary entity is account. This configuration will share the primary contact of the account with the account owner and the test team:

 

Sharing specific Privileges

When you insert a Share step, you have the option to select which privileges you want to share. These are the possible selections:

  • Share (Fails If Not Allowed): The workflow step will attempt sharing the privilege with the target user / team. If the user under which the workflow is executing* does not have the privilege to share then the workflow will fail.
  • Share Only If Allowed: The privilege will be shared only if the user under which the workflow executes* has the privilege to share the specified privilege.
  • Do Not Share: The privilege will not be shared.

image

*Automatic workflows execute in the context of the workflow owner whereas on-demand workflows execute in the context of the user who executes the workflow on demand. More details here.

 

Unshare Step:

An unshare step is used in order to “unshare” or revoke shared privileges to the primary entity of the workflow (or a related entity) with a user or team. You must specify which record you want to unshare (primary vs. related). You can specify who you want to unshare the record with (user and/or team). Note that you can specify both a user and a team, in which case the record will be unshared with both. If you don’t specify any user/team then the record will be unshared with everyone with whom the record is currently shared. The configuration (input parameters) of the “unshare” step are similar to the share step (read above).

 

Create Hyperlink to CRM record:

You can create hyperlinks to the primary entity of the process or the related entities (N:1 relationships). You must specify the following properties in the step configuration:

  • URL of the CRM Organization [Required]. This is usually http://crmserver:port/orgname, but you might have "https" or have no port number.
  • HyperLink to primary entity or related entities [Required]. Select True for primary entity and False for related entities.
  • Attribute name to related entity. If you are creating a hyperlink to a related entity, you must provide the attribute name that relates the two entities. For example, if the primary entity is account and you are creating a hyperlink to the primary contact, specify the "primarycontactid" attribute.
  • HyperLink text. This is the text that the user will click in order to follow the hyperlink. For example, the text in the following hyperlink would be "Bing": Bing. If the hyperlink text is not provded (you leave it empty) then the text used will be the value of the primary field of the entity. For example if you create a hyperlink to an account named "ABC" then the text in the hyperlink will be "ABC".

Using the hyperlink in a dialog:

The custom workflow step has 2 outputs: The hyperlink generated for dialogs and the hyperlink generated for HTML fields. Make sure you select the "DialogHyperLink" output when using it in a dialog.

 

Using the hyperlink in an e-mail.

The custom workflow step has 2 outputs: The hyperlink generated for dialogs and the hyperlink generated for HTML fields. Make sure you select the "HtmlHyperLink" output when using it in an e-mail body or any other HTML field.

 

 

Qualify a lead:

When you insert the “Qualify” step in your process, you will be asked to select whether you want to qualify your lead to a contact, opportunity or account. You can select any combination of the three. If you are qualifying to an opportunity you must also provide the customer and currency for the opportunity.

qualifyStep

Once the lead has been qualified, the resulting entities can be used at a later step. For example, if you qualify your lead to an opportunity, you can insert an “update” step after to update the opportunity that was created by the “qualify” step:

qualifyStep2

 

 

Bulk Activate / Deactivate:

You can use this workflow step to bulk activate or de-activate multiple records in CRM (no record count limit). Insert the “Bulk Activate/Deactivate” step to your workflow. You will see the following options to configure:

image

The first parameter is used to define the query that defines which records you want to activate/deactivate. You can click on the lookup icon and then click “New”. In this example, I will create a query to deactivate all active accounts older than 1 year:

image

The second parameter (Target State) correspond to the state code to which I want to set my records. In this case I want the accounts to become inactive, so the corresponding statecode is 1. Most records in CRM have statecode 0 (for Active) and 1 (for Inactive). If you wanted to bulk activate (instead of deactivate) you would select 0 as your target state.

The third parameter corresponds to the target status. The default status is -1 which corresponds to the default status code for your selected statecode. If you want a different status than the default you can always browse the entity metadata to find the correct value. In this example, I want the status to become “Archived” so I look at the account “statuscode” field to find the corresponding value (100000000):

image

After configuring my custom step, it will look like this:

image

Note: There are special entities which you cannot activate/deactivate. For example, cases cannot simply be deactivated. They need to be resolved or cancelled, these special operations are not supported by this tool.

 

 

Cascade SetState:

Use this step in order to cascade the record status from parent to child records. For example, deactivate all contacts if you deactivate their parent account. This step requires 3 configuration parameters:

image

  1. Child Entity Name: The schema name of the child entity to which you wand to cascade the SetState operation
  2. Child Lookup Attribute To Parent: This is the schema name of the attribute (field) of the child entity that links to the parent entity via a lookup.
  3. Target Child State Code: The target state/status to cascade to the child entity. For most cases “1” is inactive and “0” is active.

You can cascade activate or deactivate operations by building your workflow with conditions. In the example below, the child contacts are deactivated if the parent account is deactivated, but also the child contacts are activated if the parent account is activated. You just need to use the correct value for the “Target Child State Code” argument of the custom workflow activity.

image

Last edited Jul 20, 2015 at 7:37 PM by GonzRuiz, version 15

Comments

peterwouda Feb 9 at 9:29 AM 
I am using this solution in a CRM 2016 update 1 online environment and want to make a hyperlink to a field that contains a URL(Dynamic) of that record.
If I show the content of that field in my dialog page it shows:
https://mycrm.crm4.dynamics.com:443/main.aspx?etc=10056&id=be716cda-5cee-e611-8102-5065f38b9551&histKey=275738567&newWindow=true&pagetype=entityrecord

When I use this field in your solution as value for the URL of the organisation and set the Hyperlink to true it shows the same url but it adds the following:
/main.aspx?etn=incident&pagetype=entityrecord&id=%7B843872ef-efc1-e611-80ff-5065f38bf341%7D

What can I do to stop this behaviour or can’t your solution cope with adding fields to the organisation url?
Kind regards,
Peter Wouda

sandyd Jul 17, 2013 at 8:01 PM 
When we change a field on the Opportunity record, we need to share the 'Potential Customer' or customerid. The workflow share function seems to fail here -- as the customerid is not really a sharable record (I fear). Is there a way to get at the 'contact' record that the customerid points to and share it?

tharinstar May 14, 2013 at 5:48 AM 
Hi GonzRuiz,

Why can't I see some entities in rollup query: entity type??

I can see most of the entities but not all. Am I missing something or need some configuration???

Cheers
Tharindu

akatsoulas Aug 11, 2012 at 9:06 PM 
Hi, I am trying to import the solution in my CRM Online but I am getting the follwoing error.
Error Code: 0x8004418B
Error Description: Plug-in assembly does not contain the required types or assembly content cannot be updated.
Should I wait for R9 release?

Thank you,

Alex

adrian_iredale Oct 27, 2011 at 1:24 AM 
All the utilities work for me except for the Qualify Lead when used in a Dialog. I get a error "Business process error". I followed the documentation instructions for filling in the parameters. Here is the error dump.

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: An error occurred in the CRM2011WorkflowUtilities.QualifyLead plug-in.Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorCode>-2147220891</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>An error occurred in the CRM2011WorkflowUtilities.QualifyLead plug-in.</Message>
<Timestamp>2011-10-27T00:21:58.678056Z</Timestamp>
<InnerFault>
<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>Unhandled Exception: Microsoft.Xrm.Sdk.InvalidPluginExecutionException: An error occurred in the CRM2011WorkflowUtilities.QualifyLead plug-in.
at CRM2011WorkflowUtilities.Helpers.Throw(String message, Exception innerException)
at CRM2011WorkflowUtilities.QualifyLead.Execute(CodeActivityContext executionContext)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Inner Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: An unexpected error occurred.Detail:
&lt;OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts"&gt;
&lt;ErrorCode&gt;-2147220970&lt;/ErrorCode&gt;
&lt;ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" /&gt;
&lt;Message&gt;An unexpected error occurred.&lt;/Message&gt;
&lt;Timestamp&gt;2011-10-27T00:21:58.6575495Z&lt;/Timestamp&gt;
&lt;InnerFault&gt;
&lt;ErrorCode&gt;-2147220970&lt;/ErrorCode&gt;
&lt;ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" /&gt;
&lt;Message&gt;System.NullReferenceException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #6ABCBFD7&lt;/Message&gt;
&lt;Timestamp&gt;2011-10-27T00:21:58.658526Z&lt;/Timestamp&gt;
&lt;InnerFault i:nil="true" /&gt;
&lt;TraceText i:nil="true" /&gt;
&lt;/InnerFault&gt;
&lt;TraceText i:nil="true" /&gt;
&lt;/OrganizationServiceFault&gt;
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)
at Microsoft.Crm.Extensibility.InprocessServiceProxy.ExecuteCore(OrganizationRequest request)
at CRM2011WorkflowUtilities.QualifyLead.Execute(CodeActivityContext executionContext)
</Message>
<Timestamp>2011-10-27T00:21:58.6790325Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText i:nil="true" />
</InnerFault>
<TraceText i:nil="true" />
</OrganizationServiceFault>

GonzRuiz Sep 19, 2011 at 7:05 PM 
Delete should work for custom entities

GonzRuiz Sep 19, 2011 at 7:04 PM 
The solution is not yet supported in CRM Online because custom workflow activities are not supported in sandbox, and CRM Online requires sandbox to register plugins

bopols Sep 16, 2011 at 1:44 AM 
Hello,
Will the Delete work for Custom Entities? I cannot seem to make it work.
Thanks
Bopols

bghalayini Aug 2, 2011 at 9:38 AM 
Hi GonzRuiz,

Why this can't be used for CRM Online? I really need it.
Is there any alternative solution for CRM Online 2011?

Your help would be highly appreciated.

Thanks,
Bilal Ghalayini