If you have stumbled across this, have a look at this first. If however you have come from there let me tell you how it works, how you can extend it.
All the screen shots below are from a Contact (as that has 3 emails so can show you everything)
One of the key things, before you even get into the entity is the option set. Basically everything is centred around this. This is where we set our safe email and safe domain. Once you have this it links to the new fields you create and the workflows that are triggered.
Within contact 6 fields were created.
- Domain – a simple text field that is populated by workflow
- Domain Option set – a calculated option set linked to the Email Management Option set. It has a default value of the domain and also the calculation sets the value to the domain (belt and braces)
- Replacement email Option set – a calculated option set linked to the Email Management Option set. It has a default value of the default email and also the calculation sets the value to the default email (again belt and braces)
- Email X – Safe domain – these are calculated two option fields. The calculation is looking at the corresponding email field to and checks to see if it contains the domain name and then it sets the Yes / No accordingly.
For neatness (and ease of testing) I then put these fields (together with the actual email address fields) on a dedicated form.
With the fields created – I then created the views adding in the 6 fields I had previously created
Each of the views have a slightly different filter
- All information with domains – no filter on this
- Domain not populated – Domain field does not contain data
- Non Domain email – This is an OR clause against all of the safe domain fields if they equal no
So that’s the views completed, next I created my workflow. It was all controlled through 1 background workflow. It was set to run on demand, on create and also on change of the email fields
The process itself is 3 simple steps.
- It populates the domain field with the safe domain
- It checks to see if the email field contains the domain
- If it doesn’t contain the domain it populates the email with the safe email
Steps 2 and 3 are repeated for every email field.
The workflow looks like this
But if you want to go a little deeper you would see the following.
When we created our field the Domain option set was calculated and had the ‘safe domain’ as the default and calculated result. We are now able to pull this into the domain text field in the first step of the workflow.
the first part of step 2 is the condition, it will only work when there is a value is the corresponding email field. The check made is that it DOES NOT contain the domain (populated in the previous step) there are other ways to do this condition but in testing I found this worked every single time however old the record and however good the data.
If the If statement was true (is the email isn’t safe) then the next step takes the replacement email value and populates the email field with it. Because we created the replacement email field as a calculated option set we know it is always populated and ready to use.
So that is basically all there is to it.
- Ensure you have the option set with the 2 values
- Create the fields as described above
- Create the views / forms
- Create the workflow
So if you want to extend this concept to your own entities hopefully this will give you the skills on how to do it as a no code solution.