Customize APInvGrpAdapter

Hi all,

I’m trying to import data from Xml file into APInvoice Customize (in this case I have customize UD17 is child table of APInvHed).
In this case we gonna read data from Xml then :
step 1: Create new APInvGroup
step 2: Create new APInvHed(Parent table)
step 3: Insert data into child table(UD17)

That is the plan. I were success using APInvGrpAdapter to create new Group. it’s take me 19 Parameter to add new group. when the user create new APInv group just only fill GroupID to create new Group
So I thing maybe I were go wrong direction. You may say 19 Parameter ​is normal but when i am try to insert APInvHed it’s take like 400 param to insert new APInvHed.

The question is how i can init default value for those column.
this is my function.

private void CallAPInvGrpAdapterGetNewAPInvGrpMethod()
{
try
{
APInvGrpAdapter adapterAPInvGrp = new APInvGrpAdapter(this.oTrans);
adapterAPInvGrp.BOConnect();
var dr = adapterAPInvGrp.APInvGrpData.APInvGrp.NewAPInvGrpRow();

  	dr.BeginEdit();
  		dr["Company"] = oTrans.CoreSession.CompanyID;
  		dr["GroupID"] = "huyvd07";
  		Ice.Core.Session session = (Ice.Core.Session)APInvoiceForm.Session;
  		dr["ActiveUserID"] = session.UserID;
  		dr["ApplyDate"] = DateTime.Now;
  		dr["BaseTotal"] = "0";
  		dr["BitFlag"] = 0;
  		dr["CreatedBy"] = session.UserID;
  		dr["DispPostErrorLog"] = "";
  		dr["FiscalCalendarID"] = "01";
  		dr["FiscalPeriod"] = 11;
  		dr["FiscalYear"] = 2019;
  		dr["FiscalYearSuffix"] = "fsf";
  		dr["GenLegalNumsEnabled"] = true;
  		dr["IsBOE"] = false;
  		dr["PostErrorLog"] = "";
  		dr["PostInProcess"] = true;
  		dr["RowMod"] = "rm";
  		dr["SysRevID"] = "0";
  		dr["SysRowID"] = "00000000-0000-0000-0000-000000000000";
  	dr.EndEdit();
  	
  	adapterAPInvGrp.APInvGrpData.APInvGrp.AddAPInvGrpRow(dr);
  	
  	adapterAPInvGrp.Update();
  	adapterAPInvGrp.Dispose();

  } catch (System.Exception ex)
  {
  	ExceptionBox.Show(ex);
  }

}

Check out the APInvGrpAdapter Object to see if you can use Methods like:

GetNewAPInvGrp()

thank you so much. but you know my situation I don’t actually know how to perform it.
Could you help me more detail about this?

Do a trace on how you would do it normally with Epicor UI. Then replicate the methods being called in the trace.

Yeah I got success insert new Group the problem is that’s too much parameter(19 parameter) I 'm looking for the way help me make default values for Datarows and all I need just fill APInvGrpID to complete the row.

If you run the Trace on creating new AP Invoice Group, the two methods being called are GetNewInvcGrp and Update

        APInvGrpAdapter adapterAPInvGrp  = new APInvGrpAdapter(this.oTrans);
		adapterAPInvGrp.BOConnect();
		
		bool result = adapterAPInvGrp.GetNewAPInvGrp();
		
		adapterAPInvGrp.APInvGrpData.APInvGrp.Rows[0]["GroupID"] = "ABC";

		adapterAPInvGrp.Update();

that’s what i’m looking for bro. Thank you so much. I were looking for this thing for a week. I know it’s too much but can you suggest some document for me?

Hi @TobyLai
this is tracing log file when I create new APInvHed
there is BO & method


but when I open Object explorer:
I can’t see GetNewAPInvHedInvoice method from APInvoiceAdapter

even when i try using business logic method

So the question is When I got tracing data i got some Business Object with struct like:
Erp.Proxy.BO.xxxImpl how can i recognize which Adapter is used?
if you have any document talking about this. pls suggestion it for me. many thanks.