Recently I came across an issue when I created a flow to send an email using template, where everything was working as expected however the email is not being triggered and throwing an error as below.

Exception Message: Exception occured in SLAInstance management custom action: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: The user with SystemUserId=xxxxxxxxxxxxxxxxxxxxx in OrganizationContext=xxxxxxxxxxxxxxxxxxxxxx is disabled (Fault Detail is equal to Exception details:

ErrorCode: 0x80040225

Message: The user with SystemUserId=65e463c2-2c58-4a34-9a6f-084c980b9162 in OrganizationContext=7173583a-876a-4652-a771-7229a6134270 is disabled”

The issue was resolved using the alternative I am going to discuss in this post.

When the trigger is met select the data verse list rows step and choose email templates table, in filter rows column in advance options select the template you want to send (Title eq ’email template name’).

In the next step select the perform unbound action step from data verse and choose the Action as “InstantiateTemplate”, in the template ID field get the template ID from the previous list rows step using the below expression.

first(body(‘List_rows’)?[‘value’])?[‘templateid’]

In the next step compose the email object using the compose date operation and give the input from the last step perform unbound action by using the below expression.

first(body(‘Perform_an_unbound_action’)?[‘value’])

Next step select add a row and select the email messages table and use the participationtypemask as required and provide the email addresses of the sender, receiver, cc, and Bcc by following the below codes.

We can either choose dynamic value for the sender or can give an email via participationTypeMask.

We can also use a queue by using the below expression via participationtypemask and GUID of the queue.

“partyid@odata.bind”: “/queues/xxxxxxxxxxxxxxxxx”

In the last stage we must send the email using the data verse perform a bound action.

Select the Email messages table and action as send email and row ID as email message and issue send to Yes as shown below.

Now the flow is completed once the flow is triggered it will send an email form the template selected.

Hope it helps!!