Is there a possibility to Redirect URL from one table to another table in Mobile interface?

vineetk
Giga Contributor

Hello Everyone,

I am facing an issue, I want to redirect URL from one table to another table in Mobile interface.

For example I am trying something like this...

I have list of Approvals from "sysapproval_approver" table in Mobile interface under "My Approvals".

Now, I have created List Buttons to open the records in form view.

Issue is: List of records i.e. RITM's are under "sysapproval_approver" table which has URL something like this:

https://<instance-name>/$m.do#/list/sysapproval_approver/<query>

And I am trying to Redirect it to following URL using action.setRedirectURL(url);

url is used as shown: https://<instance-name>/$m.do#/form/sc_req_item/current.sys_id

Now when I click on button it redirects me to new window but without any data, i.e.its Blank.

Please suggest on same.

Thank You!

1 ACCEPTED SOLUTION

Hi Vineet Kumar, actually, try this code. Disclaimer: It would work for any type of record which needs an approval.



var url = "https://<instance-name>/$m.do#/form/" + sysapproval.sys_class_name + "/" + current.sysapproval;


action.setRedirectURL(url);




This is possible since through the sys_class_name we can refer to the type of table that the reference sysapproval is of.




I hope all this has been helpful . Please let me know if you have any questions.




Thanks,


Berny


View solution in original post

14 REPLIES 14

Hi Berny,



That was really helpful.


But still I am getting redirected to new window but with blank page itself and the URL shows something like this:


https://<instance-name>//$m.do#/form/sc_req_item/undefined.



Thank You


vineetk
Giga Contributor

Hi Berny,



Thanks a lot, it was really helpful.


I got the result I wanted.



Thank You


yetesh_ch
ServiceNow Employee
ServiceNow Employee

Hi Vineet,



action.setRedirectURL() started working correctly from Eureka release onwards.



You may check this:


setRedirectURL on Mobile UI Action



Hope it helps!


vineetk
Giga Contributor

Hi Everyone,



Probably was doing mistake in referring to the record.


The URL should have been as correctly mentioned by Berny Alvarado,


https://<instance-name>//$m.do#/form/sc_req_item/current.sysapproval.sys_id


and it worked, I was able to redirect it to the particular record.



Thank You


Vineet Kumar


Awesome Vineet!



Thanks,


Berny