Basic Question about Screen Customization

I’ve been tasked to add a button to Transfer Order Entry that launches a webpage with a specific URL. The URL has a query string which is data derived from the part table, namely the SysRowID.
https://www.example.com/?part_srid=1234-5678-91011...

I can make the button open a web browser with the event wizard, but I don’t know how to get the data from the part record to add to the URL. I think I have to use the UI somehow to add some lookups but I have no idea what menus or steps to take to get the part record so I can extract the field.

This is something that experienced users do without second thought. Sadly, my expertise is not in this area. If someone can explain the steps to get data from a table at a high level (ELI5) then perhaps we can flesh out the details where the steps get tricky that would be most appreciated.

I don’t know what the best way is… I can think of a couple depending on the use case.

You could make a BAQ that looks up that data, then call the BAQ from your customization and store the result to a variable that you could then pass into your web URL. If you don’t know how to do this, it may be the most beneficial to learn because it is really handy for getting random bits of information without having to link a bunch of dataviews or call adapters (can be quicker).

Or, you could create a foreign key view under the detail view and pull in the Part record info. Then you could get the SysRowID from that dataview within the customization with no outside work needed. This is probably going to be slower to the user but a little more straightforward to develop because it only involves working inside your existing customization.

Let’s say I’m going down the route of customization data view.

I think I added a FKV. But how do you use it? How does it get into the customization? Like, literally what do I click on in the UI to make it so that I can see edvPart in the code.

go to the form event wizards. Set up an EpiViewNotification. Pick the Part view you just created. and update the code to include that. This will create the variables needed to get data from the edvPart. Maybe you’ve already done this.

You’ll want to create a variable in the initialize custom code block like:

string sysRowId;

Then in the destroy custom code block add a similar statement

sysRowId = null;

then inside the EpiViewNotification event for the edvPart, add

sysRowId = args.dataView[args.Row]["SysRowID"].ToString();

That worked! I’m able to get the edvPart now. I had another example of the button on another form so I used the syntax to grab sysrow ID from that. I’m documenting here for others (or maybe even myself in a year from now…)

First make the FKV view with the Tools > Data Tools menu (see my screenshot from above). Once you have the data view setup use wizards > Form Event Wizard to add the view to the code

When I clicked Update All Event code, in the Script Editor, Epicor automatically added the code to make edvPart available as a class variable we can use in other parts of the customization.

Highlighted here in green:

I added the button with the Event Wizard (that part was simple) and it dropped the code for the button click. Inside the method for the button click I added the code to get to the SysRowID like so:

private void btnLaunchPartForm_Click(object sender, System.EventArgs args)
{
	Process.Start("Chrome.exe", string.Format("https://example.com/index.php?srid={0}", (Guid)edvPart.CurrentDataRow["SysRowID"]));	
}


2 Likes