Hopefully this is a simple question. Where is the event for when the OrderHed.UseOTS is checked?
I see Blur and Create but I can’t figure out how to hook onto this checkbox.
You might want to hook onto the underlying dataview depending on what you are doing.
What are you doing?
We have a classic customization. Whe the user checks the UseOTS then it looks up the ShipTo record and copies the address fields to OrderHed OTS fields. This saves typing. In Kinetic I did:
add ShipTo data view
add CopyOTS event (row-update widget)
add LoadShipTo event (rest-erp and next-event widgets)
Now I just need to assign to the checkbox event when it becomes true. I’m not sure I if I can use a Data Rule to call up an event.
Here is the simple classic code.
private void OrderHed_BeforeFieldChange(object sender, DataColumnChangeEventArgs args)
{
EpiDataView edvOrderHed = ((EpiDataView)(this.oTrans.EpiDataViews["OrderHed"]));
// ** Argument Properties and Uses **
// args.Row["FieldName"]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
{
case "UseOTS":
GetShipToAddress();
break;
}
private void GetShipToAddress()
{
// Wizard Generated Search Method
// You will need to call this method from another method in custom code
// For example, [Form]_Load or [Button]_Click
bool recSelected;
string whereClause = "ShipToNum = '" + edvOrderHed.dataView[edvOrderHed.Row]["ShipToNum"].ToString() + "' and CustNum = " + edvOrderHed.dataView[edvOrderHed.Row]["ShipToCustId"].ToString();
System.Data.DataSet dsShipToAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "ShipToAdapter", out recSelected, false, whereClause);
if (recSelected)
{
edvOrderHed.dataView[edvOrderHed.Row]["OTSName"] = dsShipToAdapter.Tables[0].Rows[0]["Name"].ToString();
edvOrderHed.dataView[edvOrderHed.Row]["OTSAddress1"] = dsShipToAdapter.Tables[0].Rows[0]["Address1"].ToString();
edvOrderHed.dataView[edvOrderHed.Row]["OTSAddress2"] = dsShipToAdapter.Tables[0].Rows[0]["Address2"].ToString();
edvOrderHed.dataView[edvOrderHed.Row]["OTSAddress3"] = dsShipToAdapter.Tables[0].Rows[0]["Address3"].ToString();
edvOrderHed.dataView[edvOrderHed.Row]["OTSCity"] = dsShipToAdapter.Tables[0].Rows[0]["City"].ToString();
edvOrderHed.dataView[edvOrderHed.Row]["OTSState"] = dsShipToAdapter.Tables[0].Rows[0]["State"].ToString();
edvOrderHed.dataView[edvOrderHed.Row]["OTSZIP"] = dsShipToAdapter.Tables[0].Rows[0]["ZIP"].ToString();
edvOrderHed.dataView[edvOrderHed.Row]["OTSCountryNum"] = dsShipToAdapter.Tables[0].Rows[0]["CountryNum"].ToString();
edvOrderHed.dataView[edvOrderHed.Row]["OTSPhoneNum"] = dsShipToAdapter.Tables[0].Rows[0]["PhoneNum"].ToString();
edvOrderHed.dataView[edvOrderHed.Row]["OTSTaxRegionCode"] = dsShipToAdapter.Tables[0].Rows[0]["TaxRegionCode"].ToString();
}
If you press F-12 it will bring up the developer console. If you click somewhere in the Order Entry screen and then press CTL+ALT+8 then it will begin debug mode:
If you then check One Time you will see this (my highlight):
Using that information you can now create an event that handles the Column Changing UseOTS event:
I just did a simple toast message:
This thread has shown me a lot of good tips to figure out how to figure out what’s happening in the background: (shoutout to @hmwillett) How To: Debugging Kinetic (Browser)
Thanks Doug. Very helpful. In my case “Column Changing” caused the process to hang after the row-update widget so I used the “Column Changed” hook instead.