1

I have an issue in ampscript to get value in journeyData to Send an SMS. This is my ampscript to check if that field in journeyData has value or not

if empty(sObject:field) then
    set @field = "empty"
endif
if not empty(sObject:field) then
    set @field = sObject:field
endif

the thing is it's not sending sms because of this line of code eventhough I have a checker

set @field = sObject:field

if I remove this line and the data that entered the journey has no value for this field an sms will be sent same with data having this value. Any reason why this is happening eventhough I have a checker.

I'm running out of options , any suggestion is a big help thanks!

1
  • Wrap your variable in brackets when using that format. So, set @field = [sObject:field] Commented Nov 14, 2019 at 21:01

1 Answer 1

3

Not sure where the sObject:field data is coming from, but given it’s in the DE used in the journey, try the following script below.

It seems that in the script you wrote, you were trying to do things the other way around. Instead, set a variable first, and then decide what to do with it in case it’s empty or not:

%%[
set @field = AttributeValue("sObject:field")

 if empty(@field) then
       <do stuff>
 else
        <do other stuff>
 endif
]%%

Reference:

1
  • Thanks a lot man! I used attributeValue instead of directly assigning the journey to the variable and it worked!
    – imajmdf
    Commented Nov 15, 2019 at 2:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .