cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GaneshT
Frequent Visitor

How do I pass multiple entity records Guid’s of different type to TO Recipients while creating a email record using power automate

How do I pass multiple records Guid’s of different type to TO Recipients while creating a email record? Its dynamic count from source system so cannot add multiple using icon T.

Getting below error

Error: Bad Request - Error in query syntax.

[

  {

    "participationtypemask": 2,

    "partyid@odata.bind": "{accounts(abxxxx-xxxxx-xxxxx-xxxx-xxxxxxxx)},{contacts(yyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyy)}"

  }

]

 

9 REPLIES 9
Expiscornovus
Super User II
Super User II

Hi @GaneshT,

 

I am assuming you are using the Web API?

 

If so, can you try this approach:

{
    "description" : "Email Created", 
    "regardingobjectid_account@odata.bind" : "/accounts(@{variables('AccountId')})",
    "subject" : "Test Email Creation", 
    "email_activity_parties" : [
        {
            "partyid_systemuser@odata.bind" : "/systemusers(@{variables('SystemUserId')})",
            "participationtypemask" : 1  
        },
        {
            "partyid_account@odata.bind" : "/accounts(@{variables('AccountId')})",
            "participationtypemask" : 2  
        },
{            "partyid_contact@odata.bind" : "/contacts(@{variables('ContactId')})",
            "participationtypemask" : 2 
        }
]
}

 

More examples can be found over here:

https://community.dynamics.com/365/b/dynamics365enterprisecloudfronts/posts/creating-an-email-activi...

Thanks @Expiscornovus , for quick reply. 

We are using Microsoft flows to sync from Regional Prod A and Regional Prod B to Global Prod  of dynamics.

We do sync accounts, contacts and activities to Global Prod

During which all emails from regional to be synced with Global Prod

  • Fetch To Recipients from source and form the same with Target Guids as below

{accounts(abxxxx-xxxxx-xxxxx-xxxx-xxxxxxxx)},{contacts(yyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyy)} and

  • Store it in a legacy field in Target using CDS (Current Data Service)
  • In Target, use CDS (Current Environment) to refer this field in cloud flow- Email (Create or Update) Activity Parties
  • On Create of Email record in Target, another flow is executed in target to pick value from legacy field and update To Recipients.

 

Getting below error

Error: Bad Request - Error in query syntax.

 

it would be great if i could update recipients like you mentioned as below

{
"partyid_account@odata.bind" : "/accounts(@{variables('AccountId')})",
"participationtypemask" : 2
},
{ "partyid_contact@odata.bind" : "/contacts(@{variables('ContactId')})",
"participationtypemask" : 2
}

JorgeFerr
New Member

Try to append your data into an array first like this:

JorgeFerr_0-1614690400081.png


Then use the variable to bring multi contacts:

JorgeFerr_1-1614690490329.png

Let us know if this solves your problem.

JorgeFerr
New Member

Correction:
It is "contactid" coming from Contacts entity (not contact_id)

JorgeFerr_2-1614690910824.png

 

ManishJain
Solution Sage
Solution Sage

Hi @GaneshT ,

 

Since you are syncing data from one environment to other why are you sending emails. Utilize data configuration utility or Excel import for this purpose. 

 

Thanks

This worked when there is single user / account / contact. but fails when there are multiple recipients.

There needs some minor changes to data while syncing from one environment to another there by couldn't use these features. .thanks Manish for suggestions

thanks JorgeFerr for suggestions

GaneshT
Frequent Visitor

Finally did this with C# Plugin code. but still keen on getting solution for multiple recipients in To. 

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (67,129)