I second
@Jamie Hirst's suggestion.
Kaskela's element's query is a must have functionality.
Building on that, you can have the workflow include a delay to then wait 24 hrs and restart itself, so it runs more or less every day. It is worth noting this won't work for workflows that restart themselves frequently as there are system limits to prevent infinite loops, but for anything that needs to run less than once an hour, and isn't problematic if it shfts by a minute or two each day, this works.
If you need something more precise (IE run at a certain set time every day), you'd need to include a scheduling entity that contains a list of workflows to run, when to run them, and then uses Kaskelas workflow to start them. This was the 2nd iteration we eventually went to, but the above may meet your needs.
------------------------------
Ryan Perry
Business Systems Analyst
Auric Solar
------------------------------
Original Message:
Sent: Apr 29, 2019 01:46 PM
From: Jamie Hirst
Subject: Workflow to do something based on count of records by user and date range?
Hi Julie
There are a couple of issues here
- I don't believe workflows can be triggered on the update of a rollup or calculated field, so you will not be able to trigger your workflow that way
- You could trigger the workflow on create of the child record, which then checks the value of the roll up field. However, as the rollup field is only calculated periodically, it will not have the correct number, unless you use a custom workflow step which forces the recalculation
SO how do you do it?
Workflow elements by Kaskela are a free tool which provide extra workflow steps to extend the options available to you in a workflow. This will help with this issue.
- Install Workflow Elements
- Create a view for the entity in question, using one of the options below(you will need to test which works best). Remove all but one columns from the view.
- Create a workflow which is triggered on create of custom entity you are interested in
- First step, Kaskela Workflow element>Query -Get results.
- Pass in the query you created in step 2 (either as a query or fetxh xml)
- Add check condition, is GetResults #records > 30?
- If true create your email
- Else stop
Hope this helps
------------------------------
Jamie Hirst
Dynamics Specialist
Hirst Dynamics
Stockport
Original Message:
Sent: Apr 29, 2019 10:43 AM
From: Julia Streatfield
Subject: Workflow to do something based on count of records by user and date range?
Good afternoon everyone
We need to be able to have a notification sent out when any user reaches a count of x number of records created in last y days. I've got a workflow that creates records in a custom entity, which is simply Createdon and User, but each time need to say CHECK if count of records for this user where date is in last 30 days, send email to someone.
I just can't work it out.
If anyone out there can point me in the right direction it would be much appreciated. Even if the direction is 'give up now'.
Many thanks
Jules
------------------------------
Julia Streatfield
CRM Business Intelligence Manager
CBI
London
------------------------------