Updating a ShipViaCode in ttMscShpHd when order number is changed but not saved

Dear Epicor community,

I would like to update theShipViaCode on the Miscellaneous Shipment entry menu when order # is changed but not saved (so Data directive is out of question). There is a field that is called MscShpHd.OrderNum and a button that runs the BO object Erp.BO.MiscShipDataSet

Just to provide more context, the value of the ShipViaCode will change and the dropdown will get updated only after saving if Data Directive is used, but I need to update this field when a new order number is loaded (not just typed, either selection through button or type and then tab button on keyboard). And also my purpose is solely updating the representation of the form and not affecting the database at all (we would like to show the Order#'s ShipVia code and just show it at this step without changing anything in the database since it is on a tt dataset).

If by any chance my explanation is not clear please let me know.
Here is the CustomCode on Data Directives that I currently use:

int ordernum = 0;
string shipviacode = "";
string company = "";

if(ttMscShpHd.Any())

{

foreach(var mscshphdrow in ttMscShpHd)
              {
                company =  mscshphdrow.Company;
                ordernum = mscshphdrow.OrderNum;
              }

              

foreach (var OrderHedRow in (from OrderHed_Row in Db.OrderHed
              where  OrderHed_Row.Company == company && OrderHed_Row.OrderNum == ordernum
              select OrderHed_Row))
              {
              shipviacode = OrderHedRow.ShipViaCode;
              
              }
              
foreach(var mscshphdrow in ttMscShpHd)
              {
              
                mscshphdrow.ShipViaCode = shipviacode;
                foreach(var mscshphdrow2 in ttMscShpHd)
              {
                mscshphdrow2.ShipViaCode =shipviacode;
              }
                
              } 

}

I tried looking among Method Directives and could not find anything relevant except MiscShip

Right now I have achieved this through DataDirective when save is pressed but I am hopiong to find a solution that the tt table gets updated without impacting the database.

Many thanks in advance for your help.

Kind Regards,
Shizar

you could do some magic with the BAQ ZONE option… to do this, you would create a BAQ that shows order numbers and ship vias, and assign that BAQ to the order field via the BAQ ZONE… when you click in the field, it can search and show the order number/ship via without even selecting the order.

Thank you @timshuwy ,
Do you happen to have a link to / sample of a code or tutorial that I can follow and learn?

I would suggest going to the help and search for BAQ ZONE where there are several articles about these. They are fairly easy.
You can also see something here where it describes how to customize its response: BAQ ZOne

1 Like

I actually found some videos online.
This is way better than nothing.
Any chance I can update the dropdownlist itself?

the dropdown list is based on the BAQ… if you make the BAQ so that it returns a limited set, or a special set of values, then yes.

1 Like