Search code examples
c#buttoncustomizationattachmentepicorerp

Epicor C# Opening a Folder from a button


I want to open a folder from a record pulled up in a form in Epicor. I have created a button and so far it opens up the root folder but I want it to go to a sub-folder with the record's name as the sub folder that will be created from SQL stored procedure when a new record is created.

Here is what I have so far:

    private void epiButtonC1_Click(object sender, System.EventArgs args)
{
    // ** Place Event Handling Code Here **
    string folder = "\\\\MasterServ\\Shared\\Customer Attachments\\";
    Process.Start("IExplore.exe", folder);
}

I know something needs to be added at the end of the location to call the folder using the record but im not sure what.


Solution

  • When trying to get data out of a control in Epicor, generally speaking you want to go to the EpiDataView to get the value and not the control itself. There are multiple layers of abstraction going on in the form that make control handling wonky.

    From your example for the comments I would do this. Code untested so hopefully I didn't make a typo.

    EpiDataView edvUD104 = ((EpiDataView)(oTrans.EpiDataViews["UD104"]));
    if (edvUD104.HasRow)
    {
       string folder = "\\\\MasterServ\\Shared\\Customer Attachments\\" 
                      + edvUD104.dataView[edvUD104.Row]["Key1"].ToString();
       Process.Start("IExplore.exe", folder);
    }
    

    Edited for readability.