Home | Forms | Guest Post: Create cases or other entities with ClickDimensions forms using North52’s Business Process Activities

Guest Post: Create cases or other entities with ClickDimensions forms using North52’s Business Process Activities

Collecting data from web forms and having it automatically saved into your CRM system is a fantastic way of making your business processes more efficient. ClickDimensions’ Form Capture is an excellent way to do this, however when you stray away from the Contact and Lead entities using the data collected in your Form Capture Fields it can become a little more tricky and often may require custom code. There is now an easy way…

Customer Support Request Form to Case

In this blog post we are going to take the very common scenario of capturing form data from a customer support request form and turning that into a Case record without any custom code. We are simply using the brilliant 3rd party product called North52 Business Process Activities (www.north52.com). Make sure you check out the fantastic offer for ClickDimensions customers at end of this post!

We will walk you through the process so you can use the same techniques for your CRM system, however we will assume that you know how Form Capture works in ClickDimensions.

If you already have a suitable form you can skim over the next section and get into the details of how North52 Business Process Activities can help in the section “The Solution – North52 Business Process Activities

Creating the Form

The final form will look like this:

1. Create a new Web Content record of type ‘Form’

Settings > Web Content > + New

2. Open the designer and create your fields and form layout

The First Name, Last Name and Email fields are mapped to Lead and Contact entity fields

The Case Type is set up like below – note the values here must correspond to the options available in your Case entity

Note the same values on the Case Entity field:

The Topic field is of type Text:

The Description field is of type TextArea and has the same Formatting and Mapping settings as the Topic

3. Test your form

Click the Embed button on the form designer to obtain the URL of the form and navigate to this URL.

Complete the form and submit it:

You should now have a Posted Form record and several related Posted Field records containing the data you submitted.

Posted Form:

Posted Fields:

The Problem

Now that we have this data coming into CRM we’d ideally like it to be automatically transferred into a new case record. Easy you might say – I’ll just create a workflow process to run when the Posted Form record is created and create a case with the related information. Unfortunately, it is not possible in the standard CRM workflow functionality to access child records and get at this information so what may have seemed an easy task quickly becomes a significant challenge which requires custom development work.

However, we have an easy solution which doesn’t involved code…read on…

The Solution – North52 Business Process Activities

North52 Business Process Activities (North52 BPA) is an advanced business process and rules engine for Microsoft Dynamics CRM and helps you simplify how you build and manage your customizations. It significantly reduces your need for development expertise and speeds up implementation time by up to 10 times – sometimes more! It has 3 main components; Formula Manager, Process Genie and Scheduler – find out more at www.north52.com.

We will create a Process Genie formula (a formula that executes within a standard CRM process – Dialog, Workflow or Action) that creates our Case record and populates Case fields with the values from the form posting. We’ll go a bit further and inject a bit of magic too by saying that the case should be due in 8 working hours (now try doing that in a standard CRM workflow!).

1. Create the Process Genie formula

Settings > Solutions > North52 BPA menu > Process Genie

A new window will open with the Process Genie form:

Under the Source & Target section set the entity to be Posted Form.

In the N52 Formula Tab and from the Functions list scroll to Platform Operations and select Create Record. The Create Record function will be inserted into the Formula Description area:

Change the ‘entityname, to ‘incident’ (the database name for the Case entity). Leave the next value as 1 – it is the number of records we wish to create. Tip: After a comma you can put the next parameter onto a new line for increased readability.

Now we need to set the case fields (attributes). Inside the CreateRecord and UpdateRecord functions there is a SetAttribute function for this task. The parameters of this function are:

SetAttribute(‘attributename’, ‘attributevalue’ )

  • ‘attributename’ – this is the Field to update. For this example it is the ‘title’ field for the Case
  • ‘attributevalue’ – this is the value to set. We need to populate the ‘Topic’ value from the Posted Fields that come from the submitted form and this is no mean feat! Keep reading to see how we do this…

This is where North52 BPA really excels – we need to get values from the Posted Form’s child records, and fortunately we have a function that lets us look up any value in any CRM record – it’s called the FindValue function and can be found in the Find section of the Functions.

