microsoft / coe-starter-kit

Other
751 stars 223 forks source link

[CoE Starter Kit] Configurable text for emails #1420

Closed manuelap-msft closed 2 years ago

manuelap-msft commented 3 years ago

Currently users have to edit flows to make the email and adaptive card text their own which leads to unmanaged layers and update issues, it also is difficult to review the email text or even know which flow sends what.

Jenefer-Monroe commented 3 years ago

Current thinking is to have the starter data filled similar to how we fill data in IB, with a flow. It can be a recurrent flow and only update the text if its currently empty. This would allow us to add new records / rows over time as emails change.

Jenefer-Monroe commented 3 years ago

Q: Should we have one table per solution so that we dont add dependencies back to Core from things like IB that dont currently have dependencies on Core?

HamishSheild commented 3 years ago

This would be awesome!

I've done something similar for a client recently (nothing to do with COE) using a custom table for email/letter templates. It works well.

Inserting dynamic data is a pain with Power Automate as you end up with a huge set of nested Replace statements. Quite nasty. I am interested to see how you would handle this.

Happy to help out and share learnings if your are interested.

modery commented 3 years ago

We've just had this done for us as part of a bigger CoE setup engagement, and it works as you described it. Think it would definitely be worthwhile to introduce this generally.

bigpix2000 commented 3 years ago

Hi @Jenefer-Monroe !

The Tables should be tied to the solutions and one should be fine even if the choice for use is in Teams. The bigger issue will be the format of the content and then how to potentially do Multiple Languages. So many ways to do this whether the content is in the table itself OR the table has a pointer to the content (in a list) OR even the "doc" in dataverse. Did you have a plan here already or are you looking for that?

Jenefer-Monroe commented 3 years ago

Here is my current plan of action:

Column Descriptions

Example row in the table image

Jenefer-Monroe commented 3 years ago

For variables, we are just going to have that embedded in the text as shown here from the example above.

 <li><a href="@{parameters('Community URL')}">Our Power Platform Community</a></li>

This allows the flow to remain simple, and just re-uses the products concept of dynamic data embedded in the text.

andrewgaskins commented 3 years ago

Yes this would be a big deal. I was just updating our Compliance Detail flow and thinking about managing those layers on updates. It would also be nice to have a chance to decide if you want this to be an email or post a card for the user in Teams.

Jenefer-Monroe commented 3 years ago

As a stretch goal, I am considering having all the emails sent to a helper flow which will send the email. It could then be augmented to be teams in a single location. But I am not certain if we can do that as part of this ask. If not, you can add it as a separate ask once we release.

andrewgaskins commented 3 years ago

@Jenefer-Monroe I was thinking the same thing when updating the emails about the helper flow. Looking forward to seeing what you do.

Jenefer-Monroe commented 3 years ago

Considering also adding a Sent-On-Behalf of column. Though would need to make it clear how to configure this to folks so its not a big ticket generator. Would this be of interest for folks?

bigpix2000 commented 3 years ago

So far so good on the plan. Everything making sense so far. A couple of observations:

Jenefer-Monroe commented 3 years ago

Unfortunately the technique for variables described above does not seem to work.

As an example, this stored in a multi-line text field in Dataverse:

Some of the Sync Flows in the CoE Starter Kit have failed. See below and navigate to the Flow Instance URL to find out more details: @{outputs('Compose_HTML_Table')}

Then pulled in to body of the email does not evaluate the variable into the html table, it just writes out as text image

If anyone here knows how to force Power Automate to evaluate variable again, please let me know. I have a few things to try yet, otherwise I'll just restructure all the emails to have the variables present at the end.

bigpix2000 commented 3 years ago

This appears to be the case of the Flow evaluating the variable before it is even ready and you are trying to "ignore" things until there is a value (or a true error) yes? Confirming that the source of the data is dataverse or a passed in parameter or environment variable or something else?

Jenefer-Monroe commented 3 years ago

Correct, the data is stored in Dataverse and passed in to flow through the Dataverse connector. I think you are also correct that this it is flow itself doing the evaluation early, as I have tried multiple actions/connectors to try and get around this. I find no settings to change when this occurs. It also will not treat html tags correctly, just places them in as strings.

