How to redirect on Module Script from Arguments?

calamity
Giga Contributor

Hey,

So I created a module and set the link type to "Script (from Arguments:)" When I click the module, it does what it's suppose to and then directs to the background script page. Is there a way for me to redirect it to another page, like the homepage or a table page? Thank you in advance.

1 ACCEPTED SOLUTION

Have you thought about using a UI page? It would be pretty simple to embed your server code in a <g:evaluate></g:evaluate> and then redirect from there. Your module would use Arguments (from URL) to call the UI page.



my_ui_page.do



I've done this before to create records and then take them to the parent record that has just been created.


View solution in original post

14 REPLIES 14

Hi Kenny,



Not at this point. I took a look at all the other modules that have the same type and none of them indicate any interactive usage. They all output using gs.print(), gs.log(), etc. which is how I figured out it was using the background script processor.



gs.setRedirect() basically sets an HTML redirect in the header tag, but since the stuff in the script field is processed in the background, HTML headers are meaningless.


Chuck Tomasi
Tera Patron

Can you explain what the underlying requirement is? I feel we're focused on a specific technical solution and not on the use case. That's always a risky proposition. (And yes, I'm guilty of doing that too.)


Basically, users should be able to click on a module and that, in turn, runs the script and then redirects to the home page.


Have you thought about using a UI page? It would be pretty simple to embed your server code in a <g:evaluate></g:evaluate> and then redirect from there. Your module would use Arguments (from URL) to call the UI page.



my_ui_page.do



I've done this before to create records and then take them to the parent record that has just been created.


Ahh, thank you so much for the help. I'll look into that.