Common Library

Below is a summary of what is included with the common library and the third party addons that I recommend users to also install.  You can download the unmanaged common library solution from here.  If you want the managed solution click here.

Before you can install the common library, you need to install the following components:

  1. Workflow Utilities managed solution from GonzRuiz – https://mscrmworkflowutilities.codeplex.com/
  2. AG Workflow Utilities managed solution from Gemina – https://crm2011distributewf.codeplex.com/

If you plan on installing my Base Solution, then you should install the Base Solution first from here.

Also credit to XCentral for letting us use their development environment to build this.  Contributions made by Boutros Zalloua, Joe Mouawad and Chadi Tannous.


The following are the functionalities & features of the TECHLUNGE UTILITIES:
1- Multi-language lookup fields
——————————
By default the Country/Region fields on the Account, Contact and Lead entities are free text fields that a user must manually fill every time. This can result in some serious issues with data quality that make it difficult to perform a common task such as searching for Accounts from specific countries.
This can be fixed by using a custom entity to hold the country labels as follows:
– Add a new field with the specific language to add for example add a new field called “Name (French)” to the custom entity “Country”.
– Add a new view with the new field of this specific language and call the view “Countries (French)”.
– Get the view id and add it to the script “setCountryLookup” function.
– Add this field to the quick find view.

On the Contact entity:
– Add the field lookup (country) to the form.
– On change of this field, add the function “fetchCountryName” from the script “xce_FetchCountryName”.
– On load of the form, add the functions “fetchCountryName” from the script “xce_FetchCountryName” and “setCountryLookup” from the script “xce_SetCountryLookup”.
– On Save of the form, add the function “SubmitCountryName” from the script “xce_FetchCountryName”.

credit: Pinnecco – https://crmcountry.codeplex.com/

2- Domain Checker
——————–
The Domain Checker feature forces restrictions on the email of the Contact to have same domain as the Account. For example John cannot have an email with a domain that does not exist on the Account level.

This feature introduces a new custom entity “Allowed Domains”, this entity is related to the Account by a “N-N” relationship and displayed on the Account as a grid. On the other hand, any contact Created or any update on the primary email of the Contact or on adding of the Contact to the Account, an error message will be displayed in case the domain of the Contact primary email does exist on the Account.

3- Associate and Disassociate N:N relationships
——————————————-
The Associate and Disassociate custom activities are used in a workflow to associate or disassociate two records together by the relationship name, they work only between two entities having the N:N relationship.
You must specify the following properties in the step configuration:
– Record 1 URL which is the record URL(dynamic) of the first record.
– Record 2 URL which is the record URL(dynamic) of the second record.
– Relationship Name which is the relationship schema name between the two entities.
For example: the Subscription process:
The Contact has a N:N relationship with the Contact Preferences entity and the Subscription entity has two mandatory lookups to Contact and Contact Preferences.
On Subscription creation, a workflow will run and check if the “Opt” field value is “In” then it will execute the Associate action otherwise it will execute the Disassociate and both with input parameters as follows:
– Record 1 URL: Record URL(dynamic) Contact Preferences.
– Record 2 URL: Record URL(dynamic) Contact.
– Relationship Name: xce_contactpreferences_contact.

4- Change Process Stage
————————
The Change Process Stage custom activity is used to change the stage of the business process. You must specify the following properties in the step configuration:
– Record URL: It is the dynamic url of the record.
– Process Name: It is the process name of the activated business process.
– Process Stage Name: It is the Stage which we want to change into from the activated process.

5- Start Scheduled Workflows
—————————-
This solution consist of a recurring process in Dynamics CRM that executes a FetchXML query to return a set of records and then starts a workflow for each of those records without requiring any external processes or tools. This is a generalized approach to solving a class of problems that includes the following scenarios:

* The birthday greetings problem: How can you, on a daily basis, send an e-mail to every contact with a birthday = today (where the date value for today is obviously different every day)?
* The monthly update problem: How can you, on a monthly basis, generate an activity for every account with status reason = X (where it’s important that the process only runs on a certain day of the month based on status reason values as of that exact date)?

The solution is composed of three things:
– A custom workflow activity (StartScheduledWorkflows) that can execute a supplied FetchXML query and initiate the workflow for each retrieved record.
– A custom entity (Scheduled Process) to hold the FetchXML query and scheduling details.
– A workflow (Scheduled Workflow Runner) to run the StartScheduledWorkflows activity on a recurring schedule.

