I have a customer search button that’s opening the Customer Search view but whenever you select a customer in the search it doesn’t actually update the text field with the selected CustID… I can right click on the CustID text field and select Open With → Customer Search and whatever you select in there will update to the field, but my custom button is not.
I can have it write to a CallContextBPMData field and as long as a text field is binded correctly then it will update - but the CallContextBPMData fields have no filtering properties on the query so that’s useless… How can I alter my code to update the binded CustID field with the selected Customer in the Customer Search?
Note - I am using the Simple Search Customization Wizard to add the code.
Here’s the code -
private void SearchOnCustomerAdapterShowDialog()
{
// Wizard Generated Search Method
// You will need to call this method from another method in custom code
// For example, [Form]_Load or [Button]_Click
The GIF below shows that it’s doing… Whenever you select a customer from the search it’s trying to update the actual query result field “CustID” and not the “txtCustID” field in the tracker view.
Are you just trying to populate that textbox with your selection? If so, you don’t need the above. Just need:
MyTextBox.Text = adapterRow[“CustID”]; (Assuming your control is name MyTextBox)
Also, you may have to do adapterRow[“CustID”].ToString();
That seems to work but I’m now struggling to understand what’s wrong with this thing…
I re-did the entire dashboard since I was having some cache issues - but what I did was the following:
Deleted dashboard definition
Created a new dashboard and brought in the query
Then I added the tracker view above the summary data
Published to main menu as Dashboard-Assembly
Opened it with Developer mode and added the button + text field. I also binded the text field to V_CSROnlineSales_1View.CustID
Added the customer search stuff using the wizard and added the button click event.
That’s all working properly but here’s my problem - the query is running like there’s no tracker view whatsoever. I select the customer using the button and it goes into the field, but the field isn’t attached to the query so it’s basically an empty field according to the query… How can I make the query filter on the customized text field?
Also the since the field is binded to CustID it’s saying it’s read only and I can’t change it at all
So it sounds like you compiled the dash to an assembly, that’s good. So is the issue that the tracker is not working at all? If you run test from the dashboard dev screen, does the tracker work there?
My thought is that if you can get tracker to work and filter, instead of creating the text field, reference the text field that already belongs to the tracker. I am not sure if you are familiar with the process but its like this:
EpiTextBox refToText = (EpiTextBox)csm.GetNativeControlReference(“the guid string of the tracker control we need”);
Then you can place text into it: refToText.Text = “Whatever I want”;
The tracker is blank on the dashboard dev screen since I only added the tracker view and then went straight into the customization (so the customization ‘owns’ the button and text field in the tracker view)
I’m not too familiar with that process, but I’ll take a look… Unfortunately a lot of stuff came up this afternoon, so this little project will have to go on the back burner until next week.
Ah I see. Sounds like an easy fix so no worries.
You’ll want to get your dash\tracker al worked up first. You add all the fields to filter by etc. It’s not too bad. You’ll have this working by next week!
So create a text field on the tracker that has query control for the CustID, and then on the dashboard customization have a text field that references the tracker’s text field - does that sound correct?
For the reference stuff do I just put “[DashboardcustomizationEpiTextBox] refToText = (EpiTextBox)csm.GetNativeControlReference(“bda7be68-7d36-4aa7-936d-159beb82ec6e”);” somewhere in the script editor, or is it on the text field properties?
No - to start, forget about adding any custom controls. You’ll create a tracker view, select the fields you want to filter and it will create a textbox for you that filters. Once you get that working in test, we’ll tackle the next part.
Alright I have a tracker with a text field that’s binded to CustID called txtCustID - now I have that dashboard definition deployed into a dashboard assembly.
Alright I did all that but I’m getting some errors…
First off here’s my code (the only part I didn’t include was the ‘using’ stuff in the beginning) -
public class Script
{
// ** Wizard Insert Location - Do Not Remove ‘Begin/End Wizard Added Module Level Variables’ Comments! **
// Begin Wizard Added Module Level Variables **
EpiTextBox myCust;
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete ‘Begin/End Wizard Added Variable Initialization’ lines **
// Begin Wizard Added Variable Initialization
myCust = (EpiTextBox)csm.GetNativeControlReference(“bda7be68-7d36-4aa7-936d-159beb82ec6e”).ToString();
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
this.btnCustomer.Click += new System.EventHandler(this.btnCustomer_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.btnCustomer.Click -= new System.EventHandler(this.btnCustomer_Click);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void SearchOnCustomerAdapterShowDialog()
{
// Wizard Generated Search Method
// You will need to call this method from another method in custom code
// For example, [Form]_Load or [Button]_Click
private void btnCustomer_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
SearchOnCustomerAdapterShowDialog();
}
}
So as you can see I have the simple search stuff and the button call towards the end of the code - that seems to work properly.
The error I’m getting when I test this is -
Error: CS0030 - line 34 (152) - Cannot convert type ‘string’ to ‘Ice.Lib.Framework.EpiTextBox’
Which seems to be an issue with the reference line in InitializeCustomCode.
Edit - I removed ToString() and now there’s no errors when testing - but it’s not actually writing any information to that text box. I think I need to validate the names
Chris,
Can you help me? I am having a similar issue. I am trying to launch a search and return the result to a tracker field. I have mimicked the code above but am getting this error. Line 61 - Scrip.TxtOrderDtl_PartNum is a field but is used like a type.
Here is my code: (I have other things going on in there so my apologies for the long code.
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete ‘Begin/End Wizard Added Variable Initialization’ lines **
// Begin Wizard Added Variable Initialization
txtCustID = (EpiTextBox)csm.GetNativeControlReference(“bda7be68-7d36-4aa7-936d-159beb82ec6e”);
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
this.btnCustomer.Click += new System.EventHandler(this.btnCustomer_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.btnCustomer.Click -= new System.EventHandler(this.btnCustomer_Click);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void SearchOnCustomerAdapterShowDialog()
{
// Wizard Generated Search Method
// You will need to call this method from another method in custom code
// For example, [Form]_Load or [Button]_Click
Sorry to open this back up. I am also trying to add a Customer search button to a dashboard. When trying to use this example, my C# has me using static, so in the above quote I cannot use the ‘this’ this.oTran. When I try removing it, or adding ‘Script’ from public static class Script, I am told ‘it oTrans’ does not exist in current context or 'Script does not contain a definition for ‘oTrans’. Not sure how to proceed from here. Thanks for the assist, David