Skip to main content

In todays post, HSD’s Dynamics Technical Consultant – Ash Dason runs us through a quick tip on how he solved an issue with Dynamics creating duplicate email tokens.

Issue:

Emails created had duplicate tracking tokens, generated through Dynamics 2015.

Details:

We had a custom plugin workflow running a batch job to send emails out with some pdf attachments. The workflow was registered to run asynchronously. All the emails were successfully created and sent out around the same time. The plugin to send the email was running in the context of the SYSTEM user. When emails were generated using the job, all of them had duplicate tracking tokens.

However, when the same process was invoked by a user the emails had the correct tracking token.

Troubleshooting

  1. Analysis of the code showed there weren’t any instances that were manually setting the tracking token.
  2. Changing the tracking token settings in System Settings hoping this would “clear” the issue didn’t fix the issue.
  1. Manually setting the tracking token (https://docs.microsoft.com/en-us/dotnet/api/microsoft.crm.sdk.messages.gettrackingtokenemailrequest?view=dynamics-general-ce-9) hoping this would override what the system does didn’t fix the issue either.

Resolution

Finally we changed the plugin to Run in User’s Context and this fixed the issue. Remember to manually check the SDK plugin processing step after the deployment to ensure the step is overwritten. Some older versions of on premise CRM does not update the “run as” property even when the overwrite option is selected.


Make sure you check out more of HSD’s blog posts by visiting https://www.hsd.com.au/blog/