Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Answered

How to set account status (Active or inactive) based on number of invoices in a set period of time?

Posted on by 155

Hi,

I want to be able to segregate my accounts based on their activity. If an active account has less than 5 invoices in 6 months, I want its status to change to Inactive. Check should happen every month.

Thank you!

Patrick 

  • Patrick Mandengue Profile Picture
    Patrick Mandengue 155 on at
    RE: How to set account status (Active or inactive) based on number of invoices in a set period of time?

    This is the error message:   ')' or operator expected at position 13 in '( customerid value eq 8edd6738-d8c9-eb11-bacc-000d3a231383 and Microsoft.Dynamics.CRM.LastXMonths(PropertyName='createdon',PropertyValue=6))'.

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: How to set account status (Active or inactive) based on number of invoices in a set period of time?

    Hi,

    Can you please share list rows filter rows property value ?

    I think you are missing paranthesis or you are having extra paranthesis.

    _customerid_value try this.

    You can use Fetch XML builder in xrmtoolbox to generate the query.

    Thanks,

    Bipin

  • Patrick Mandengue Profile Picture
    Patrick Mandengue 155 on at
    RE: How to set account status (Active or inactive) based on number of invoices in a set period of time?

    I still a weird error message. Please can you help?

    pastedimage1649857520913v1.png

  • Verified answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 7,777 Super User 2024 Season 1 on at
    RE: How to set account status (Active or inactive) based on number of invoices in a set period of time?

    Hello Patrick,

    You can use the Pagination where u can override the default fetch record count. Please refer article to update the pagination.

    powerusers.microsoft.com/.../1258148

    Thank you,

    Amit katariya

  • Patrick Mandengue Profile Picture
    Patrick Mandengue 155 on at
    RE: How to set account status (Active or inactive) based on number of invoices in a set period of time?

    Error-Message.png

    Please can you help here. where can I find the settings to configure the buffer please. I have more than 10,000 lines in my Account table to run everyday to check the status based on their activity.

    Thanks.

    Patrick 

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: How to set account status (Active or inactive) based on number of invoices in a set period of time?

    HI,

    Please see below the expression I used to check count of records -

    length(body('List_rows_2')?['value'])

    List_rows_2 -> My List Row action name so if you are renaming this to something else then you will need to update the formula as well.

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • Patrick Mandengue Profile Picture
    Patrick Mandengue 155 on at
    RE: How to set account status (Active or inactive) based on number of invoices in a set period of time?

    Thank again! I am still working on it and I would like ot know what is the actual full expression in the last condition: Fx Length(....)?

    length ('Value') from previous output?

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: How to set account status (Active or inactive) based on number of invoices in a set period of time?

    Hi,

    You can create Schedule flow to run every month.

    docs.microsoft.com/.../run-scheduled-tasks

    then use List rows to fetch active accounts. Loop through each account and fetch related invoices created in last 6 months using fetch xml which are associated to account

    - then check count of invoices by using conditions

    - If count<5 deactivate account else do nothing

    CR36.PNG

    CR37.PNGCR38.PNG

    CR39.PNGCR40.PNG

    Condition -> 

    length(body('List_rows_2')?['value'])

    Get Count of List rows - 

    https://d365demystified.com/2020/05/20/get-count-of-records-retrieved-in-cds-connector-in-a-flow-power-automate/

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,902 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,302 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans