Expand my Community achievements bar.

SOLVED

How to remove spacing between hyphen in Adobe Campaign

Avatar

Level 3

Hi,

We create a delivery that contains two data fields concatenated by a hyphen:

s.png

...and when you click on link to the landing page, ("Your Offer"), it brings you to a landing page whose URL address contains the concatenated data fields, "80699361-A07071.htm" but the problem is that the hyphen (" -") that combines the two data fields creates an extra spacing in the URL address: "0699361%20-%20A07071.htm" thereby throwing a 401 page not found error since it is the incorrect URL address.

How do we eliminate the extra spacing surrounding the hyphen so that the extra spacing is removed from the URL address in the dynamic content field that generates the two data fields?:

s.png

Thank you.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Jael,

Please write something like this in the Javascript activity of your workflow, or in the Script activity of your delivery in your workflow:

logInfo("field1: #" + vars.field1 + "#");

logInfo("field2: #" + vars.field2 + "#");

then check the logs.

(of course replace vars.field1/2  by your own data element).


You should notice if you get extra space before the end # sign, so it would mean in your data source.
Otherwise, it means that it is the html code that you put in your delivery content that is responsible for your extra space. Please provide the part of hmtl + Javascript code you wrote in the delivery body for that personalisation.

In any cases, you can rid off the extra spaces using standard Javascript function trim():

var str = "       Hello World       ";
logInfo("string without extra spaces : #" + str.trim() + "#");

Regards
JS

View solution in original post

5 Replies

Avatar

Level 10

Hi Jael,

Please may you share the Javascript and html personalisation code for the 2 data fields inserted ?
I guess this is more an html effect than Javascript personalisation matter.

But may you also provide the result of logInfo of these 2 fields content, please do it in a manner that we could see it same way.
(in order to check if the fields content extra space or not)

Regards.
J-Serge

Avatar

Level 3

Hi Jean_Serge Biron,

Thank you for the quick reply. How do I obtain the logInfo of these two fields content?

Avatar

Correct answer by
Level 10

Hi Jael,

Please write something like this in the Javascript activity of your workflow, or in the Script activity of your delivery in your workflow:

logInfo("field1: #" + vars.field1 + "#");

logInfo("field2: #" + vars.field2 + "#");

then check the logs.

(of course replace vars.field1/2  by your own data element).


You should notice if you get extra space before the end # sign, so it would mean in your data source.
Otherwise, it means that it is the html code that you put in your delivery content that is responsible for your extra space. Please provide the part of hmtl + Javascript code you wrote in the delivery body for that personalisation.

In any cases, you can rid off the extra spaces using standard Javascript function trim():

var str = "       Hello World       ";
logInfo("string without extra spaces : #" + str.trim() + "#");

Regards
JS

Avatar

Level 3

Excellent! Jean_Serge!

I will implement your recommendations, and await the results.

Thank you so much as always!

Sincerely,

Jae

Avatar

Level 10

Hi Jae

Could you resolve your issue?

Let us know,

Florent