A Scheduled Process record is created, which starts a corresponding Scheduled Workflow Runner workflow in a timeout state. When the next run date == the current time, the Scheduled Workflow Runner workflow initiates the StartScheduledWorkflows activity with the FetchXML query and workflow lookup from the Scheduled Process record. The StartScheduledWorkflows activity advances the next run date of the Scheduled Process record, and then it executes the FetchXML, loops through the results and starts the workflow from the lookup for each record. A newly started Scheduled Workflow Runner workflow then waits for the next run date to start the process again.

Credit: Lucas Alexander – http://www.alexanderdevelopment.net/post/2013/05/19/scheduling-recurring-dynamics-crm-workflows-with-fetchxml/

6- Copy Notes – Attachments
——————————
The Copy Notes – Attachments custom activity is used to copy the notes and attachments from one record to another. You must specify the following properties in the step configuration:
– Record 1 URL: This is the dynamic URL of the source entity.
– Record 2 URL: This is the dynamic URL of the destination entity.
– With Attachments (Yes/No): If this option is set to “Yes” then it will copy all the Notes with or without attachments, if it is set to “No” then it will only copy the Notes with no attachments.

7- Calculate Rollup Field
————————-
This feature allows you to forcibly calculate the rollup field by using it in a workflow (Sync & Async).
You must specify the following properties in the step configuration:
– Field Name: This is the Rollup Field Name.
– Parent Record URL: This is the parent record to calculate against.
For example, Let’s say you have a web portal where students enrol in one of the classes. The portal should show the total enrolled students. Whenever a student enrols, the Total Students field on the Class entity should aggregate the total enrolled students using the Count function. This can be done using this custom activity in a realtime workflow.

8- Rollup Functions
——————–
This feature allows you to execute a calculation of rollup values (Count, Sum, Average, Min & Max) based on numeric and Money attributes from a FetchXML Query.
You must specify the following properties in the step configuration:
– Fetch XML: This is the fetch XML query.

For example, we can create a On Demand workflow which calls this custom activity and pass a fetch xml to get all the opportunities of an account with the “Estimated Revenue” as column. Then we can post the rollup values in the account description.
<fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”false”>
<entity name=”opportunity”>
<attribute name=”estimatedvalue” />
<attribute name=”opportunityid” />
<order attribute=”estimatedvalue” descending=”false” />
<filter type=”and”>
<condition attribute=”parentaccountid” operator=”eq” uitype=”account” value=”{PARENT_GUID}” />
</filter>
</entity>
</fetch>

9- Opportunity Measurement
—————————-
In the current CRM, we cannot measure the number of opportunities in a particular stage of the sales process that has gone up/down, or how the total estimated revenue from open opportunities is developing.
This solution is about using the rollup fields to automatically collect the metrics from open opportunities, the recurring workflows to create historical snapshots of these metrics and visualise these snapshots via charts to show weekly pipeline trend.

Credit:  Jukka Niiranen – http://survivingcrm.com/2015/06/tracking-pipeline-development-over-time-in-crm-2015/

A- Solution Structure
—————–
a- Opportunity Process Stage entity: It is a lookup on the Opportunity entity and holding a Stage, Date and two rollup fields “Opportunity Revenue” and “Opportunity Count”.
b- Update Opportunity Process Stage workflow: It is a workflow which creates an “Opportunity Process Stage” record on change of the Opportunity stage and updates the lookup on the Opportunity.
c- Snapshot entity: It is an entity holding same fields as the “Opportunity Process Stage” entity but not rollup.
d- Process Stage Snapshot: It is a workflow which checks if the “Opportunity Process Stage” is active and creates a “Snapshot” record with same values of the “Opportunity Process Stage”.
e- Estimated Revenue by Week and Stage chart: It is a stacked column chart on the “Snapshot” entity, with “Estimated Revenue” in the legend series, “Date (week)” and “Stage” in the Horizontal axis.
f- Opportunity Count by Week and Stage chart: It is a stacked column chart on the “Snapshot” entity, with “Opportunity Count (Count)” in the legend series, “Date” (week) and “Stage” in the Horizontal axis.

B- Configuration (Scheduled Process)
————–
Create a Scheduled Process” record on the entity “Opportunity Process Stage” and the workflow “Process Stage Snapshot” with weekly frequency and a query to get all the active “Opportunity Process Stage” records.

On change of the stage of an Opportunity, the workflow “Update Opportunity Process Stage” will create a new record of the “Opportunity Process Stage” with the Stage, Date, Number of Opportunities and total Revenue. Then on a weekly basis, the “Scheduled Process” will run the “Process Stage Snapshot” workflow against all the active “Opportunity Process Stage” which will create the “Snapshots”.

