cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NickDewitt
Advocate II
Advocate II

Get Account name from Opportunity for HtmlTable

I have a flow that gets Opportunities created in the last x days from Dynamics, and I want to send that out once per day as a single email listing all the new opportunities.

 

This has all gone rather easily until I wanted to list the Account name. I have used the Expand Query option to include the account, and I can see that the account is returned in the JSON when I test it, but I have no way to access the name of the account. I have tried manually putting in item()[parentaccountid/name] but that wouldn't work, even when I composed it in a different field and copied it into the HTML table field.

 

Why is this so hard to do, surely it's quite a simple requirement? Is there any way I can work around this, by for example using and apply to each, looking up the account and outputting a new object? Compose didn't seem to like outputting a JSON object, it just wanted to do an Array.. I'm a little stumped, any help would be greatly appreciated!

 

FlowSendEmail.png

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Alice, thanks for your reply.

 

I'm afraid I tried the Select inside an apply to each but it didn't seem to output the values as a list for use outside of the apply to each, and if i created an array variable outside the apply to each and appended it to that variable inside, then the field names i created were not available to the HTML table.

 

The only way I got it to work way by writing my own HTML in a compose during the apply to each and appending the value of the compose to an array variable, and joining that inside another compose to create the HTML table to go in my email.

 

Here is how i managed to achieve it:

FlowCreateEmailTable.png

 

 

View solution in original post

4 REPLIES 4
v-yuazh-msft
Community Support
Community Support

Hi @ NickDewitt,

 

 

Could you please explain more about your requirement?

Do you want to put a expression value in the "Create Html table" action?

 

If you would like to put a expression value in the "Create Html table" action,I afraid that there is no way to achieve your needs in Microsoft Flow currently.Putting a expression value in the "Create Html table" action is not supported in microsoft flow currently.

 

If you would like this feature to be added in Microsoft Flow, please submit an idea to Flow Ideas Forum:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

You could take a try to put a expression value in the "select" action,and then create a html table from the output of Select as an alternativy wayas screenshot below.

Capture.PNG

 

 

Please let me know if your problem could be solved.

 

 

Regards,
Alice Zhang

Hi Alice, thanks for your reply.

 

I'm afraid I tried the Select inside an apply to each but it didn't seem to output the values as a list for use outside of the apply to each, and if i created an array variable outside the apply to each and appended it to that variable inside, then the field names i created were not available to the HTML table.

 

The only way I got it to work way by writing my own HTML in a compose during the apply to each and appending the value of the compose to an array variable, and joining that inside another compose to create the HTML table to go in my email.

 

Here is how i managed to achieve it:

FlowCreateEmailTable.png

 

 

triston1000
Frequent Visitor

Hi,

 

I am trying to achieve the same as in this flow. I cannot get around the 'Apply to Each'

 

I have seen that the solution has been accepted, but i cannot see it when i open it fullscreen so i can use to help me.

 

Can i be sent or shown a closer, clearer copy of the flow?

 

Thanks

Triston.

Hi @triston1000,

 

Yeah sure, I have modularised it a bit since this post but I can share some of that with you:

 

I now have it wrapped inside a HTTP request so I can re-use it from different flows to build tables from different OData Opportunity queries:

 

 

image.png

 

I initialise an array variable here before going into the loop so I can hold the values from each row.

 

Inside the loop, I load all the related entities that I need for that row:image.png

 

 

Then I just use the standard "Compose" action to create some HTML as text and append it to the array variable I initialised earlier:image.png

This includes hyperlinks back to the Dynamics record, a hyperlink to a Power BI dashboard filtered to the Account in the row, and some in-line table styling (this is going out on an email).

 

Finally, I just join that all together with the outer table HTML and some heading rows, and return that HTML to the flow that called this flow:

image.png

 

Then I call that flow twice from a different flow that runs only on weekdays, using an OData query to return won or lost opportunities:

image.png

 image.png

 

 

 

Hope that helps! 🙂

 

 

 

 

 

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (1,576)