0

working on an email and I have a field that has text in it, could be something like REJECTED, PICTURE_INCOMPLETE, DOCUMENT_TOO_OLD

OR just

REJECTED, DOCUMENT_TOO_OLD

For some reason it wont populate more than one reason see my code below, does indexof allow you to search a field's value for any text? I plugged in text for both PICTURE_BLURRY and PICTURE_INCOMPLETE but for some reason only the blurry text shows?

%%[ 
Var @picture_blurry,@picture_incomplete, @poa, @poi, @picture_blurrymsg,   @picture_incompletemsg, @document_info_not_matchingmsg 

/* Set the value to check */ 
Set @poa = AttributeValue("TriggerEmailEvent__c:PROOF_OF_ADDRESS__c")  
Set @poi = AttributeValue("TriggerEmailEvent__c:PROOF_OF_IDENTITY__c")  

/* Set the string to check */ 
Set @picture_blurry = "PICTURE_BLURRY" 

Set @picture_incomplete= "PICTURE_INCOMPLETE" 

/* Does it match */ 
if IndexOf(@poi,@picture_blurry) > 0 then 
    Set @picture_blurrymsg = "The image uploaded was blurry, so we were unfortunately unable to read and assess it." 
elseif 
   IndexOf(@poi,@picture_incomplete) > 0 then 
    Set @picture_incompletemsg = "Unfortunately some details were missing from the image you uploaded." 

ENDIF

]%% 
<br> <br>

<span style="margin:10px 0px;color:#283663;line-height: 150% !important;">
    <b>Proof of identity </b>


    <br> %%=v(@picture_blurrymsg)=%% 

    <br>
    %%=v(@picture_incompletemsg)=%% 

    <br>



    &nbsp;</span>

<br>
<span style="margin:10px 0px;color:#283663;line-height: 150% !important;">
    <b>Proof of address </b>


    <br> %%=v(@picture_blurrymsg)=%%

    <br>
    %%=v(@picture_incompletemsg)=%% 


    &nbsp;</span>

1 Answer 1

1

If you want to be able to process both, separate the conditions. Currently you have:

if IndexOf(@poi,@picture_blurry) > 0 then 
    Set @picture_blurrymsg = "The image uploaded was blurry, so we were unfortunately unable to read and assess it." 
elseif 
    IndexOf(@poi,@picture_incomplete) > 0 then 
    Set @picture_incompletemsg = "Unfortunately some details were missing from the image you uploaded." 
ENDIF

Change it to:

if IndexOf(@poi,@picture_blurry) > 0 then 
    Set @picture_blurrymsg = "The image uploaded was blurry, so we were unfortunately unable to read and assess it." 
ENDIF

if IndexOf(@poi,@picture_incomplete) > 0 then 
    Set @picture_incompletemsg = "Unfortunately some details were missing from the image you uploaded." 
ENDIF

By using ELSEIF you make it such that the picture_incomplete condition check is only performed if the picture_blurry condition fails. By separating them into two IF statements that are not related, you allow both conditions to be evaluated separately.

2
  • THanks so much I think this is gonna work - I am trying to include a link but it seems to break in the email - is there a way for me to include links inside the string? Set @contact_supportmsg = "It seems we need a few more details for you to be able to take card payments and for us to accept your account. Please <a href="website/contact/options">contact our support team</a> should you need more information."
    – GS65
    Commented May 5, 2020 at 16:56
  • Since this relates to a different problem, from what I understand, can I suggest you raise it as a separate question?
    – Phil W
    Commented May 5, 2020 at 18:54

You must log in to answer this question.

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