open screen redirect from client action in new tab

Hi,

I know about the target="_blank" property on a link to open a screen in a new tab.

But, in our reactive application we have a button with a client action, getting data from an external source, a bit of logic, and at its end, redirects to a different screen. The requirement is to open that redirect screen in a new tab, how can this be achieved?

Solution

so for this you can use JavaScript in your client action to redirect the user to another screen.  In this java script you can write the code to open new tab. In $parameters.URL is the URL you want to open.

window.open($parameters.URL, '_blank')


If you want to encodeUrl then please use EncodeUrl inbuilt function.


Solution

so for this you can use JavaScript in your client action to redirect the user to another screen.  In this java script you can write the code to open new tab. In $parameters.URL is the URL you want to open.

window.open($parameters.URL, '_blank')


Hi Gwen, 

You can write JavaScript code to open url in new tab. For that you need to use JavaScript widget. 

Please see the below link -

https://www.outsystems.com/forums/discussion/77831/open-multiple-url-for-print-pdf/?utm_source=community&utm_medium=email&utm_campaign=forum-reply#Post324230

Thanks

Vinod

Hi,

Put a JS node in your client action with the following:

window.open('https://example.com/Module/Screen', '_blank');

It will open that screen in a new tab.
Let me know if this helps!

Cheers,

Paulo

Thanks all, this works indeed!

There is one more thing, I had to use $parameters. to pass input variables to the new screen via the url, that works as well, but one parameter had to be converted to an url friendly string.

I'm not sure what the exact term is for this, but to illustrate :

"/FileCache_CS/rest/FileStorage/GetFile?Id="

had to be converted to this, to make things work perfectly

"%2FFileCache_CS%2Frest%2FFileStorage%2FGetFile%3FId%3D"

I have done this hard coded in the input string, as you can see below, but surely there must be an action or a function available that handles this properly, anyone knows about that? Bonus points if you can tell me the technical term for this type of conversion. :-)

If you want to encodeUrl then please use EncodeUrl inbuilt function.


You can also use the External Site widget if the client action is inside a reactive form (not in the Logic tab).


You will however encounter the same issues: 

- the url must be fully supplied, including input params and the target: _blank

- You will loose debug modus because OS will think you are leaving the environment.

EncodeUrl(), that's what I was looking for Vinod, thanks!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.