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"
if not empty(sObject:field) then
    set @field = sObject:field

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!

  • Wrap your variable in brackets when using that format. So, set @field = [sObject:field] – Jason Hanshaw Nov 14 '19 at 21:01

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>
        <do other stuff>


|improve this answer|||||
  • Thanks a lot man! I used attributeValue instead of directly assigning the journey to the variable and it worked! – imajmdf Nov 15 '19 at 2:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.