I have 2 flows for my Dynamics CRM. One that copies the total units from the Account entity to the Opportunity entity if updated and the other does vice versa. The idea being that both fields are consistently updated with the most recent unit count.
However, to prevent these 2 flows from creating an infinite update loop, I've tried to create a trigger filter based on the "modifiedby" lookup field used in both entities since all of our flows are built by a designated admin account "Business Development." The trigger filter, in theory, is simple: modifiedby does not equal "Business Development."
HOWEVER, I am consistently getting a message that my trigger is causing an error and it seems to be related to this trigger. I've run it through AI (both Copilot and ChatGPT) and tried just about every version suggested. Read articles and watched videos and I'm fairly certain my initial trigger expression was correct or at least not far off the mark: _modifiedby_value ne '1bcc059c-9f84-e411-8795-f0921c194364'
This is the error I get in Power Automate for this trigger filter:
Exception parsing _modifiedby_value ne '1bcc059c-9f84-e411-8795-f0921c194364'
submitted for attribute filterexpression of callback registration. Target entity: account. Exception: Microsoft.OData.ODataException: A binary operator with incompatible types was detected. Found operand types 'Edm.Guid' and 'Edm.String' for operator kind 'NotEqual'.
at Microsoft.OData.UriParser.BinaryOperatorBinder.PromoteOperandTypes(BinaryOperatorKind binaryOperatorKind, SingleValueNode& left, SingleValueNode& right, TypeFacetsPromotionRules facetsPromotionRules)
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 Microsoft.AspNet.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__81_0(EdmModelEvaluator evaluator, String testValue)
at Microsoft.Crm.ObjectModel.CallbackRegistrationService.ValidateInputEntity(IBusinessEntity entity, ExecutionContext context, IFeatureDetailContainer featureDetailContainer)
Here are some of the other versions I've tried, and gotten various errors on:
- modifiedby@OData.Community.Display.V1.FormattedValue ne 'Business Development'
- ModifiedBy/systemuserid ne 'Business Development'
- modifiedby/systemuserid ne '1bcc059c-9f84-e411-8795-f0921c194364'
- modifiedby eq guid'1bcc059c-9f84-e411-8795-f0921c194364'
- cast(_modifiedby_value as Edm.Guid) ne cast('1bcc059c-9f84-e411-8795-f0921c194364' as Edm.Guid)
- $expand=modifiedby($select=systemuserid)&$filter=_modifiedby_value ne '1bcc059c-9f84-e411-8795-f0921c194364'
I'm attaching screenshots of the trigger in PA studio, the Account table and and Modified By field so you can see it's a lookup field and you would use a GUID, as well as the GUID in the URL of the user profile. Please let me know if other information would be helpful.
Additionally: If someone knows of a way to combine these actions into one flow, that would be great, but I need to be able to trigger on either the Account or Opportunity entity so I'm not sure that's possible.