Scenario Overview
In this scenario, the business requirement we are addressing is to create a Contact direct from a Lead, without creating an Opportunity and to move all the open and completed activities over to the new Contact.
For this we don't want to use the out of the box lead conversion process, we are essentially recreating a custom process that suits our business needs.
To do this we are going to use the North52 Quick Button to create a button on a Lead that will create the record for us.
North52 Decision Suite Solution
The North52 Decision Suite solution works like this,
- We create a formula of type 'ClientSide - Calculation' on the Lead entity
- Add a North52 Quick Button to the form using the instructions that can be found here
- Set the formula shortcode for the Quick Button to your formula
- The Formula will first create the new Contact record
- Then it uses Fetch-XML to retrieve the list of activities.
- If the activity is open, it will update the regarding field to the new Contact
- If the activity is closed, it will store the status reason, then open the activity, update the regarding field and then close back down the activity setting the correct status reason
- Finally, as the last step, it will mark the Lead as Qualified
North52 Decision Suite Steps
The following set of steps will set this formula up for you.
- Create a new formula of type 'ClientSide - Calculation'
- Set the Source Entity to 'Lead'
- Copy and paste the formula below into the formula canvas
- Save the formula
- Create the Fetch-XML call using the below
- Click Save and you are ready to test
North52 Quick Button
Newly Created Contact
All the Activities Copied Over
Formula
SmartFlow(
SetVar('NewContact',
CreateRecord('contact',
SetAttribute('firstname', [lead.firstname]),
SetAttribute('lastname', [lead.lastname]),
SetAttribute('address1_line1', [lead.address1_line1]),
SetAttribute('address1_line2', [lead.address1_line2]),
SetAttribute('address1_line3', [lead.address1_line3])
)
),
ForEachRecord(
FindRecordsFD('FindAllActivities', true),
If(CurrentRecord('statecode') = 0, /* Activity is open */
UpdateRecord(CurrentRecord('activitytypecode'),
CurrentRecord('activityid'),
SetAttribute('regardingobjectid', 'contact', GetVar('NewContact'))),
/* Not Open -> Open Activity, Update the regarding, then close activity again */
SmartFlow(
/* Record Previous StatusReason */
SetVar('pStatusReason', CurrentRecord('statuscode')),
UpdateRecord(CurrentRecord('activitytypecode'),
CurrentRecord('activityid'),
SetAttributeStatus( 0, 1 )),
UpdateRecord(CurrentRecord('activitytypecode'),
CurrentRecord('activityid'),
SetAttribute('regardingobjectid', 'contact', GetVar('NewContact'))),
UpdateRecord(CurrentRecord('activitytypecode'),
CurrentRecord('activityid'),
SetAttributeStatus( 1, GetVar('pStatusReason')))
)
)
),
UpdateRecord('lead',
[lead.leadid],
SetAttributeStatus( 1, 3)
),
SmartFlowReturn(SetFormNotification('New Contact has been created - All activities have been moved over',
'INFO',
'msg1'))
)
Fetch-XML
<fetch top="50" >
<entity name="activitypointer" >
<attribute name="activityid" />
<attribute name="regardingobjectid" />
<attribute name="statecode" />
<attribute name="activitytypecode" />
<attribute name="statuscode" />
<filter>
<condition attribute="regardingobjectid" operator="eq" value="@leadid@" />
<condition attribute="statecode" operator="neq" value="2" />
</filter>
</entity>
</fetch>
Wizard - FindRecordsFD
Please see below the wizard you can use to create the FindRecordsFD() function call used in this formula.
Note you will need to have created the FetchXML beforehand.