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

How Can I use Flow to send an email when account is about to reach it's renewl date in CRM?

Hi 

 

I want to create a flow such that the flow gets Renewl Date information from CRM Accounts and sends a generic email when an account is about to reach it's renewl date? 

renewl date.GIF

Is this possible?

 

Can I also attach an attachment with the email?

 

Any help will really be appreciated

 

Regards

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

@zahmed,

 

The default query number is set to 512 records by the list records Action, we could change it by clicking the Advanced options under Dynamics 365 List Records Action:

63.PNG

 

For the time, as Microsoft Flow uses UTC as the time zone, any time value that queried by Microsoft Flow would change to UTC zone. This should be the issue why the time is different with the date stored under Dynamics 365.

We could change this by using the Adddays function, delete the Apply to each and then add Compose 2 again by following the steps mentioned in my second post, this time, change its formula with the following:

"@Adddays(item()?['createdon'], 1,'dd/MM/yy')"

 

In addition, Microsoft Flow currenlty has some limits, please also make a note:

Limits and configuration in Microsoft Flow

 

The error should be OK, which means the value not satisfied would skip the send email action.

Regards

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @zahmed,

 

Well, I am not sure if the workflow under Dynamics CRM online would achieve this, for Microsoft Flow, I think this should be a proper way.

 

For hte change, apologize to say that currently the Compose formula is somehow hardcoded, and if you need to modify the formula, you may need to delete the Compose Action (Also the Actions following).

To avoid that, what I could suggest here is to design the flow in a more appropriate way.

Regards

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
v-micsh-msft
Community Support
Community Support

Hi @zahmed,

 

Could you please share some more details regarding the CRM data source?

Currently for Microsoft Flow, it only supports Dynamics 365 (CRM online ) connection.

Check the available connections below:

Available connection in Microsoft Flow

https://ms.flow.microsoft.com/en-us/services/

For the issue you mentioned, I could think out the following way:

1. Add a Schedule trigger, set to daily,

2. Add Dynamics 365 Get Records Action, specify the corresponding organization and entity,

3. Add a Compose Action, under the Input, copy and paste the following:

"@Adddays(utcnow(), 5, 'dd/MM/yy')" 

Format shoud be the same as the Renewal date Attribute.

4. Add an Apply to each, choose the Value as the Input,

5. Add a condition, specify the Renewal Date attribute, method choose "equals to", the other input box, choose the outputs of the Compose

6. Under the Yes part, add the Send an Email Action, use the Email Dynamic content as the Email Address, specify the Subject and Body, then save it.

