We are trying to do a replace of an empty attribute in the client profile with N/A in a custom action in a journey. We tried replace and replaceAll but neither gave us the solution we needed.
REPLACE
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
replace --> replace the first occurence while replaceAll --> replaces all occurences
Try this
#{ExperiencePlatform.ProfileFieldGroup.profile.TotalAssetAmount}, defaultValue : "NA"}
Note: The type of the field and the default value must be the same.
David
Views
Replies
Total Likes
replace --> replace the first occurence while replaceAll --> replaces all occurences
Try this
#{ExperiencePlatform.ProfileFieldGroup.profile.TotalAssetAmount}, defaultValue : "NA"}
Note: The type of the field and the default value must be the same.
David
Views
Replies
Total Likes
Hey @Rochelle_Satow you should be handling the null/empty BEFORE you try to do the concatination.
Try this with the coalesce function handling this logic before it gets concatenated into the string.
concat(
coalesce(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.firstName}, 'N/A'), ' ',
coalesce(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.lastName}, 'N/A'), ' is customer since ',
coalesce(toString(#{ExperiencePlatform.ProfileFieldGroup.profile.customerSinceDate}), 'N/A'), ' has home at ',
coalesce(#{ExperiencePlatform.ProfileFieldGroup.profile..homeName}, 'N/A'), ' has potential total assets of ',
coalesce(toString(#{ExperiencePlatform.ProfileFieldGroup.profile.TotalAssetAmount}), 'N/A'), ' has active acct ending with ',
coalesce(#{ExperiencePlatform.ProfileFieldGroup.profile.accounts.all(#{ExperiencePlatform.ProfileFieldGroup.profile._accounts.at(0).productCode}=='XXX' and #{ExperiencePlatform.ProfileFieldGroup.profile._accounts.at(0).accountType}=='XXX' and (in(#{ExperiencePlatform.ProfileFieldGroup.profile..accounts.at(0).accountStatusCode}, ['A', 'N']))).at(0).acctLast4}, 'N/A'), ' opened on ',
coalesce(toString(#{ExperiencePlatform.ProfileFieldGroup.profile..accounts.all(#{ExperiencePlatform.ProfileFieldGroup.profile._accounts.at(0).productCode}=='XXX' and #{ExperiencePlatform.ProfileFieldGroup.profile.accounts.at(0).accountType}=='XXX' and (in(#{ExperiencePlatform.ProfileFieldGroup.profile.accounts.at(0).accountStatusCode}, ['A', 'N']))).at(0).accountOpenDate}), 'N/A')
)
Additionally, you can tweak it to the following for a couple additional reasons.
iif(
not(
#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.firstName} or
#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.lastName} or
#{ExperiencePlatform.ProfileFieldGroup.profile.customerSinceDate} or
#{ExperiencePlatform.ProfileFieldGroup.profile..homeName} or
#{ExperiencePlatform.ProfileFieldGroup.profile.TotalAssetAmount} or
(
#{ExperiencePlatform.ProfileFieldGroup.profile.accounts.all(
#{ExperiencePlatform.ProfileFieldGroup.profile._accounts.at(0).productCode}=='XXX' and
#{ExperiencePlatform.ProfileFieldGroup.profile._accounts.at(0).accountType}=='XXX' and
(in(#{ExperiencePlatform.ProfileFieldGroup.profile..accounts.at(0).accountStatusCode}, ['A', 'N']))
).at(0).acctLast4} and
#{ExperiencePlatform.ProfileFieldGroup.profile.accounts.all(
#{ExperiencePlatform.ProfileFieldGroup.profile._accounts.at(0).productCode}=='XXX' and
#{ExperiencePlatform.ProfileFieldGroup.profile.accounts.at(0).accountType}=='XXX' and
(in(#{ExperiencePlatform.ProfileFieldGroup.profile.accounts.at(0).accountStatusCode}, ['A', 'N']))
).at(0).accountOpenDate}
)
),
null, // Return null if all are empty/null
concat(
coalesce(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.firstName}, 'N/A'), ' ',
coalesce(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.lastName}, 'N/A'), ' is customer since ',
coalesce(toString(#{ExperiencePlatform.ProfileFieldGroup.profile.customerSinceDate}), 'N/A'), ' has home at ',
coalesce(#{ExperiencePlatform.ProfileFieldGroup.profile..homeName}, 'N/A'), ' has potential total assets of ',
coalesce(toString(#{ExperiencePlatform.ProfileFieldGroup.profile.TotalAssetAmount}), 'N/A'), ' has active acct ending with ',
coalesce(#{ExperiencePlatform.ProfileFieldGroup.profile.accounts.all(#{ExperiencePlatform.ProfileFieldGroup.profile._accounts.at(0).productCode}=='XXX' and #{ExperiencePlatform.ProfileFieldGroup.profile._accounts.at(0).accountType}=='XXX' and (in(#{ExperiencePlatform.ProfileFieldGroup.profile.accounts.at(0).accountStatusCode}, ['A', 'N']))).at(0).acctLast4}, 'N/A'), ' opened on ',
coalesce(toString(#{ExperiencePlatform.ProfileFieldGroup.profile.accounts.all(#{ExperiencePlatform.ProfileFieldGroup.profile._accounts.at(0).productCode}=='XXX' and #{ExperiencePlatform.ProfileFieldGroup.profile.accounts.at(0).accountType}=='XXX' and (in(#{ExperiencePlatform.ProfileFieldGroup.profile.accounts.at(0).accountStatusCode}, ['A', 'N']))).at(0).accountOpenDate}), 'N/A')
)
)
This way, you can handle the all null scenario independantly of the other solution, making it less prone to errors stemming from individual string mistakes. (Or just letting you skip it entirely, if that's your intent for an all N/A scenario
Let me know if this solves your problem, or if you have any other questions.
Best,
Tyler
Views
Replies
Total Likes
Views
Likes
Replies