The two charts will show the progress of the Opportunities by Stage and Revenue / Count by using the created Snapshots.
———————————————————————————————————————————————————————————————-
———————————————————————————————————————————————————————————————-

The following are the functionalities & features of the third party WORKFLOW UTILITIES:
1- Ability to bulk activate / deactivate records
——————————————
This feature can activate or de-activate multiple records in CRM (no record count limit). Insert the “Bulk Activate/Deactivate” step to your workflow.
You must specify the following properties in the step configuration:
– Query for records to Bulk Activate / Deactivate: It is used to define the rollup query that defines which records you want to activate/deactivate.
– Target State: It corresponds 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.
– Target Status: It 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.
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.

2- Ability to update status of child cascading records
————————————————
This feature can cascade the record status from parent to child records. For example, deactivate all contacts if you deactivate their parent account. You must specify the following properties in the step configuration:
– Child Entity Name: The schema name of the child entity to which you wand to cascade the SetState operation
– 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.
– Target Child State Code: The target state/status to cascade to the child entity. For most cases “1” is inactive and “0” is active.

3- Ability to create a hyperlink using workflow
——————————————-
This feature allows you to 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 provided (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”.

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.
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.

4- Ability to delete a record
————————–
This feature allows you to delete the primary record or related entities.
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.
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:
You must specify the following properties in the step configuration:
– Delete primary entity (True) or related entity (False): If it is True then it deletes the primary entity otherwise it deletes the related entity specified in the second parameter.
– If deleting related entity, specify attribute name to get the related entity: It is a single line of text to specify the primary key of the related entity.

5- Ability to automatically 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. With this feature, you can now select any combination of the three. If you are qualifying to an opportunity you must also provide the customer and currency for the opportunity.
You must specify the following properties in the step configuration:
– Lead: It is a lookup for the lead record.
– Status of the lead after qualifying: It is the status of the lead after qualifying, it can be Qualified, Contacted…
– Create Contact: If it is “True” then a Contact will be created.
– Create Account: If it is “True” then an Account will be created.
– Create Opportunity: If it is “True” then an Opportunity will be created.
– Transaction Currency of the Opportunity: It is an optional lookup for the currency of the Opportunity.
– Parent Contact of Opportunity: It is an optional lookup for the Contact of the Opportunity.
– Parent Account of Opportunity: It is an optional lookup for the Account of the Opportunity and applicable only if the Parent Contact is not provided otherwise the workflow will fail.

 

6- Ability to automatically share a record
————————————–
This feature allows you 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.
You must specify the following properties in the step configuration:
– Share primary entity (True) or related entity (False): If it is set to True then the sharing will be on the Primary entity otherwise it will be on the related entity that is specified in the second parameter.
– If sharing related entity, specify attribute name to get the related entity: It is a single line of text to specify the primary key of the related entity.
– User to share the record with: A lookup to the user to share the record with.
– Team to share the record with: A look to the team to share the rercord with.

7- Ability to automatically unshare a record
—————————————-
This feature allows you 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.
You must specify the following properties in the step configuration:
– Unshare primary entity (True) or related entity (False): If it is set to True then the unsharing will be on the Primary entity otherwise it will be on the related entity that is specified in the second parameter.
– If unsharing related entity, specify attribute name to get the related entity: It is a single line of text to specify the primary key of the related entity.
– User to unshare the record with: A lookup to the user to unshare the record with.
– Team to unshare the record with: A look to the team to unshare the rercord with.
———————————————————————————————————————————————————————————————-
———————————————————————————————————————————————————————————————-

The following are the functionalities & features of the third party AG UTILITIES:
1- Ability to run a workflow on each record that has a N:N or 1:N relationship to the current record
——————————————————————————————–
This feature allows you to distribute workflows on related entities 1:N or N:N.
You must specify the following properties in the step configuration:
– Distributed Workflow: It is a lookup to the child workflow which will be distributed.
– Relationship Name: It is a single line of text reflecting the relationship name.

For example:
————-
We create a child workflow “Set Case Priority to High” which updates the priority of the case to “High”, this workflow needs to be distributed on the Contact record.
Then we create another workflow on demand “Make Contact’s Cases High Priority” which calls the “Distribute 1:N” custom activity with the following parameters.
– Distributed Workflow: Set Case Priority to High.
– Relationship Name: incident_customer_contacts.
Once this workflow is ran on a certain contact record, then all the priority of all the related active cases will be updated to “High”.
———————————————————————————————————————————————————————————————-
———————————————————————————————————————————————————————————————-

 

 

Advertisements