Hello Community,
I have the following client requirement I am struggling to solve, and would appreciate some guidance.
At a high level, we have an entity in Dynamics 365, and the user will be filling the form via the Power Apps Portal, and the requirement is to verify a set of 70 fields on the record against the respective field validation rule, only after the record is submitted. I don't need to trigger this check everytime one of the 70 fields gets updated. I only need to trigger this check when the status of the record is updated to Submitted.
I am thinking to use Power Automate for this solution. I am not a developer that writes codes, so hoping to stay away from custom codes (i.e. Azure Functions, etc.).
So, when the Flow is triggered, I need to check the value of a "Code" field on the record (there are 4 different codes: C, R, S, T). For each code, the validation min/max value range for the 70 fields is different. So if the code = C, I need to check the 70 fields on the record against the rules, and if the code = R, I need to check the 70 fields on the record against another set of different rules, and so on. The validation is basically to check if the value entered in the field is within the min/max value range defined in the validation rule for that particular field. Again, depending on the "code", the min/max value range varies for each of the 70 fields. So in total we have 284 combinations.
Also, the requirement says if a field fails the check, I need to update a multi-line text field on the record with some log message, and the message is unique for each field that fails the check. Also, if any of the fields fails the check, I need to flag a checkbox field on the record. The whole idea is that after this Flow is done processing, the user in Dynamics can easily go to the dashboard to review any records having the checkbox field flagged as having a problem so the user can review the record, and the user can look at the multi-line text log field on the record to know which of the 70 fields to examine the data. That's what we are trying to achieve for the client.
I could build out this big Flow logics using one Condition check action for each of the field, but I will end up needing to have 284 such Condition checks, because if each one fails, I need to update the multi-line log field, so I need individual Condition checks. But this would be massive, very time consuming to build. Also, the client would like to be able to easily update the rules in the future, so it's not good to define the rules inside the Flow.
So, I was thinking to create a custom entity in Dynamics 365 to store the rules. So I will have 284 records under this custom entity, each one representing a rule for each field (4 codes x 70 fields = 284 rules).
I can use the "List Records" action in the Flow to fetch the 284 rules, but I am having problems coming up with the logics to dynamically pass the record I am checking in the Flow against the unique one rule from the list of 284. Ideally, I like to be able to use some kind of looping where the Flow would understand and be smart enough to examine the 70 fields from the records against the respective 70 rules from my custom entity list, based on what the Code is.
Does anyone have any insights on how I could achieve this in a more dynamic efficient manner? If there are better solutions to do this without using Power Automate I would be interested to know as well - again I am hoping for a solution that does not require custom codes. Sorry for the long description, but I hope this helps explain the requirement I am trying to solve.
Thank you!
Hi Leo,
Thanks for the reply! However, I am afraid that's not the main question/challenge I am facing. In my post above, I am having problem defining in the Flow I could do the validation checking. If I may recapture my current situation as follows:
I have created a custom entity in in Dynamics 365 to store the validation rules. I will have 284 records under this custom entity, each one representing a rule for each field on the main entity I am checking, based on a code category. (4 codes x 70 fields = 284 rules).
In Power Automate Flow, I can use the "List Records" action in the Flow to fetch the 284 rules, but I am having problems coming up with the logics in the Flow to dynamically pass the fields from the main record I am checking in the Flow against the unique one rule from the list of 284 rules. Ideally, I like to be able to use some kind of looping where the Flow would understand and be smart enough to examine the 70 fields from the records against the respective 70 rules from my custom entity list, based on what the Code is. Otherwise, I will have to have 284 if statement in the Flow logics to go through all 284 rules for all the fields. That would be massive and very tedious, and I feel there has to be a better way to do this, but I am problems finding a better solution.
Thanks.
Hi Partner,
I suggest that we could create a custom entity to store the log records that logged which field and what kind of "Code" failed the check.
You could add a look up field on the log entity related to your main entity so that we could know the field name, the "Code" and the related entity record.
So the logic is that after the checking action in Flow when updating the record, if there is any failed checking, then create new log entity record with the field name, "Code" and the main record ID.
Regards,
Leo
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,524 Super User 2024 Season 2
Martin Dráb 228,469 Most Valuable Professional
nmaenpaa 101,148