Epicor Function for creating quote not working as expected

I’m currently in the thralls of debugging an Epicor function that will create a new quote. At this point, I am only trying to create a Quote Header and save it with the next quote number, but I keep running into an error message that says A valid customer is required

I followed the trace log of creating a new quote and copied all the business objects and methods that were used and put them in order in my code. See below.

var ds = new Erp.Tablesets.QuoteTableset();

// **************************************
// Creating the quote by pressing new
// **************************************

//< businessObject > Erp.Proxy.BO.QuoteImpl </ businessObject >
//< methodName > GetNewQuoteHed </ methodName >
this.CallService<Erp.Contracts.QuoteSvcContract>(x => {
    x.GetNewQuoteHed(ref ds);
}
);

//< businessObject > Erp.Proxy.BO.TaskSetImpl </ businessObject >
//< methodName > GetByID </ methodName >
this.CallService<Erp.Contracts.TaskSetSvcContract>(x => {
    x.GetByID("DEFAULT");
}
);

// **************************************
// Entering the Customer
// **************************************

//< businessObject > Erp.Proxy.BO.QuoteImpl </ businessObject >
//< methodName > ValidateECCType </ methodName >
string errorMessage = "NULL";
this.CallService<Erp.Contracts.QuoteSvcContract>(x => {
    x.ValidateECCType("8", out errorMessage, ref ds);
}
);

// I can only get up to this point without the customer invalid error getting thrown 

//<businessObject>Erp.Proxy.BO.QuoteImpl</businessObject>
//< methodName > GetCustomerInfo </ methodName >
this.CallService<Erp.Contracts.QuoteSvcContract>(x => {
    x.GetCustomerInfo(ref ds);
}
);

These are the errors I’m getting. The out errorMessage arg from x.ValidateECCType returns an empty string.

image

The error occurs in the last code block using x.GetCustomerInfo… I have also tried writing the corresponding CustNum (from CustID) directly to the dataset using ds.QuoteHed[0].CustNum = 31 but receive the same error.

I am very stumped on how to get a valid customer. Any help on this would be extremely appreciated.

I could be wrong, but I think you are not calling the Change Customer method (I haven’t looked for the exact name). Have you run a trace log to see what methods are called?

I haven’t seen anything in the trace logs that resembles a change customer method (I know the OrderHed has one), but I’ll keep looking. Thanks!

I just ran a trace and the process is GetNewQuoteHed, GetCustomerInfo, then GetShipToInfo. Are you not seeing the same thing?

Exactly what I’m seeing, thanks! I’m also using GetByID (from Task Set Service) and ValidateECCType (from Quote Service). Maybe the problem lies with GetShipToInfo. I’ll try it out.

Just checking so it’s clear - Are you writing the actual CustNum (which Epicor assigns sequentially behind the scene, hidden on the UI, can be looked up in BAQ or SQL), not the CustID (which we assign, and is displayed on the UI)?

1 Like

Writing the actual CustNum that I can only find via BAQ. I’ve tried assigning both without luck.

The trace will tell you that GetCustomerInfo is asking for the CustID value (you should not need the CustNum).

2 Likes