Hello,
Is it possible to update fields in OrderHed Table from a customised dashboard tracker? I want to add a button to a dashboard and have it update fields in OrderHed
My fields
Approve_c
ApproveDate_c
Many thanks
Aaron.
Hello,
Is it possible to update fields in OrderHed Table from a customised dashboard tracker? I want to add a button to a dashboard and have it update fields in OrderHed
My fields
Approve_c
ApproveDate_c
Many thanks
Aaron.
Why not use an Updateable BAQ with a dashboard?
As long as your dashboard is updatable you can modify the EpiDataView in the customized dashboard assembly.
Some combination of theses three videos shows all the steps.
Hereās a super quick updatable dashboard.
Hereās setting a field on a button click.
If you need to see how to customize the tracker and access the EpiDataView I do that in this video. Ignore all the text box and filtering stuff. You can probably skip this videoā¦
Hi Carson
Thank you for that.
I have created the updatable BAQ with the fields I want to update but some of the videos youāve shown donāt allow Customisation Wizard in Dashboard.
Do you have an example code? I can use.
My fields havenāt changed from above, I would like to use the EpiDataView but Iām not sure how to write it.
You donāt have to customize the dashboard. How do you want your users to search for the records to return? Is it Order Number or something else?
Hi John,
I have this dashboard with these buttons.
I would like āApprove Orderā to update field āOrderHed.Approve_cā with the text āApprovedā
and the others to update other fields e.g the discount field with the percentages.
C# isnāt my strongest of points and very new to epicor so this is all fun for me.
Thanks
Aaron.
Why buttons? I would just have the fields available to update in a grid view. Have the Approved_c field be a boolean that could be checked off.
If you really want the buttons, you are going to have to do AfterButtonClick events.
I have users which are āincompetentā of using a tick box and they have opted out for a button
How do they use Epicor at all?
Got it. Iāve run into the same thing.
Are you familiar with the Wizards in customization?
I am but theyāre not supported in tracker for dashboards it will need to be coded.
All of the customization wizards should be there if you customize it after you deploy the dashboard assembly.
If you added the button to the tracker view inside the dashboard remove it from there and add after deploying the dashboard. Then you can follow the steps in the button click video. The result will be code very similar to the code in the button click video, just the names will be determined by the name of you BAQ and button.
The below code assumes a button called approveBtn and needs the name of the EpiDataView updated (V_BAQNameHere_1View).
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
this.approveBtn.Click += new System.EventHandler(this.approveBtn_Click);
// End Wizard Added Custom Method Calls
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.approveBtn.Click -= new System.EventHandler(this.approveBtn_Click);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void approveBtn_Click(object sender, System.EventArgs args)
{
EpiDataView edvApproved = ((EpiDataView)(this.oTrans.EpiDataViews["V_BAQNameHere_1View"]));
System.Data.DataRow edvApprovedRow = edvApproved.CurrentDataRow;
if ((edvApprovedRow != null))
{
edvApprovedRow .BeginEdit();
edvApprovedRow ["OrderHed_Approved_c"] = true;
edvApprovedRow ["OrderHed_ApproveDate_c"] = DateTime.Now;
edvApprovedRow .EndEdit();
oTrans.Update();
}
}
Carson that cleared up my issue
but now Iām getting this lovely error
Please post your code. When do you get the error?
private void approveBtn_Click(object sender, System.EventArgs args)
{
EpiDataView edvApproved = ((EpiDataView)(this.oTrans.EpiDataViews["V_TEAGLE-OSOLast7Days_1View"]));
System.Data.DataRow edvApprovedRow = edvApproved.CurrentDataRow;
if ((edvApprovedRow != null))
{
edvApprovedRow .BeginEdit();
edvApprovedRow ["OrderHed_Approved_c"] = "Approved";
edvApprovedRow ["OrderHed_ApproveDate_c"] = DateTime.Now;
edvApprovedRow .EndEdit();
oTrans.Update();
}
}
}
I get it when I click the button.
Is āV_TEAGLE-OSOLast7Days_1Viewā valid? Can you see it in the object explorer?
Otherwise either debug in visual studio or start commenting out code until the error goes away.
These lines got extra spaces when I pasted them in, but I donāt think thatās the problem.
edvApprovedRow.BeginEdit();
edvApprovedRow["OrderHed_Approved_c"] = true;
edvApprovedRow["OrderHed_ApproveDate_c"] = DateTime.Now;
edvApprovedRow.EndEdit();
Hi Carson,
Sorry I didnāt get back to you until now.
Thank you for all of your help.
This is the what the object explorer is saying.
Kind regards,
Aaron.
Should your code have V_TEAGLE_OSOLast7Days_1View instead of V_TEAGLE-OSOLast7Days_1View? You can see for sure by the binding on the grid view.
Isnāt it based off your BAQs name?
The BAQs name is TEAGLE-OSOLast7Days