How do you code multi-word embedded data to auto-populate into another survey? | XM Community
Skip to main content
I have a survey used as an audit. If the audit scores less than 100%, an ticket is generated with certain fields in the ticket data if the person audited disagrees with our findings. When the person opens the ticket, the rebuttal link should have the required ED pre-populated in the survey that opens.



Originally, I had an embedded data field titled "Rebuttal Link" and set the value to a URL that included "https...surveyID?Assessment=${e://Field/Assessment}&Reviewee=${e://Field/Reviewee}...etc



Then I tried adding "?format=urlencode" to all the fields before the last "}". Then tried "?format=uriencode". Then tried a JS (_code image below_) without the ED for the rebuttal link, then with both formats (url and uri).



If any of the ED's contain multiple words, the link stops at the first "space". None of the methods I tried are putting the "%20" code for spacing.



How do I code the ED value to pull multi-word data into a URL created in that value?!







Thanks for any help out there!! ☺️
@Denise,



encodeURI encodes spaces as %20, so most likely something else going on. Use console.log and your browser's console feature to see what the values of link and newlink are.



Using encodeURI is a risky approach since the embedded variables could contain characters that don't get encoded. A better approach would be to use encodeURIcomponent on each embedded variable.
Thank you, TomG. You were right, there was another issue. As it turned out, I had failed to publish the last update. :-| Once I did that, the JS worked like a charm. Thank you for your response!!

Leave a Reply