Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Suggested answer

Flows - Power Automate

Posted on by 33
Here is the scenario:
Custom Entity called /Regulatory Cases/. - These are Cases that are auto created when an email is sent to a specific email. It is a request for regulatory documents from a customer.
Custom Entity called /Case Products/ - This a a /junction/ between the Regulatory Case entity and the Product entity. It allows a regulatory person to connect multiple products to a single Regulatory Case.
Looks like this:
 
//
 
//
 
 
 
 
 
 
 
 
 
 
 
I need to create a Flow that /Counts/ the number of Case Products on a Regulatory Case.
 
Has anyone done a Flow like this, and if so, can you share what the Flow looks like?
 
Thank you
  • Shawn Low Profile Picture
    Shawn Low 33 on at
    Flows - Power Automate
    Hi Leah,
     
    I built the Flow following your guidelines, and I received this error message so I must have done something wrong
     
    Exception parsing aze_regulatorycase_value ne null submitted for attribute filterexpression of callback registration. Target entity: aze_caseproducts. Exception: Microsoft.OData.ODataException: Could not find a property named 'aze_regulatorycase_value' on type 'CallbackRegistration.aze_caseproducts'.
       at Microsoft.OData.UriParser.EndPathBinder.GeneratePropertyAccessQueryForOpenType(EndPathToken endPathToken, SingleValueNode parentNode)
       at Microsoft.OData.UriParser.EndPathBinder.BindEndPath(EndPathToken endPathToken)
       at Microsoft.OData.UriParser.MetadataBinder.Bind(QueryToken token)
       at Microsoft.OData.UriParser.BinaryOperatorBinder.GetOperandFromToken(BinaryOperatorKind operatorKind, QueryToken queryToken)
       at Microsoft.OData.UriParser.BinaryOperatorBinder.BindBinaryOperator(BinaryOperatorToken binaryOperatorToken)
       at Microsoft.OData.UriParser.MetadataBinder.Bind(QueryToken token)
       at Microsoft.OData.UriParser.FilterBinder.BindFilter(QueryToken filter)
       at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseFilter()
       at System.Web.OData.Query.FilterQueryOption.get_FilterClause()
       at Microsoft.Crm.ObjectModel.EdmModelEvaluator.EvaluateFilterExpression(String filterExpression, ODataQueryOptions queryOptions)
       at Microsoft.Crm.ObjectModel.EdmModelEvaluator.EvaluateFilterExpression(String filterExpression)
       at Microsoft.Crm.ObjectModel.CallbackRegistrationService.<>c.<.cctor>b__79_0(EdmModelEvaluator evaluator, String testValue)
       at Microsoft.Crm.ObjectModel.CallbackRegistrationService.ValidateInputEntity(IBusinessEntity entity, ExecutionContext context, IFeatureDetailContainer featureDetailContainer)
     
    The Flow looks perfect, so I am hoping you might be able to help clear this.
    I was testing the Flow on a Case (Regulatory Case), and I added a Case Product to a Regulatory Case.
     
    Any idea where I went wrong?
     
    Thank you,
    Shawn 
  • Suggested answer
    Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    Flows - Power Automate
    Hi,
    Please refer to the following steps:
    1.Trigger:
    --when the Case Product is created or 'Regulatory Case' column is updated.
    (cre80_regulatorycase is the logic name of the 'Regulatory Case' column)

    2.Get related 'Regulatory Case' based on this lookup column:
    3.List rows:
    4. Count the Case Products from list rows
    5.Update a row:
    Result:
  • Shawn Low Profile Picture
    Shawn Low 33 on at
    Flows - Power Automate
    Leah Ju,
     
    Thank you for the reply. I am new to D365 and not very experienced with it so I have to apologize for not getting this.
     
    So the process works like this:
    1. Regulatory Case is created.
    2. CS assigns the Case to themselves and starts to work on it.
    3. They add what call a "Case Product" to the Regulatory Case (so the CP is a 'related' record, to the RC)
     
     
    When they click the "Case Products" (Red Box) they get this screen. They add a New Case Product by clicking the "+ New Case Product" button (Red Arrow)
     
    This Opens a Quick Create form where they search for the Product they want to add.
     
     
    The Case Products are listed like this:
     
     
    On the Case Product Entity, there are two (2) N:1 Relationships. There is no N:N or 1:N Relationships
    1 to the Products Entity
    1 to the Regulatory Case
     
     
     
    Do I trigger the Flow to run on the Regulatory Case when it is modified (when a Case Product is added to the RC) or on the Case Product (when the Case Product is created)?
     
    What is the 'flow' of the Flow?
     
    1. Trigger the Flow on which Entity? (I think it should be triggered when the RC is modified (a Case Product is added, but I have no clue how to set up the filters since there is no field on the RC entity to trigger off of).
    2. Get the record that triggered the Flow (The RC)
    3. Count the Case Products related to this RC (use a List Row action, but again, not sure how to set the fields in the action)
    4. Update a field on the RC called "Case Products Added". (use an Update Row action to update the field with the output from the List Row action).
     
    Am I even close?
    Thank you
  • Flows - Power Automate
    Photos     do    not load sehackear.com

     
  • Suggested answer
    Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    Flows - Power Automate
    Hi.
    Is there a relationship between 'Regulatory Cases' and 'Case Products'?
    --1: N? 1 'Regulatory Cases' record has multiple related 'Case Products' records.
    If so:
    You're trying to get the related child records from the parent record in power automate.
    Using List rows action.
    1)Filter format
    _lookulogicname_value eq 'Regulatory Cases' guid
    2)Get the number of returned records:
    --length(outputs('List_rows')?['body/value'])

    I hope you can mark my answer verified if it answer your question! If you have any questions, please feel free to contact me.
    Regards,
    Leah

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,584 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,864 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans