0

I'm trying to personalize an SMS in a journey but the SMS isn't sending. If I leave out the code, it works. To set up the code, I'm using data from the Entry Source "Test_B2C_Contracts_Renewals". If it's possible, once the code works, I would use a different entry source "B2C_Customers", but the 2 data extensions are linked through Attribute Group (So I'm not sure if it will still work).

The code I put in the message field of the SMS so far (that I found here on stackexchange and adapted to our needs):

%%[ 

SET @idSubscriber = MOBILE_NUMBER 
SET @rows = LookupRows("Test_B2C_Contracts_Renewals","BankAccountNumber","OfferAmount","CodeVCS","GSM1",@idSubscriber) 
SET @RowCount = RowCount(@rows) 

IF (Rowcount(@rows) > 0) THEN 
    SET @ILRow = row(@rows,1) 
    SET @BankAccountNumber = Field(@ILRow,"BankAccountNumber")
    SET @OfferAmount = Field(@ILRow,"OfferAmount")
    SET @CodeVCS = Field(@ILRow,"CodeVCS")
ENDIF 

]%%

BankAccountNumber: %%=Field(@ILRow,"BankAccountNumber")=%%, 
Amount %%=Field(@ILRow,"OfferAmount")=%%, 
communication %%=Field(@ILRow,"CodeVCS")=%%. Info on our website.

3 Answers 3

1

What SF Support says does make it work, but you're setting variables and then never using them. And, why not catch the condition where no rows get returned?

I'd adjust it like this:

%%[ 

SET @idSubscriber = MOBILE_NUMBER 
SET @rows = LookupRows("Test_B2C_Contracts_Renewals", "GSM1", @idSubscriber) 
SET @RowCount = RowCount(@rows) 

IF @rowCount > 0 THEN 
    SET @row = row(@rows,1) 
    SET @BankAccountNumber = Field(@row,"BankAccountNumber")
    SET @OfferAmount = Field(@row,"OfferAmount")
    SET @CodeVCS = Field(@row,"CodeVCS")
    output(concat("BankAccountNumber: ", @BankAccountNumber, ", Amount: ", @OfferAmount, ", Communication: ", @CodeVCS, ". Info on our website."))
else
    output(concat("No renewal found."))
ENDIF 

]%%
1
  • Thanks Adam, that worked like a charm too. I'm completely new to AMPscript, so I'm discovering it as we go :) Commented May 28, 2018 at 6:50
0

I received a correction from the code by the SF Support team, which worked in my case.

%%[ 
SET @idSubscriber = MOBILE_NUMBER 
SET @rows = LookupRows("Test_B2C_Contracts_Renewals","GSM1",@idSubscriber) 
SET @RowCount = RowCount(@rows)
IF (Rowcount(@rows) > 0) THEN 
SET @ILRow = row(@rows,1) 
SET @BankAccountNumber = Field(@ILRow,"BankAccountNumber") 
SET @OfferAmount = Field(@ILRow,"OfferAmount") 
SET @CodeVCS = Field(@ILRow,"CodeVCS")
ENDIF 
]%% 

BankAccountNumber: %%=Field(@ILRow,"BankAccountNumber")=%%, Amount %%=Field(@ILRow,"OfferAmount")=%%, communication %%=Field(@ILRow,"CodeVCS")=%%. Info on our website.
0

Change the last part to this

BankAccountNumber: %%=v(@BankAccountNumber)=%%, 
Amount %%=v(@OfferAmount)=%%, 
communication %%=v(@CodeVCS)=%%.

Displaying the variables instead of calling them again from DE

2
  • Please add detail like what change you did and why. This is flagged for deletion.
    – Mr.Frodo
    Commented May 25, 2018 at 11:07
  • Added more detail Commented Jul 11, 2018 at 5:37

You must log in to answer this question.

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