We’re making some tweaks to the RMA form, our RMA’s are always tied to just one SO#, so our users want me to add a Sales Order search button to the Header tab. I’ve got my button created and the click event coded but not sure what code I need to active the standard SO search when the button is clicked and have the selected SO# populate a UD field.
The customization wizard can walk you through this. It creates a chunk of code for you and all you have to do is either copy that code into the Click event, or call that code with something like: SalesOrderAdapterSearch();
Thanks @Aaron_Moreng and @Jason_Woods, with your clues I was able to get the Sales Order Search dialog to open, crashes after selecting a SO and clicking OK. I’m sure it’s that I don’t have it set to write back to the UD field correctly. The syntax is from the wizard except the Table_UDField named.
private void btnSONum_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
// 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 = string.Empty;
System.Data.DataSet dsSalesOrderAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "SalesOrderAdapter", out recSelected, true, whereClause);
if (recSelected)
{
System.Data.DataRow adapterRow = dsSalesOrderAdapter.Tables[0].Rows[0];
// Map Search Fields to Application Fields
EpiDataView edv = ((EpiDataView)(this.oTrans.EpiDataViews[""]));
System.Data.DataRow edvRow = edv.CurrentDataRow;
if ((edvRow != null))
{
edvRow.BeginEdit();
edvRow["RMAHead_UDFieldName"] = adapterRow["OrderNum"];
edvRow.EndEdit();
}
}
}