So how do we use it? We have access to the Posted Form’s ID as that is the entity we are currently working with, and the Post Field records have a lookup reference to the Posted Form that uses this ID. With this information all we need to do is target the right value. The FindValue function looks like this:

FindValue(‘entitylogicalname’, ‘inputfieldname’, ‘inputfieldvalue’, ‘outputfieldname’,’defaultvalue’, ‘nolock’)

Let’s break it down for our purposes:

  • ‘entitylogicalname’ – the entity we are looking up, in our example ‘cdi_postedfield’
  • ‘inputfieldname’ – the field we want to search on, in our example it is two parameters so we use the sub-function SetFindAnd which lets us do this. The two parameters we want to match are the ID of the posted form and the Label: SetFindAnd(‘cdi_postedformid’, ‘cdi_label’)
  • ‘inputfieldvalue’ – the value to be used in our search. In our example as we are matching two parameters for the inputfieldname we need to provide two values to search for. Using the same SetFindAnd sub-function it should look like this: SetFindAnd([cdi_postedform.cdi_postedformid], ‘Topic’). The syntax for the Posted Form ID can be obtain by clicking in the Source Tab > Source Entity > Posted Form > Posted Form

    Clicking on this will output the following: [cdi_postedform.cdi_postedformid]
  • ‘outputfieldname’ – the field we want to retrieve the value from, in our example ‘cdi_value’
  • ‘defaultvalue’ – set to this if we don’t find a value. This shouldn’t happen as the field is mandatory on our form so we can leave it off our function.
  • ‘nolock’ – an advanced option that lets us specify a lock/no lock on the database while the query is executing. We’ll leave it off our function and let it use the default (nolock).

Our final FindValue function to look for the value submitted for our Topic now looks like this:

FindValue(‘cdi_postedfield’, SetFindAnd(‘cdi_postedformid’, ‘cdi_label’),SetFindAnd([cdi_postedform.cdi_postedformid], ‘Topic’) ,’cdi_value’)

We now need to repeat this for the Description and Case Type fields substituting the appropriate field references:

SetAttribute(‘description’, FindValue(‘cdi_postedfield’, SetFindAnd(‘cdi_postedformid’, ‘cdi_label’),SetFindAnd([cdi_postedform.cdi_postedformid], ‘Detailed Description’) ,’cdi_value’)),

SetAttribute(‘casetypecode’, FindValue(‘cdi_postedfield’, SetFindAnd(‘cdi_postedformid’, ‘cdi_label’),SetFindAnd([cdi_postedform.cdi_postedformid], ‘Case Type’) ,’cdi_value’)),

Setting the Customer field on the Case requires another function called SetAttributeCustomer:

SetAttributeCustomer(‘fieldname’, ‘entityname’, ‘recordguid’, ‘recordname’)

Breaking it down for our purpose:

  • ‘fieldname’ – the field on the Case entity we are updating, in our example ‘customerid’
  • ‘entityname’ – the entity name of the type of customer, in our example ‘contact’
  • recordguid’ – the ID of the contact, we can get that from the Posted Form entity the formula is associated with so select Source tab > Source Entity > Posted Form > Contact (Value) : [cdi_postedform.cdi_contactid]
  • recordname’ – the name of the contact, again we can get that from the Posted Form entity the formula is associated with so select Source tab > Source Entity > Posted Form > Contact (Name) : [cdi_postedform.cdi_contactidname]

The final SetAttributeCustomer function should be:

SetAttributeCustomer(‘customerid’, ‘contact’, [cdi_postedform.cdi_contactid], [cdi_postedform.cdi_contactidname]),

We have a couple more fields we need to set and then we are done. The first is easy as we don’t need to reference any other fields or entities – setting the Case Origin to Web:

SetAttribute(‘caseorigincode’,’3′)

The 3 value sets the picklist option to ‘Web’

The last field is where we are going to use another bit of North52 BPA magic – we are going to set a follow up time based on an 8 hour SLA using another clever function: GetNextWorkingTime

