I have managed to create a Data Action that accepts null values. And if I run the Data Action itself it will work fine every time both with provided values and no values. BUT the data action will always fail when called in Architect.
I have seen in the forums here that we need to create variables in Architect that have the defaults as NOT_SET. And I have done this. However the Data Action always fails no matter what I do.
Do you have any insights for on how to make this work?
My Request Body in the dataAction looks like this:
{
"firstName": "${input.firstName}",
"middleName": "#set( $mydefault="" )#if( ${input.middleName} )${input.middleName}#else$mydefault#end",
"lastName": "${input.lastName}",
"workPhone": {
"display": "${input.workPhone}"
},
"workEmail": "#set( $mydefault="" )#if( ${input.workEmail} )${input.workEmail}#else$mydefault#end"
}
For your data action to work, architect will need to provide non-null values for firstName, lastName, and workPhone. If any of those have a "NOT_SET" value in architect, the action will fail.
One thing that could be catching you is an oddity of the data action test UI. If you do not put any value into a string variable and hit "Run Action", the UI will test with a null/NOT_SET value. If you put a value into the box and then delete all of the characters in the box, it will send "" (an empty string). This is a crucial difference for a data action like yours. You can refresh your browser to get back to the initial "send nulls" mode in the UI.
If that doesn't help you out, you might want to contact support so that they can help you figure out where your data action is failing during a call flow.
Thanks for the explanation Jason. I did try testing both the scenarios you mentioned, but when testing it always just worked.
I did also figure out how I have to set the Variable so that it will work.
The trick was to create a variable for the empty value, like in my case I know that I don't have the email information of the user, so the value just has to be Literal with nothing entered as value. That seemed to do the trick. I was always trying to pass no value directly on the Data Action, instead of creating first an empty Variable.