bigpix2000 commented 3 years ago

Ah ha! so another thought. It is email after all (cough cough "outlook") .... Last I saw a flow have to to Rich text manipulation (and I was so hoping that HTML tags worked) had them calling Word and doing the "automation" there and then sending the body in the email. Trying to find the sample but the idea came up awhile back because at least back in 2019 or so it was definitely not possible to use HTML strings in. Quick question is even if it is a "string" for the body, is there not an option for the mail connector for Rich text?

hernan-ramirez commented 3 years ago

Hi everyone! Jenefer, would it be possible to use Word Templates with properties to generate the text content? And then we can use the Document Converter to get both, HTML or Markdown? I know that we would have to have a document library with the templates, and it would be a template by notification.

How do you see this idea?

In the table row, it would be the same as Jenefer described, but in the body value it would be the URL of the Word template. I really like that there is also a column for "Send as".

Regards!

Jenefer-Monroe commented 3 years ago

Hello, word templates would be a good idea to explore. Unfortunately they are not ISV friendly.

In other words, we cannot rely on any of the office actions (Excel, Word, ...) in the toolkit as when you import them into your own tenant, you have to redo the actions, which in the case here would be substantial work each month.

Thanks for helping think outside the box!

bigpix2000 commented 3 years ago

It makes sense ... I explained exactly this as to why it was GitHub and Not ADO out of the box for the ALM Piece and also why Excel Reporting was left to the Power BI OOB experience. We don't want to create a custom API that needs Azure for example although on the edge there as we rely on tools like AAD for registrations etc. Logic apps are pay as you go and add an extra burden to the concept of the starter kit which is to be "free" at least for the first 30 days ... hmmmm. Unless we say just like you can get a trial for Power apps you can get one so you can do a Logic app? hmmmmmm .... Just a thought.

So the clue feels like it is in how anyone would use Power Automate to send a Rich Text email at all ... Test that and at least we have something that might be modifiable ?

bigpix2000 commented 3 years ago

The case of if we can format it it via a variable that is ... we know there is formatting because we see it now ... right?

hernan-ramirez commented 3 years ago

I have had the experience of working with word templates and ALM and it was not too hard. The templates are distributed as the CoE Started Kit does with the Dashboard in Power BI. The word template activities can be completed with environment variables to fill the site and library, and then the file name is the column "URL body" of the table designed for Dataverse. There is no need to redo the flows in that case.

However, if we have the original idea of using the text value of a column and record without token to replace, and then we put the dynamic contents at the end concatenated, it would be perfect for the first version!!

hernan-ramirez commented 3 years ago

mmm... "tokens to replace" ?? If the value of body field in dataverse is: "My message [[MyVariableToReplace]] and more message" and replace [[MyVariableToReplace]] with my dynamic conten by automate expression ??

Jenefer-Monroe commented 3 years ago

I don't think we can scale to having custom code at each mail to fill in the variables. If we cannot get the product to interpret them as is, brought in, then I think we will need to just have the variables at the end of each mail.

For now, I am going to go forward with this plan (variables at the end) and cross my fingers that we don't run in to more issues.

If anyone here has a sample solution I can use to test word templates working across tenants, please share. As we have an awesome solution for the CoE we never shipped as we couldn't get this to work

Thanks for the feedback!

bigpix2000 commented 3 years ago

time to hunt for that, team! checking the MVP's and the sample repositories to see if there is anything sitting in plain site ... probably need to dig a bit since that very specific action is not in the title of the sample.

Jenefer-Monroe commented 2 years ago

local fixed for Dec. Finishing testing. Dec will have only the cloud flows in Core complete. And in future months, with feedback, we will extend into Gov and Nurture

bigpix2000 commented 2 years ago

Good start .... anticipating documentation or guidance updates to coincide or should we keep note until then?

Jenefer-Monroe commented 2 years ago

Yes the how-to for this will be in the documentation when we release Dec!

mikefactorial commented 2 years ago

@manuelap-msft This has been fixed in the latest release. Please install the latest version of the toolkit following the instructions for installing updates. Note that if you do not remove the unmanaged layers as described there you will not receive updates from us.