I can't think of a single CRM implementation that I've been involved in where workflow was not used to send any emails. Every implementation has used the workflow engine to send emails when records are created, ownership changes, or when Opportunities are closed as a win/loss. The workflow engine is robust enough where we can embed a lot of detail into the body of the email about the record itself, but what if the user wants to actually view that record in CRM? Even in the Outlook client this can be a 3 step process:
- Open up the Email
- Click View In CRM, this opens up the actual email activity in CRM, not the record we want to view
- Click the Regarding Object Link
Now you are finally at the actual record you want to view. If you have Office 2007 there is now a button on the ribbon called View Regarding which cut's out a few steps from above. If you're not fortunate enough to be using Office 2007 yet, wouldn't it be nice if you could just embed a link in the body of the email message that provides a direct link to the record in CRM? Fortunately, it's relatively easy to do with a custom attribute and a little bit of Javascript.
Step 1 - Create A Custom Attribute To Hold The URL
For this example we'll just call our attribute: new_urllink with datatype varchar
Step 2 - Add The Appropriate Javascript to the OnSave() Event
The Javascript required varies depending on whether the entity is a custom entity or a standard out of the box entity. The Javascript is labeled appropriately below. The Javascript checks to see if this is an update form and that the new_urllink attribute is empty. If it is, then it will build the Url link.
Use the code below for a standard CRM entity (Example Below is for the Account Entity):
var objId;
var accountUrl;
if((crmForm.all.new_urllink.DataValue == null) || (crmForm.all.new_urllink.DataValue == ""))
{
if(crmForm.FormType == 2) //Checks to see if this is an update Form (value of 2)
{
var embedUrl;
accountUrl = "http://crmdemo/sfa/accts/edit.aspx"; //Default Path to the Edit.aspx page for an Account
objId = crmForm.ObjectId; //Retrieves the ID of the current object
embedUrl = accountUrl + "?id=" + objId; //pieces together the items required for a full Url
crmForm.all.new_urllink.DataValue = embedUrl; //Sets the value of the field
crmForm.all.new_urllink.ForceSubmit = true;
crmForm.Save();
}
}
Use the code below for a custom CRM Entity:
var objId;
var objType;
var customUrl;
if((crmForm.all.new_urllink.DataValue == null) || (crmForm.all.new_urllink.DataValue == ""))
{
if(crmForm.FormType == 2)
{
var embedUrl;
customUrl = "http://crmdemo/userdefined/edit.aspx";
objId = crmForm.ObjectId; //Gets the ID of the current record
objType = crmForm.ObjectTypeCode; //Gets the type code of the custom entity
embedUrl = customUrl + "?id=" + objId + "&etc=" + objType; //pieces together the Url
crmForm.all.new_urllink.DataValue = embedUrl;
}
}
Step 3 - Create The Associated Workflow
Now you can create a notification workflow and all you need to do is add this new_urllink field to the body of the email.
Step 4 - Your Done!
A List of Common Url's For CRM Entities:
You can find the paths for CRM Entities rather easily by browsing to the home directory of the CRM Website, if it's installed on the default website the path would be <drive>\inetpub\wwwroot. Once you have access to the CRM Website files find the folders that contain the edit pages for the various entities:
- SFA - Sales Force Automation (accounts,contacts etc)
- CS - Customer Service (cases,contracts etc)
- MA - Marketing Automation (campaigns, marketing lists etc)
Sales Force Automation:
Accounts: http://<crm-url>/sfa/accts/edit.aspx
Contacts: http://<crm-url>/sfa/conts/edit.aspx
Leads: http://<crm-url>/sfa/leads/edit.aspx
Opportunities: http://<crm-url>/sfa/opps/edit.aspx
Marketing Automation
Campaigns: http://<crm-url>/ma/camps/edit.aspx
Marketing Lists: http://<crm-url>/ma/lists/edit.aspx
Campaign Response: http://<crm-url>/ma/campaignresponse/edit.aspx
Case Management:
Cases: http://<crm-url>/cs/cases/edit.aspx
Contracts: http://<crm-url>/cs/contracts/edit.aspx
KB Articles: http://<crm-url>cs/articles/edit.aspx
Custom Entities:
Custom: http://<crm-url>/userdefined/edit.aspx
*Please substitute the actual url of the CRM Implementation you are working with where you see <crm-url> in the links above.
Posted
Jun 27 2007, 09:48 PM
by
Jeremy Winchell