Transform Ask For Input Variable Value

Hey, I am trying to get the value from my "Ask For Input" action to then Transform the text so that I can use it inside a URL to search with. (I have to replace the spaces with '+' so I can use in a url

So far, I first do the 'Ask For Input' and set that to a variable named: kbaseSearch.

I am able to use the 'Open Url/Open Url with Selection' if the phrase I enter is a single word with 0 spaces but if I use two words, it looks like it is getting encoded with " and the " is getting switched to %25 so the URL is encoding twice and %2522 is getting used.

Example: The url that I am getting sent to when the input I enter is csv integration is "https://mysite/dosearchsite.action?cql=siteSearch+~+%2522csv%20integration%2522&queryString=csv%20integration, when it should be https://knowledge.walkme.com/dosearchsite.action?cql=siteSearch+~+%22csv+integration%22&queryString=csv+integration

Then I tried to use the JavaScript Transformer option but doesn't work because it seems to have to be a selection. Can I use the variable value in place of 'clipboardcontents' in the JavaScript Transformer action in this scenario and is that the best way to do this?

It would be even better if I could do this from the textinput field of one of the new menus, but couldn't figure that out :confused:

Thanks!

Currently these variables are mostly for when you want to do some scripting (or to use them in conditions).

Here is an example with a script that gets the variable, transforms it, and updates it. Then it can be used in the next action:

async function transformInput() {
let input = await get_string_variable({variable_name: 'kbaseSearch'});

let transformed = input + 'something';

await set_string_variable({variable_name: 'kbaseSearch', to: transformed});

return transformed;
}

NOTE: I just discovered a bug, which is why this only works in versions >= 4.285. If you want to do the same in older versions, add a delay action after the java script action (e.g. 0.3 seconds) - otherwise the open URL will be executed before the value has been transformed.

I always try to stay up to date on most recent alpha and standard versions, so all good, thank you so much! It worked perfectly!

Looks like you resolved this, so now I don't need that code to make it work on the site I needed this for! Thank you so much for the code, in the meantime, and for updating it anyway so it's not needed! Appreciate it! I have done a ton with that just today!