How to remove spacing between hyphen in Adobe Campaign

jael91407431

02-10-2017

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.

Accepted Solutions (1)

Accepted Solutions (1)

Jean-Serge_Biro

MVP

03-10-2017

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

Answers (4)

Answers (4)

Jean-Serge_Biro

MVP

02-10-2017

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