(I don't have the renewal date attributes to test with, use the created on instead) See, screenshots:

44.PNG

 

For Attachments, yes the Send an Email Action should be able to hol the attachments, please click the advanced options under the Send an Email action:

45.PNG

Reply back if you need any further assistance on this.

Regards

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-micsh-msft

 

Thank you for your reply, 

 

 

I am using CRM Online(dynamics365). I have created a flow as you mentioned, but it doesn't seem to do the job.

 

flow2.png 

 

For Point 2 you said to add a "Get Record"  action but the screenshot you attached had "List Record" action. even if I use Get Record action it does ask me for Item Identifier, what would that be?

 

item identifier.GIF

 

 

Here is the complete process of how flow worked.

 

flowrun1.GIFflowrun2.GIF

 

 

Now I do want to say that I have an account which has it's renewal date set to 18/03/2017 which is the Output at step 3

 

renewl date.GIF

 

Also, Attachments are invoices which are genereated by external application called Xero. can something be done to get that attachment?

 

 

I hope you can help me acheive my target. 

 

Regards,

Zeeshan

Hi @zahmed,

 

Thanks for the update.

Sorry for the Get records part, I should make it clear, please just refer to the List records Action.

Get Record Action would require the corresponding Record ID to get the proper single record.

For the Condition part, we should format the date with the same format, please refer to the steps below:

1. After add the Compose Action, add another Compose Action, and Input the following:

"@formatdatetime(,'dd/MM/yy')"

2. Then add the Renewal Date (Created on column here) column as shown in the image below, which would add an apply to each automatically:

55.PNG

3. After the Apply to each added, we need replace the Second compose Inputs with the formula below:

"@formatdatetime(item()?['RenewalDate'],'yyyyMMdd')"

If not working, save this flow first, and copy the highlighted part to replace the Renewal Date (Dynamic content):

56.PNG

After that, add the condition, use Compose 2 Outputs as the Object name, and outputs from Compose 1 as the value.

This way should make it work.

If any further help needed, please post back.

Regards

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-micsh-msft

 

I really appreciate you taking time out to help me with this. 

 

I was a bit confused wheter I should also be changing Compose 1 or not? and your asking me to create compose 2 and then change it's formula again? 

this is what I have setup in my flow from what I understood from your previous reply

 

 

 

output flow.png

 

My flow runs but the condition is not met therefore email is not sent. the Output from compose 2 does not seem to look correct?

 

flow output.png

Where am I going wrong? 

Can you help please. 

 

 

@zahmed,

 

There is no need to change the Compose 1.

Just follow the steps in my second posts after the Compose 1 action.

The Compose 2 action would need the double quotes, if not specified, it would just return the string inputted.

See the screenshot for the correct format that would be saved successfully:

62.PNG

Reply back if you need any further assistance.

Regards

 

 

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-micsh-msft

 

Thank you so much for your reply. 

 

I think I am getting somewhere with your help. 

 

This is how my compose2 looks now.

compose2.GIF

 

the flow fails partially because it runs 512 times? I am not sure why is it running 512 times? is it trying to match 512 values of accounts to renewal date? 

At run 19 the output value of compose 2 matches the output value of compose 1, therefore the flow continues and sends an email. But for the same account the renewal date is set to 21/03/2017 in CRM but the output from compose 2 is 20/03/2017. it's like the output from compose 2 has one day difference from renewal date off account in CRM. would you know why?

 

complete flow.png

 

and I am not sure why it's not looking into all accounts? because I have nearly 2500 accounts in CRM and it looks like it's only going through 512 accounts? 

 

any help or suggestion will be helpful

 

Regards,

Zeeshan

 

 

@zahmed,

 

The default query number is set to 512 records by the list records Action, we could change it by clicking the Advanced options under Dynamics 365 List Records Action:

63.PNG

 

For the time, as Microsoft Flow uses UTC as the time zone, any time value that queried by Microsoft Flow would change to UTC zone. This should be the issue why the time is different with the date stored under Dynamics 365.

We could change this by using the Adddays function, delete the Apply to each and then add Compose 2 again by following the steps mentioned in my second post, this time, change its formula with the following:

"@Adddays(item()?['createdon'], 1,'dd/MM/yy')"

 

In addition, Microsoft Flow currenlty has some limits, please also make a note:

Limits and configuration in Microsoft Flow

 

The error should be OK, which means the value not satisfied would skip the send email action.

Regards

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-micsh-msft,

 

I am really thankful to you for taking time out and replying me. 

 

seems like using "@Adddays(item()?['createdon'], 1,'dd/MM/yy')" has done the trick of showing the correct date.

 

I am just thinking if the procedure I have used is the right one to achieve my goal.

 

All I wanted to achieve was when an Account is about to reach it's Renewal date in CRM, a email is sent to the account holder to renew. 

 

I am not sure if the approach I have used is correct. can you suggest something else?

 

Also, let's say if I go ahead with this strategy how can I change the flow such that at the begining of month the flow runs and sends email to each every account that is due in 30 days. 

 

Any help would really be appreciated.

 

Regards,

Zeeshan

Hi @zahmed,

 

Well, I am not sure if the workflow under Dynamics CRM online would achieve this, for Microsoft Flow, I think this should be a proper way.

 

For hte change, apologize to say that currently the Compose formula is somehow hardcoded, and if you need to modify the formula, you may need to delete the Compose Action (Also the Actions following).

To avoid that, what I could suggest here is to design the flow in a more appropriate way.

Regards

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (778)