Webpage in dashboard

I would like to embed a webpage in a dashboard and pass parameters to it as well.
I did a URL/XSLT view, the problem is that it makes a whole new tab. I need this webpage view to be a tab beneath another sheet. So, I want to just take it into customization mode, make a sheet where I need it and then add the necessary code. The problem is I don’t know how to write the code for this.

The webpage I need it to go is: http://envisionpp/test/callLogViewer.asp?custnum=[custid]. I need to be able to pass the parameter of custid based upon a search done in another BAQ in the Dashboard.

I use a web service to get QR codes. You could do the same thing. Check out this thread on how to use Tokens in a dashboard.

For your customization, can you make a tab, then move the tab into the sheet?

How do you move the tab down into the sheet?

I have several different sheets so I don’t want it to always show up. I want it to only show up when I am in a particular tab.

In a dashboard, unfortunately you can’t have a mix of tabs and sheets. I’ve had that problem in the past, and I basically just got as creative as I could with what I could do and was able to arrange something that worked.

I regular screen where you are embedding a dashboard, you can get a dashboard into the right sheet, but it doesn’t work if you are purely in a dashboard.

@hkeric.wci posted a blog on the use of embedded browser links on linkedin here: [ Snippet ] Epicor Simple Browser Helper

You may be able to find a way to somehow bind this to the beneath tab, though this is something to work with.

2 Likes

What about adding programmatically adding a WebBrowser control?
See: WebBrowser Class (System.Windows.Forms) | Microsoft Learn

We’ve done this in a few places where we need to show web content dynamically and don’t want the user to have to go out of Epicor to get it. I’ve never implemented it in a dashboard, but it’s all built in the standard customization engine so it should carry through.

You’ll need to initialize it yourself in the customization, but after you reload the customization it shows up just like a standard control. From there you can control the location and sizing.

Here’s an example of some code we used to bootstrap the browser window:

/************************/
/* IN THE SCRIPT CLASS  */
/************************/
/*initialize a web browser global variable*/
WebBrowser browserDisplay = new WebBrowser();

/****************************************/
/* IN THE InitializeCustomCode() METHOD */
/****************************************/
/*initialize and define how the browser should look in the InitializeCustomCode() method*/
/*this particular browser expands to fill the whole of a tab defined as customTab*/
browserDisplay.Dock = System.Windows.Forms.DockStyle.Fill;
browserDisplay.Location = new System.Drawing.Point(0, 0);
browserDisplay.MinimumSize = new System.Drawing.Size(20, 20);
browserDisplay.Name = "browserDisplay";
browserDisplay.Size = new System.Drawing.Size(784, 561);
browserDisplay.TabIndex = 9999;
browserDisplay.WebBrowserShortcutsEnabled = false;
browserDisplay.IsWebBrowserContextMenuEnabled = false;
browserDisplay.ScriptErrorsSuppressed = true;
customTab.Controls.Add(browserDisplay);
browserDisplay.BringToFront();
/*navigate to a blank page on initialization*/
browserDisplay.Navigate("about:blank");

/**********************************************/
/* IN SOME EVENT METHOD CREATED BY A WIZARD */
/**********************************************/
/*provide a new url and load that page*/
string newUrl = "http://envisionpp/test/callLogViewer.asp?custnum="+[custid];
browserDisplay.Navigate(newUrl);
3 Likes

Okay, I have made progress. I have the webpage populating when I hard code the value.

		private void SetupBrowser()
                {
				wbSite = new System.Windows.Forms.WebBrowser();
				wbSite.Dock = System.Windows.Forms.DockStyle.Fill;
				wbSite.Location = new System.Drawing.Point(0,0);
				wbSite.MinimumSize = new System.Drawing.Size(20,20);
				wbSite.Name = "wbSite";
				wbSite.Size = new System.Drawing.Size(560,323);
				wbSite.TabIndex=0;
				wbSite.WebBrowserShortcutsEnabled = false;
				wbSite.IsWebBrowserContextMenuEnabled = false;
				wbSite.ScriptErrorsSuppressed = true;
				grpboxQuickNotes.Controls.Add(wbSite);
				//custnum = epiTextCustNumReference2.Text;
				custnum = "24989";
				wbSite.Navigate("http://envisionpp/test/callLogViewer.asp?custnum=" + custnum.ToString()); 
                                
                }```

However, I don't want to hard code the value I want the line that is commented out: //custnum = epiTextCustNumReference2.Text to feed the website browser with the customer number.

Where is the epiTextCustNumReference2 coming from? I’m trying to figure out what you need to do to get it to work.

what happens if you don’t use custnum at all and just use epiTextCustNumReference2.Value.ToString() ?

epiTextCustNumReference2 is the text box that contains the value I need to pass into the webpage. It contains the customer number.

When I just try to put in epiTextCustNumReference2.ToString(); nothing happens. Do I need to have the webpage refresh maybe after I enter a value in that text box. I tried doing the Refresh all after I enter a number in there but it doesn’t work.

did you add .Value ?

No, it is actually a text box. Not a numberic editor. Do I still need to do .Value?

I don’t know, but try it. I’m shooting in the dark a little. I’ve needed to do it in the past.

wbSite.Navigate("http://envisionpp/test/callLogViewer.asp?custnum=" + epiTextCustNumReference2.Value.ToString());

That doesn’t work it causes an error when I launch: Exception has been thrown by the target of an invocation.

If you just do a message is the text reading correctly?

MessageBox.Show(epiTextCustNumReference2.ToString());

or just a message box with the custnum MessageBox.Show(custnum);

Is this a typo? does it compile with this?

Never mind, that’s your own variable. (I’m trying too hard…)

It compiles with that. I;m adding Message Box Now and will let you know.

It doesnt return the right information and it does it right at launch of dashboard. I need to be able to enter a number in that text box and then refresh and have it go get the correct webpage.

So you’ll have to find a different event to hang it off of. I would think an, “after field change” on that text box would be what you want for that one. I don’t know how the web page stuff works, but I would imagine that you need the set up stuff where you have it, and then just move the navigate to the after field change event.

I tried that…ugh. I think I’m just gonna make it its own dashboard and attach that to the sheet. I give up…