Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Reports/ Email / Opportunity /pdf in dynamics 365

Posted on by 1,075

Hello Community Experts,

I'm looking for a way where i can list out all the open and lost opportunities and e-mail it automatically to the manager on a weekly basis.

One idea which i have is reports, but i dont know how to automatically mail it

Another can be a word or pdf Document, i again dont know how to automate it.

Kindly guide,

Best Regards,

Sumaira Noor

  • Sumaira Noor Profile Picture
    Sumaira Noor 1,075 on at
    RE: Reports/ Email / Opportunity /pdf in dynamics 365

    Thanks Clofly

    It worked

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: Reports/ Email / Opportunity /pdf in dynamics 365

    Hi Sumaira,

    Could you share me your action property screenshot?

    1. Make sure that the Action is Compose.

    2. In Compose action, we do a check for HTML body name likes below:

    pastedimage1576825437163v2.png

    click Peek code to view HTML table name:

    It's called @body('Create_HTML_table') in my environment

    pastedimage1576825482115v3.png

    3. This point could be mostly reason, it seems that you copy my expression directly from my response?

    I found that I also got invalid error when I copy it from my answer directly, it could be reply text editor issue.

    As you see, double quotes have been converted to single quotation by text editor.

    Upper is my original expression, lower is the converted text in my answer.

    pastedimage1576826011207v4.png

    So please copy this to test again or input manually:

    replace(body('Create_HTML_table'),'','
    ')

    Regards,

    Clofly

  • Sumaira Noor Profile Picture
    Sumaira Noor 1,075 on at
    RE: Reports/ Email / Opportunity /pdf in dynamics 365

    Thanks for the response Clofly and ba365guy

    I tried both of your approach but didnt work

    Clofly,in your approach, I'm getting this error when i try to add replace expression "The expression is invalid".

    Best Regards,

    Sumaira Noor

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: Reports/ Email / Opportunity /pdf in dynamics 365

    Hi Sumaira,

    As per my understanding, would you like to make table bordered?

    Actually our result is structured as a HTML table with HTML table tags, however, due to some customization is lack, so border not display.

    We can do following customization to show output with tabular format we're familiar with.

    1. Overall view.

    (I create an instant flow to test)

    pastedimage1576821943171v1.png

    2. Insert Compose action after Create HTML table action,

    the action can let us add customization for HTML table output  from last action.

    We use Replace function to replace original table tag with table which has border attribute:

    please copy this expression directly to Inputs field:

    replace(body('Create_HTML_table'),'<table>','<table border="1" style='border-collapse:collapse'>')

    finally remember to change email content to outfut from Compose action.

    pastedimage1576822138065v2.png 

    3. Result:

    pastedimage1576822242823v3.png

    Regards,

    Clofly

  • Suggested answer
    ba365guy Profile Picture
    ba365guy 2,946 on at
    RE: Reports/ Email / Opportunity /pdf in dynamics 365

    After creating HTML Table and before sending email, add a step to "Compose"

    Add the following CSS to the compose action

    and the send the email.

    It should look something like this.

    pastedimage1576821910376v1.png

    The generated table will look in the below format (just a sample format. column names will be based on your column names)

    pastedimage1576821966735v2.png

    If you want to change the colors, change the css accordingly.

  • Sumaira Noor Profile Picture
    Sumaira Noor 1,075 on at
    RE: Reports/ Email / Opportunity /pdf in dynamics 365

    Thanks for the help Clofly.

    Its working fine now

    I have another doubt, i want the output to have tabular format

    How to get that format

    Best Regards,

    Sumaira Noor

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: Reports/ Email / Opportunity /pdf in dynamics 365

    Hi Sumaira,

    Let's build a simplified flow to send won and closed opportunity records to specific mailboxes.

    1. Overall look:

    pastedimage1576756297081v1.png

    2. In second action, our filter should be statecode eq 1 or statecode eq 2,

    1 stands for won, 2 stands for lost, while in your screenshot, that's statecode eq 1 or statecode eq 2 or statecode eq 3,

    it'll retrieve all opportunities in fact without filter.

    you can find code definition in opportunity entity introduction:

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/web-api/opportunity?view=dynamics-ce-odata-9

    pastedimage1576756458559v3.png

    pastedimage1576756330554v2.png

    3. I found that we don't need to create an array to append records

    the third action: Create HTML Table will helps us to complete retrieved result iteration automatically.

    pastedimage1576756760090v4.png

    4. We just need to populate To field likes below:

    aa@outlook.com;bb@outlook.com;cc@outlook.com

    with semicolon to separate different mailbox.

    Recipients will become different separate bubbles after we save the flow and check again.

    pastedimage1576756907245v5.png

    5. Run test

    pastedimage1576757020077v7.png

    6. Result:

    pastedimage1576756976732v6.png

    Then you can replace the first action to recurrence schedule action.

    In addition, I met exception in my environment while trying to convert file to pdf by One drive convert file action with ba365guy's link,

    even though I had created file successfully, you could test whether it could work in your environment once you receive email with table.

    Regards,

    Clofly

  • Sumaira Noor Profile Picture
    Sumaira Noor 1,075 on at
    RE: Reports/ Email / Opportunity /pdf in dynamics 365

    Thanks for the response Clofly

    I should automate where mail should be sent every saturday to only 3 users, not all the users.

    I'm attaching the screenshots below, please correct me.

    Image1.PNG

    Image2.PNG

    Image3.PNG

    Image4.PNG

    Image5.PNG

    Image6.PNG

    Image7.PNG

    Kindly Guide,

    Best Regards,

    Sumaira Noor

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: Reports/ Email / Opportunity /pdf in dynamics 365

    Hi Sumaira,

    You could set Manually trigger a flow as start action for instant test.

    pastedimage1576750082585v1.png

    As per my understanding, do you want to send emails to all users in CRM?

    If so, please list all user entity records and use Primay email from dynamic content.

    Regards,

    Clofly

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: Reports/ Email / Opportunity /pdf in dynamics 365

    Hi Sumaira,

    1. For your occurency email issue, 

    please remove array variable, I just found that we won't need array to save data, so apply for each might be the reason for many emails sending.

    (as the blog tutorial by ba365guy configured)

    pastedimage1576749836117v1.png

    2. For your filter and no dynamic content is available issue:

    Have you applied filter as below, and once necessary fields are populated with value,

    then dynamic contents will appear in next tile/action.

    pastedimage1576749946435v2.png

    Regards,

    Clofly

  • 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

    December Spotlight Star - Muhammad Affan

    Congratulations to a top community star!

    Top 10 leaders for November!

    Congratulations to our November super stars!

    Tips for Writing Effective Suggested Answers

    Best practices for providing successful forum answers ✍️

    Leaderboard

    #1
    André Arnaud de Calavon Profile Picture

    André Arnaud de Cal... 291,280 Super User 2024 Season 2

    #2
    Martin Dráb Profile Picture

    Martin Dráb 230,214 Most Valuable Professional

    #3
    nmaenpaa Profile Picture

    nmaenpaa 101,156

    Leaderboard

    Product updates

    Dynamics 365 release plans