Posts

How to send Dataverse email through PowerAutomate

In one of my project requirements, I have to send some recursive email notifications to the account owner. I have chosen Scheduled flow to do this operation, Everything was fine till I created the email. Now, I wonder how to send this email. In traditional Dynamics workflow, we have a "send email" option but there is no such option I can see in flows. What to do now?😓 No worries, After some research, I found "Perform a Bound Action" by which we can send an email. In "Perform a bound action", We have to choose the table as "Email messages", Action name "Send Email" and just mention created email message id in Row Id. Finally, My flow looked like this  That's all, Now the email will be sent from Dataverse. Please subscribe blog for regular updates. Cheers, Rocker

How to avoid "for each" in Power Automate when there is only one record in Dataverse List rows

Image
There are some situations when we retrieve only a single row. To retrieve an entity record from Dataverse we generally use "List Rows" feature and this always returns an entity collection. Hence we always need to go in "for each" loop. As shown in the below example, I am creating an email on the creation of an account entity record in Dataverse. I have retrieved a queue to set it in "from" activity party of the email. I know that there is only one queue record but I am helpless if I directly select "Dynamic content", It automatically creates a "for each" loop. See in below screenshots: If I go for expression rather than "Dynamic content" then I can avoid "for each" loop, Please refer below screenshot: Below line, I have written in expression: outputs('List_rows_Queue')?['body/value'][0].queueid Here "List_rows_Queue" is the above step, [0] is the first row and "queueid" is a field

Power Automate: Create an Excel file during runtime and send it as email attachment through MS Flows

Image
I was working on a requirement where Dataverse entity record needs to be export in excel and send as an email attachment. In this scenario, each record must have a separate excel file, and as we know there is no way to create an excel file dynamically through flow. To achieve the above task, I have followed below steps: Step 1:  I created an excel template in one drive and this template has one table and two columns i.e. Name and City: We can increase/decrease columns as per requirement. In this example, my template name is "Sample sheet.xlsx" Step 2: Create a Microsoft flow that triggers on the creation of "Contact" in Dataverse: Then add a new step to get the file template from one drive that was created in Step 1: Next, Add a new step to copy the template with a new name at a new location on onedrive: I have created a new folder with the name "Copies" in onedrive before creating the above step. The next step is to compose rows, In step 1, I have created

Power Automate: Create and attach Dataverse note or activity with an entity record through MS flow

Image
There was a requirement where a note(annotation) will be created once an account is created in Dataverse. I have created a Microsoft flow to achieve this functionality. Below is the screenshot of the flow: It was not a difficult flow but I was getting below error in last step i.e, "Create a note and attach PDF" Resource not found for the segment. The reason for this error was assigning "Account id" in regarding: To resolve the above error, I have set "accounts(Account)" in regarding and it worked. You can also use "/accounts(Account)". Conclusion : Whenever you are creating a #Dataverse note or activity through #MSflow then use "entityname(entityid)" or "/entityname(entityid)" in regarding and don't forget to add suffix "S" in entityname. Cheers, Rocker

How and when to use Base64 expression in Microsoft flow.

Image
I have created a flow that gets trigger on update of an "account" entity record and creates a Note(Annotation) record in Dataverse, This note has a PDF attachment. Flow is like this, in the last step, I am creating a note in Dataverse and attaching a newly created PDF in it: But, I am getting the below error while attaching pdf in a note: Invalid character in field 'documentbody': '', hexadecimal value 0x04, is an invalid character. The reason behind it is the "Document" column, Flow accepts a file content in "Base64", hence I have to change it to base64: Below are steps to convert it in "Base64": Step 1: Click on the Document text box as highlighted below then click on "Expression". Step 2: Search for "Base64" and put bracket(). Step 3: Click on "Dynamic Content", keep the cursor in between the bracket() and click on "File Content" Step 4: Click ok. Now, the Document Text box has the follo

Workflow Error: Could not load type 'System.Buffers.Text.Utf8Formatter' from assembly

We were using Pre-Image in our workflow and returning an attribute value of this pre-image as an output parameter. Suddenly we were getting the below error: An unexpected error occurred from ISV code. (ErrorType = ClientError) Unexpected exception from plug-in (Execute): MyProject.Workflow.Value: System.Exception: Could not load type 'System.Buffers.Text.Utf8Formatter' from assembly 'MyProject.Workflow' because the method 'TryFormatDecimalG' has no implementation (no RVA).  The code was like this: Entity preImageEntity = crmWorkflowContext.WorkflowExecutionContext.PreEntityImages.Contains("PreBusinessEntity") ? crmWorkflowContext.WorkflowExecutionContext.PreEntityImages["PreBusinessEntity"] : null; StringAttrValue.Set(context,  preImageEntity .Attributes[AttributeName.Get(context)]); To resolve this issue, We have to implicitly cast attribute name "To String" as shown below StringAttrValue.Set (context,  preImageEntity  .Attributes[

How to set privilege for Activity Attachment (activitymimeattachment) in Dynamics 365 or PowerApps

Image
One day, some of the users in my Dynamics 365 CE environment were not able to attach a document against an appointment and other activities. A user who has a basic(user-level) create, global read, business unit edit, and global "append and append to" privileges on activities, trying to attach a document against an activity that is owned by another user/team. But unable to do it and getting an "insufficient privilege" message. We know that there is no privilege in the security role for "Attachment" and many people suggest that attachments are handled by "Note(annotation)" privilege. I have increased the notes privilege to global but no luck. After doing some research, I came to know that the "Activity attachments(Activitymimeattachment)" privilege depends on Activities. When I increased the activity  "Create, Append and append to" privilege to Global(Organization) then attachment also inherited this privilege. Hence users are a