web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How Can I use Flow to ...
Power Automate
Answered

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

(0) ShareShare
ReportReport
Posted on by 28

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

 

 

Categories:
  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    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

     

  • Zeee Profile Picture
    28 on at

    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

  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    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

  • Zeee Profile Picture
    28 on at

    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. 

     

     

  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    @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

     

     

     

  • Zeee Profile Picture
    28 on at

    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

     

     

  • Verified answer
    v-micsh-msft Profile Picture
    Microsoft Employee on at

    @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

     

  • Zeee Profile Picture
    28 on at

    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

  • Verified answer
    v-micsh-msft Profile Picture
    Microsoft Employee on at

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 229 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 223 Super User 2026 Season 2

#3
Valantis Profile Picture

Valantis 136 Super User 2026 Season 2

Last 30 days Overall leaderboard