Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

Email list of pull requests to each record owner

  • 1.  Email list of pull requests to each record owner

    GOLD CONTRIBUTOR
    Posted Feb 18, 2019 03:38 PM
    I could use another brain to think about the order of events for this scenario.

    I have a custom entity called ABC. A contact can make a pull request for a record in ABC. In Dynamics, we create a connection between these two (Contact to ABC Record).

    Each ABC Record has an owner.

    I want to use a workflow (or series of workflows) to send an email to each owner the number of pull requests each of their ABC records has received in a time period (ex. previous month).

    I am able to use Kaskela's Workflow Elements, Ultimate Workflow Tookit (UWT), and msdyncrmWorkflowTools to accomplish this.

    Here is what I am able to discern so far:

    1. Get a list of record owners
    2. For each owner, get a list of ABC records.
    3. For each ABC record, county how many requests.
    4. For each owner, create and send an email with the ABC records and the counts.

    Now, I'm just trying to figure out how I can get the workflows to accomplish this.

    ------------------------------
    Adam Posegate
    Fox Valley Technical College
    Appleton WI
    ------------------------------


  • 2.  RE: Email list of pull requests to each record owner

    GOLD CONTRIBUTOR
    Posted Feb 18, 2019 04:41 PM
    If Microsoft Flow is an option for you - I would suggest that.  We use Azure Logic Apps (Microsoft Flow in azure) to do this sort of work and we can query our replica database to pull the necessary records.

    Flow is a little lighter but works well with dynamics.  I started a new flow with recurrence once a day.
    https://us.flow.microsoft.com/en-us/
    You can then nest your for each loops inside that.  Flow can be clunky and you may have to learn some development techniques to provide the correct filters.

    A couple standards that I put in place with Flow.
    1. I share the flow with a CRM administrative team.  This allows everyone on the team to have access to it.
    2. I make the dynamics connections a service account
    3. On flows that run once a day, I have a final step of making a post (to Yammer or Teams or possibly even an email) that will have a link back to the flow.  This makes it easier for people to know exactly what is firing off the flow.

    ------------------------------
    Travis Judd
    CRM Developer
    Trek Bicycle Corporation
    WATERLOO WI
    ------------------------------



  • 3.  RE: Email list of pull requests to each record owner

    GOLD CONTRIBUTOR
    Posted Feb 18, 2019 05:01 PM
    Could you use a calculated field to count the number of pull requests for each ABC record? This could eliminate step 3 from your process and make it so all you need to do is find the ABC record for the record owners.

    Travis has a great idea with Microsoft Flow and that should work well, but you may want to try to cut down the number of nested loops, as that can get out of hand quickly.

    Is it possible to know how to query all ABC records without knowing the record owners? Or is the list of record owners the only thing you know how to generate a query for ahead of time?

    ------------------------------
    Nick Hance
    Reenhanced
    www.javascriptforcrm.com
    www.buildbettersoftware.com
    Green Lane PA
    ------------------------------



  • 4.  RE: Email list of pull requests to each record owner

    GOLD CONTRIBUTOR
    Posted Feb 18, 2019 05:05 PM
    Possibly - the pull requests are connections. Is it possible to calculate the connections of a certain type?

    ------------------------------
    Adam Posegate
    Fox Valley Technical College
    Appleton WI
    ------------------------------



  • 5.  RE: Email list of pull requests to each record owner

    GOLD CONTRIBUTOR
    Posted Feb 18, 2019 05:07 PM
    On second thought, this may be difficult. I hope to run this for requests received in a timeframe.

    ------------------------------
    Adam Posegate
    Fox Valley Technical College
    Appleton WI
    ------------------------------



  • 6.  RE: Email list of pull requests to each record owner

    GOLD CONTRIBUTOR
    Posted Feb 18, 2019 08:34 PM
    It could be done with a small script that will use the web api to make the queries and extract what you need for the emails






  • 7.  RE: Email list of pull requests to each record owner

    GOLD CONTRIBUTOR
    Posted Feb 19, 2019 09:06 AM
    That is an interesting idea. Is it possible to run a script via workflow, or would that require building a plugin?

    ------------------------------
    Adam Posegate
    Fox Valley Technical College
    Appleton WI
    ------------------------------



  • 8.  RE: Email list of pull requests to each record owner

    GOLD CONTRIBUTOR
    Posted Feb 19, 2019 09:20 AM
    It would require a plugin to be written

    ------------------------------
    Nick Hance
    Reenhanced
    www.javascriptforcrm.com
    www.buildbettersoftware.com
    Green Lane PA
    ------------------------------



  • 9.  RE: Email list of pull requests to each record owner

    GOLD CONTRIBUTOR
    Posted Feb 19, 2019 09:22 AM
    While a little more development heavy.  To avoid nested ifs in Flow, you could get the list with flow's Get Rows of a view on the replica.  The view would contain all relevant data.


    Flow's tooling is much better than Dynamics and I get the impression that Microsoft is focused more on upgrading Flow then Dynamics internal workflow system.

    I build these Flows quite a bit and they are pretty handy.

    ------------------------------
    Travis Judd
    CRM Developer
    Trek Bicycle Corporation
    WATERLOO WI
    ------------------------------



If you've found this thread useful, dive deeper into User Group community content by role