Back to all

Update contact when field changes

Hi guys, I am trying to use power automate to update an address book entry when a user defined field changes. The UDF is a YES / NO field, called Contact Left Company, and I need to update the contact's first name when this field is set to YES to have ZZZ at the front of the contacts first name. I am using the New or Updated Address Book Entry trigger, and this allows me to include the user defined field in the response. When I add the condition to check the value of the Yes/NO field I use the expression triggerBody()['userDefinedFields']['Contact Left Company'] select is equal to and set the value to Yes. However this condition keeps failing giving me the following error:

The expression contains dynamic functions, variables or parameters that cannot be resolved in the debugger.

Please let me know how I can check the value of this field when it is updated?

The code it generates for this condition is as follows:

{
"type": "If",
"expression": {
"and": [
{
"equals": [
"@triggerBody()['userDefinedFields']['Contact Left Company']",
"Yes"
]
}
]
},
"actions": {
"Update_Address_Book_Entry": {
"type": "OpenApiConnection",
"inputs": {
"parameters": {
"applyActionTo": "Contact",
"body/Keys": [
"@item()?['key']"
],
"body/FirstName": "@concat('ZZZ',item()?['firstName'])"
},
"host": {
"apiId": "/providers/Microsoft.PowerApps/apis/shared_maximizercrm",
"connection": "shared_maximizercrm",
"operationId": "ActionAbEntryUpdate"
}
}
}
},
"else": {
"actions": {}
}
}