UI Macro button redirect URL not working

dlj23
Kilo Explorer

Hi,

 

I created a UI Macro button that's supposed to redirect to a new table, but it doesn't seem to work. It somehow always attempts to create a new incident record instead.

 

So I created a new macro with the following code:

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<button onClick="return testF();"> Edit </button>
<script>
function testF()
{
window.location = 'u_test_table.do';

}
</script>
</j:jelly>

 

u_test_table is the new table I created.

 

I created a new formatter that uses this macro and added that to the incident table.

 

When I open an incident and I click on the button, it actually creates a new incident record. I know it does the redirection as well because if I changed it to:

 

window.open() instead, it does open a new tab to the new table, but the current location also creates a new incident record.

 

Is there something I'm missing? I don't want it to create a new incident record, just redirect to the new url.

 

Thanks.

1 ACCEPTED SOLUTION

Ashok10
Mega Expert

Jason,


This time it should work. Please try change your script part



<script>
function testF()
{
window.location = '/u_test_table.do';
return false;


}
</script>



That is add return false; after redirection.


View solution in original post

7 REPLIES 7

Ashok10
Mega Expert

Jason,


I may be wrong here, but can you give a try once by adding '/' in the url i.e


window.location = '/u_test_table.do';


unfortunately it doesn't work. it still creates a new incident



i don't know if it's my environment or some known bug or something i'm missing ...


Ashok10
Mega Expert

Jason,


This time it should work. Please try change your script part



<script>
function testF()
{
window.location = '/u_test_table.do';
return false;


}
</script>



That is add return false; after redirection.


genius!



thank you. it works