POSuggAdapter.ChangeVendor throwing an error

I am invoking a custom search and then trying to set the vendorID equal to the result of the search.

public void InvokeCustomSearch()
	{
		object result = ProcessCaller.InvokeAdapterMethod(oTrans.EpiBaseForm, "QuickSearchAdapter", "ShowQuickSearchForm", new object[] {oTrans.EpiBaseForm, "DAG-POSUGG", false /* multi-select */, new DataTable() });
		if (result == null) return;
		POSuggAdapter _adapter = (POSuggAdapter)csm.TransAdaptersHT["oTrans_adapter"];
        _adapter.BOConnect();
        try
        {
            _adapter.ChangeVendor(result.ToString());
        }catch(Exception e)
        {
            MessageBox.Show(e.ToString());
        }
	}

The error it throws says “no adjustments made” and I traced that error back to Erp.Proxy.BO, POSuggImpl.ChangeVendor.
The default search also invokes the ChangeVendor so what am I missing that is not allowing this to work?
Do I have to change my adapter or maybe pass ChangeVendor more arguments?

You need to change the row mod of the record to U.

I think your code needs to be changed to something like this.

public void InvokeCustomSearch()
{
	object result = ProcessCaller.InvokeAdapterMethod(oTrans.EpiBaseForm, "QuickSearchAdapter", "ShowQuickSearchForm", new object[] {oTrans.EpiBaseForm, "DAG-POSUGG", false /* multi-select */, new DataTable() });
	if (result == null) return;
	POSuggAdapter _adapter = (POSuggAdapter)csm.TransAdaptersHT["oTrans_adapter"];
    _adapter.BOConnect();
    try
    {
        _adapter.CurrentDataRow.RowMod = "U";
        _adapter.ChangeVendor(result.ToString());
        _adapter.Update();
       
    }catch(Exception e)
    {
        MessageBox.Show(e.ToString());
    }

I’m getting the error that “POSuggAdapter does not contain a definition for CurrentDataRow” (it also doesn’t contain a definition for RowMod)

You could do something like this

public void InvokeCustomSearch()
{
object result = ProcessCaller.InvokeAdapterMethod(oTrans.EpiBaseForm, “QuickSearchAdapter”, “ShowQuickSearchForm”, new object {oTrans.EpiBaseForm, “DAG-POSUGG”, false /* multi-select */, new DataTable() });
if (result == null) return;
EpiDataView POSuggDtl = ((EpiDataView)(this.oTrans.EpiDataViews[“SugPoDtl”]));
System.Data.DataRow POSuggDtlRow = POSuggDtl.CurrentDataRow;
POSuggDtlRow[“VendorId”] = result.ToString();
}

1 Like

That worked, thank you.