Microsoft Dynamics CRM allows you to use sequential numbers for individual records. In today’s blog, we will show you the steps needed to set a sequential number on a record by date and resetting the sequence the next day. Let’s get started!
Scenario: You send an automated email out to your manufacturer each time you win an opportunity to notify them of the parts you’ll be needing to begin work. This manufacturer requires a specific naming convention in the subject of the email that matches the following format: [Company Name] [Number of Submissions Made Today]. The initial email subject line will look like this: PowerObjects 1. In order to get the next email’s subject line to auto populate as PowerObjects 2, creative customization and set up is needed.
1. First, create a custom entity. In this example we will name it “Manufacturer submission #.” In this entity, create the following fields:
- Today’s date – date only data type
- Submission number – whole number data type
- Increment by – whole number data type
2. Create a single record for this entity and fill out the fields as shown below.
3. Now, create a look up field within the opportunity to this new entity. We’ve named the field Reference Submission #. Use a business rule to always populate that field with the Master record.
Don’t forget to give users the appropriate security roles for this new entity so they can append to the opportunity. For steps on creating such a business rule, you can reference this blog.
4. Create a workflow that uses logic to reference the Master record associated to the opportunity to determine what number to append in the subject line. The workflow will look something like this:
The logic in the first step is looking to the master record, which contains today’s date, to determine if this is the first email being sent today. If it is not the first sent today, an email is sent with the subject line listing the reference submission number on the master record.
Then the master record is updated to increase the submission number so the next email sent on this same day reflects an accurate number of submissions for the day in the subject line.
If this is the first email being sent today, the email is sent out with the static subject line as pictured below.
Finally, the Master record is updated with today’s date and a submission number of 2 so the next email sent on this same day meets the criteria in the first line of logic.
That’s it, readers! Subscribe to the blog to get updates like this one delivered right to your inbox.