Expand my Community achievements bar.

SOLVED

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

Avatar

Level 7

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!

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi @Ivan_Mironchuk,

 

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.

 

View solution in original post

2 Replies

Avatar

Employee Advisor

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. 

Avatar

Correct answer by
Level 7

Hi @Ivan_Mironchuk,

 

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.