IF/THEN logic in velocity script token | Community
Skip to main content
New Participant
April 24, 2024
Question

IF/THEN logic in velocity script token

  • April 24, 2024
  • 4 replies
  • 2625 views

we want to link to the self scheduler link if it’s populated and link to a default if it’s not. We also want to add a UTM query string to the end of the unique self scheduler link. Here is the logic I currently have: 

 

 

 

the else is working but the if is not, any insight?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

Katja_Keesom
Community Manager
April 26, 2024

I agree with the guys that inserting your code properly would have been easier, but even with the screenshot my first guess would be that you need to remove the quotation marks around the two tokens making up your "if" url. When your type actual text you need to add quotation marks, but that does not apply to tokens.

SanfordWhiteman
New Participant
April 26, 2024

The href attribute must be quoted. You can’t have equals signs in an unquoted HTML attribute.

 

(But here we are discussing something that really should be considered unreadable, and just as important unrunnable.)

Darshil_Shah1
Community Manager
April 25, 2024

@jordannams, could you share the output you're seeing vs. the expected output using the email preview mode? Go to the Email Preview mode >> Select a test record >> Share the actual and desired outputs. Of course, as shared by users above, you'd need to check the lead field you're using in the velocity script; otherwise, the velocity can't reference its data.

SaurabhGoyal_GN
New Participant
April 25, 2024

hi @jordannams - Seems like you haven't checked the property selfSchedulerLink is right pane of editor. Please check and confirm. 

New Participant
April 25, 2024

Thank you for your response - please see my update in the post above yours 🙂 Any help is greatly appreciated!

Jo_Pitts1
Community Manager
April 24, 2024

@jordannams ,

firstly, here's how to post code into Marketo nation: https://nation.marketo.com/t5/product-blogs/posting-code-in-discussions/ba-p/341001/highlight/true

 

Secondly, what do you mean by 'the if is not'?  Do you mean the output being generated doesn't work?  Do you mean people never get into the if side of the condition when you believe that should?

 

As a random suggestion, have you made sure the selfSchedulerLink field is checked in the tree on the RHS of the script editor?

 

Cheers

Jo

 

Regards

Jo

New Participant
April 25, 2024

Thank you so much for that! I am very new to Marketo (used SFMC previously) so this is very much a learning process and I appreciate all of the feedback.

 

So, by "the if is not" I mean that every time I test this token, it returns the default link instead of the self scheduler link even when it is not empty.

 

 

I do have the Self Scheduler clicked in the right side - is this what everyone is referring to here? 

 

Thank you again and I apologize for the lack of knowledge!

SanfordWhiteman
New Participant
April 25, 2024

@jordannams please remember to use the Syntax Highlighter when inserting code. Although here a screenshot is also useful, it’s not possible to find code errors from a screenshot.