Search code examples
azure-data-factoryazure-synapse

Variable value in the mail in script in ADF


I have a Adf flow , in which, i have stored the data in a array Variable(namely 'VariOutput'), that thing is present in a If Condition Activity.

and in IF condition False Activity , i have given the Web activity link. the code used is

'''{ "RunId":"Dummy", "applicationName": "@{pipeline().parameters.AppName}", "ErrorCode":"error", "ErrorMessage":@{concat('File/Files not found-', string(variables('VariOutput')))}, }'''

But the webactivity is not processing the Array Variable VariOutput and throwing an error.

enter image description here

error :: error": { "code": "InvalidRequestContent", "message": "The request content is not valid and could not be deserialized: 'Unexpected character encountered while parsing value: F. Path 'ErrorMessage

ignore the line number 7 in the error , as i have deleted part of the error. enter image description here


Solution

  • The request content is not valid and could not be deserialized: 'Unexpected character encountered while parsing value: F. Path 'ErrorMessage

    • I tried to repro this and got the same error.

    enter image description here

    • This is because of double quotes in the variable. Replace the double quotes with single quotes and pass it in the web activity.
    • Give the below expression for error message "ErrorMessage":"@{concat('File/Files not found-', replace(string(variables('VariOutput')),'"',''''))}"

    enter image description here

    • When the pipeline is debugged, it is executed successfully, and mail is sent.

    enter image description here