Hi Justas,
You are diving in deep with this one for your first time! Welcome to the community. I run custom actions from my custom dashboards all the time! I think this CSV export can be done pretty easy, though I have not tried it myself. This will take some code. But you should be able to copy/paste it most of it. I am not sure your level of experience, so feel free to ask any pointed questions.
Open your dashboard in Customization mode. Go to Tools >Toolbox, and use the toolbox to add a button to your dashboard. Use the properties to change the name of the button to something useful and unique like btnExportCSV. You can also edit the text of the button to change what shows to the user.
Now go to The Event Wizard, find your button with the provided drop downs, and choose the Click event. Click the little right arrow to add it to the list of events, then click Update Selected Event Code. This just drops a little bit of code in your script that gives you an outline for a button. Go to Script. Scroll down to the bottom of the code. There you should see your button click function. Whatever you put inside the code block will happen when you click the button. Inside the function code block put something like:
// Run custom code in BPM
oTrans.PushStatusText("Running Custom Action...", false);
var edv1 = oTrans.Factory("V_YourBAQ_1View"); //You can copy this name from your grids EpiBinding. Go to Properties > EpiBinding. Copy that text and paste it here.
BAQRunCustomAction(edv1, "CustomActionName"); // The name of the custom action you saved in your UBAQ.
oTrans.PushStatusText("Done!", false);
The custom action in your UBAQ, just needs to export the rows you want to CSV. The function BAQRunCustomAction is not built-in to epicor. Someone on this forum gave me this bit of code and I ahve been using it for a couple of years. Just add it below your button code block.
private void BAQRunCustomAction(EpiDataView iEdv, string iActionID)
{
BAQDataView BAQView = (BAQDataView)iEdv;
Assembly assembly = Assembly.LoadFrom("Ice.Lib.EpiClientLib.dll");
Type t = assembly.GetType("Ice.Lib.Framework.BAQUpdater");
BindingFlags bf = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
MethodInfo mi = t.GetMethod("BAQRunCustomAction", bf);
object[] param = new object[] { BAQView, iActionID};
mi.Invoke("Ice.Lib.Framework.BAQUpdater", param);
}
Make sure to go to Tools > Test Code before you save to make sure there are no errors. You can see the list of errors in the Script Editor window at the bottom. Test the code, Save the customization, and close it and reopen it to test it out!
This should be enough to get you into trouble. Good Luck!
Nate