Open url and fire javascript function directly from link in Excel

Posted on 2013-06-11
Medium Priority
Last Modified: 2013-06-14
Hi, my organization is using Microsoft Dynamics CRM which is a system running in Internet Explorer. I'm building a system, which provides reports with among other things direct links to relevant pages in the CRM system. For most pages this is no problem as it is possible to navigate to these directly using a url. However I need to navigate to a custom built CRM page, which I can see in the source is entered using a javascript function (fired with onclick). The onclick argument looks like this:

openIsvWin('\x2fISV\x2fXXX.CRM.CustomerProductSheet\x2fCustomerOverviewSite.aspx', true, -1, '')

What I want to do is to provide a link in the report (a PDF file) that can navigate to the crm system and then fire this code in order to finally end at the desired page. Is this possible?
If it is not possible in a single link, then another possibility is to link to a small network stored batch/exe that does this - still I dont know how to do it.
Question by:andreas_rafn
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 27

Expert Comment

by:Chinmay Patel
ID: 39242182
Hi andreas_rafn,

I won't recommend chasing after this. Being a product these things will change and that too without notifying you and might not be very pleasant experience for the end user.

If you can explain what exactly you are trying to achieve I might be able to help you.
Opening up a URL is fine, passing few parameters in QueryString is also but opening up a popup from PDF using some external JS is not possible(AFAIK)


Author Comment

ID: 39243627
Thanks for your answer,

I know that its not ideal, but the reporting system is under constant development and maintenance, so we can implement and release changes from day-to-day. Due to organizational constraints, we cannot do it the right way (we don't have authority to tinker with the CRM system), so simply linking is the best way right now as cost benefit wise it is beneficial to do it the simple non sustainable way I described and simple change the code/link definitions along with changes in the system it targets, which btw doesn't change that fast to my knowledge.

Unfortunately its (AFAIK) not possible to access the page by a simple url with query string arguments. Its seems that the way to go is in two steps:

1. go directly to the CRM customer page using a link (this can be done using a simple url containing the guid of the customer, which is obtained by the system)
2. Fire the described script from that page, taking the user directly to the custom sub page of the customer page

As set using a batch script or exe to do both in go is ok, because I can easily store it at a corporate network location and link to that in the PDF.

Hope anyone can help with this.
LVL 27

Expert Comment

by:Chinmay Patel
ID: 39243685
Opening the page is possible and very simple. My comment was for calling a script on that page. Basically the page will have to be modified to accommodate this. You can write an On Load script for the same. That will look for a specific query string in URL and trigger the script you want.
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.


Author Comment

ID: 39245871
The problem is that I don't and will probably not get authority to make the CRM developers make this simple change (its a very rigid organization where sub organizations do not work too well together).

So I need to open the page constrained by the way things are now. And i still don't know how to do that in a good way. The only way I can think of is to make a small application that uses the Internet Explorer (browser used for CRM) API through which I can first open the customer page and then fire the javascript. But to me it just seems crazy that I need to create and link to an application in order to provide a direct link to the page in the PDF, I'm not very experienced in web development that's why I'm asking if there is an easier way than what I'm proposing - there surely must be?
LVL 27

Accepted Solution

Chinmay Patel earned 2000 total points
ID: 39246574
No. There is no easier way to achieve this. You have to understand it from a Web Developer's side as well and(from CRM side as well). Any web application should not allow launching of a URL then automatically call a function on available to page. You can think of various mischiefs people can pull off if this was possible. That's what the page should have that mechanism so based on a query string value it can execute certain logic on its own but not by a users' request.

Also I don't blame your CRM developers too. I was used to make changes but not now. I won't touch such requests with a 100 feet bamboo... it has become inherently risky and difficult to manage such unsupported customizations. I think if you absolutely have to provide that functionality then building that app is the only way out. Just in case I didn't understood your problem I have put down my understanding of it below:
 - From a report/PDF a CRM URL needs to be opened
 - and then when the page loads a function on that page should automatically be called.

If above is your requirement then sorry my friend I don't think there is any other simpler way to achieve this. CRM checks for its parent window but you are try to write a web page that will load the URL and then try to call that function on the page(instead of making an application to do so).

Author Closing Comment

ID: 39248906
Not the answer I was hoping for, but I definitely got wiser, so thank you for your feedback.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question