Hi Rakesh,
Have you tried using the JS Snippet and inject your JS there?
I had a similar issue, but I resolved it by creating a custom button ( HTML Snippet ) and ran an onclick event ( In the JS Snippet ).
Widget is here : https://appstore.home.mendix.com/link/app/56/