GetNextWorkingTime(‘startdate’, useBusinessCalendar, ‘DayStartTime’, ‘DayEndTime’, ‘NumberOfMins’)

  • ‘startdate’ – this needs to be set to ‘now’ (the time of the formula execution/form submission) so we use the function UtcDateTime()
  • useBusinessCalendar – determines whether to use the built in Business Closures calendar (Settings > Business Management > Business Closures); true or false
  • ‘DayStartTime’ – when does your business working day start, we will use 9am or ‘9:00’
  • ‘DayEndTime’ – when does your business working day end, we will use 5pm or ’17:00′
  • ‘NumberOfMins’ – how many minutes from the start date do we need to calculate from, we are using an 8 hour SLA so ‘480’ minutes

SetAttribute(‘followupby’,GetNextWorkingTime(UtcDateTime(), true, ‘9:00′, ’17:00’, ‘480’)

The final formula should be:

/* Create a Case Record and set values */

CreateRecord(‘incident’,

1,

/* Set Case Attributes from posted form values */

SetAttribute(‘title’, FindValue(‘cdi_postedfield’, SetFindAnd(‘cdi_postedformid’, ‘cdi_label’),SetFindAnd([cdi_postedform.cdi_postedformid], ‘Topic’) ,’cdi_value’)),

SetAttribute(‘description’, FindValue(‘cdi_postedfield’, SetFindAnd(‘cdi_postedformid’, ‘cdi_label’),SetFindAnd([cdi_postedform.cdi_postedformid], ‘Detailed Description’) ,’cdi_value’)),

SetAttribute(‘casetypecode’, FindValue(‘cdi_postedfield’, SetFindAnd(‘cdi_postedformid’, ‘cdi_label’),SetFindAnd([cdi_postedform.cdi_postedformid], ‘Case Type’) ,’cdi_value’)),

SetAttributeCustomer(‘customerid’, ‘contact’, [cdi_postedform.cdi_contactid], [cdi_postedform.cdi_contactidname]),

/* Set other Case Attributes */

SetAttribute(‘caseorigincode’,’3′), /* Set to Web */

SetAttribute(‘followupby’,GetNextWorkingTime(UtcDateTime(), true, ‘9:00′, ’17:00’, ‘480’)) /*Set SLA follow up date/time */

)

Save your Process Genie record and before we move onto the final step take a copy/note of the automatically generated formula Short Code in the upper right of the record form:

2. Create the Workflow to trigger the Process Genie formula

We now need to trigger the Process Genie formula created above from a CRM workflow. Using a CRM workflow allows you to put conditional logic in and process different Process Genie’s within the same workflow – for example you might have several forms and want to trigger different processes for each form.

We are only concerned with one form in our example so our workflow is going to be very simple – on create of a Posted Form record execute the Process Genie formula:

Navigate to Settings > Processes and create a new Process. Select Workflow for the category and Posted Form for the entity and give your workflow an appropriate name:

Set up the workflow options like this:

Add the Process Genie workflow step: Add Step > North52 > N52 Process Genie

Click on the Set Properties and add your formula short code:

Save and Activate your workflow and you are done! Time to test.

3. Test the workflow

Using the form posting we submitted earlier we can manually run our workflow on the Posted Form record.

Open Advanced Find, select the Posted Form entity and click the Results button. From the results open the relevant Posted Form record and start the Create Case from Web Form workflow.

Once the workflow is completed navigate to your Case and open the newly created Case. It should have the Topic, Customer, Type, Origin, Follow Up By (with SLA calculation) and description fields set from the Posted Fields information:

4. Finally do an end-to-end test

As a final check to ensure the whole process works end-to-end submit another form and make sure the case is created automatically.

But wait there’s more!

Phew! That is a bit of a long post but once you have done it once it is easy to create again. You can use North52 Business Process Activities for a lot more than creating Cases from form data – it can be used for all types of processes and customization and is often about 10 times faster than having to develop with C# and/or JavaScript code (there are over 160 built in functions). See the North52 knowledge base and videos for examples and tutorials to get you started.

A fantastic offer for ClickDimensions customers – 25% discount!

North52 is offering 25% discount on the Business Process Activities product for ClickDimensions customers. This offer is valid until 15 February 2014. Head over to www.north52.com/clickdimensions to find out more.

About the Author:

mm
The ClickDimensions marketing team is committed to helping marketers using Microsoft Dynamics 365 achieve their goals.

Leave A Comment