Update Table Fields in OrderHed from a Dashboard

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

:confused:

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.

1 Like

I have users which are “incompetent” of using a tick box and they have opted out for a button :frowning:

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

image

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.

1 Like

Isn’t it based off your BAQs name?

The BAQs name is TEAGLE-OSOLast7Days

Hi Carson,

This didn’t resolve the issue. I’m getting this