Returning a profile attribute from with certain conditions in an array object | Community
Skip to main content
Level 6
January 5, 2024
Solved

Returning a profile attribute from with certain conditions in an array object

  • January 5, 2024
  • 1 reply
  • 776 views

Hi there,

 

We are looking to send our customers a SMS based on their phone numbers in their profile. However, for our org identity structure, a profile can have multiple accounts, the data looks like this:

 

"ContactNumbers": [

{

"Account": "1",

"PhoneNumber": "111",

"AccountType": "Class A"

},

{

"Account": "2",

"PhoneNumber": "222",

"AccountType": "Class B"

},

{

"Account": "3",

"PhoneNumber": "333",

"AccountType": "Class c"

}

]

 

Is it possible in the Advanced Mode of an expression, put conditions in there? In English, "return me the phone number in the array position where AccountType is "Class C"" 

 

Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by akwankl

Hi @ivanmi1,

 

I came across this documentation, and experimented with a few variations of what is mentioned in it. Looks like by using the below expression, it achieves what I needed. 

 

(serializeList(#{ExperiencePlatform.ContactDetails.profile._tenantID.contactdetailsv2.all(currentDataPackField.Account == ${externalKey}).smsContactNumber},'', false))

 

where ${externalKey} is the parameter.

 

I am still looking forward to the IF/ELSE feature though!

 

Thanks.

 

1 reply

Adobe Employee
January 5, 2024

hi @akwankl currently it is not possible to use expressions to choose the particular phone number. We are working through a featureset in the future that will allow for if/then expressions for surface settings such as the use case above. In the meantime, I suggest using audience segment logic to split your audience into the different account holder types before targeting. 

akwanklAuthorAccepted solution
Level 6
January 6, 2024

Hi @ivanmi1,

 

I came across this documentation, and experimented with a few variations of what is mentioned in it. Looks like by using the below expression, it achieves what I needed. 

 

(serializeList(#{ExperiencePlatform.ContactDetails.profile._tenantID.contactdetailsv2.all(currentDataPackField.Account == ${externalKey}).smsContactNumber},'', false))

 

where ${externalKey} is the parameter.

 

I am still looking forward to the IF/ELSE feature though!

 

Thanks.