Hello -
I’m using REST to add lines to a quote. The parts in question are configurable, and when added to the quote initially, the “Configure” button is enabled. I examined the results from a GET in Rest help on a line added via the client, and am setting the PC relevant fields in POST to match:
public static void AddLine()
{
//Add New Line
var postData = new
{
Company = "1000",
QuoteNum = QuoteNum,
PartNum = ConfigLine.PartNum,
ConfigType = "PC",
Configured = "Off",
BasePartNum = ConfigLine.PartNum,
LineDesc = ConfigLine.PartDesc,
OrderQty = 1,
SellingExpectedQty = 1,
DocExpUnitPrice = ConfigLine.NetPrice,
ProdCode = ConfigLine.ProductCode
};
try
{
CallContextHeader callContext = new CallContextHeader();
var response = EpicorRest.BoPost("Erp.BO.QuoteSvc", "QuoteDtls", postData, callContext);
if (!response.IsErrorResponse)
{
int.TryParse(response.ResponseData.QuoteLine.ToString(), out int i);
ConfigLine.QuoteLine = i;
AddUD102A();
}
else ConfigLine.QuoteLine = 0;
}
catch (Exception ex)
{
string msg = ex.Message;
ConfigLine.QuoteLine = 0;
}
finally
{
GetDtl();
}
}
public static void SaveLine()
{
CallContextHeader callContext = new CallContextHeader();
var postData = new
{
Company = "1000",
QuoteNum = QuoteNum,
QuoteLine = ConfigLine.QuoteLine,
PartNum = ConfigLine.PartNum,
ConfigType = "PC",
Configured = "Off",
BasePartNum = ConfigLine.PartNum,
LineDesc = ConfigLine.PartDesc,
DocExpUnitPrice = ConfigLine.NetPrice,
ProdCode = ConfigLine.ProductCode
};
string vars = $"('1000',{QuoteNum},{ConfigLine.QuoteLine})";
var response = EpicorRest.BoPatch("Erp.BO.QuoteSvc", $"QuoteDtls{vars}", postData, callContext);
if (!response.IsErrorResponse)
{
GetDtl();
}
}
[WebMethod]
public static string AdjustQty(int qNum, int qLine, decimal Qty)
{
CallContextHeader callContext = new CallContextHeader();
try
{
var patchData = new
{
OrderQty = Qty,
SellingExpectedQty = Qty,
ConfigType = "PC",
Configured = "Off",
DocExpUnitPrice = ConfigLine.NetPrice,
ProdCode = ConfigLine.ProductCode
};
var response = EpicorRest.BoPatch("Erp.BO.QuoteSvc", $"QuoteDtls('1000',{qNum},{qLine})", patchData, callContext);
if (!response.IsErrorResponse) { return "success"; }
}
catch (Exception ex) { ShowAlertMessage($"Record not saved.\n{ex.Message}"); }
return "";
}
I cannot nail down when in the process it happens, but through a series of entering / exiting the quote in the desktop client, changing the quantity or updating other (irrelevant?) fields in quotedtl via REST, the button becomes disabled.
The only difference between a part added via the client vs REST, after this change occurs, is the Configuration Type field, which is blank.
I’m not sure how that grid is populated, but the field is calculated at some point and does not live in the QuoteDtl table. How is that field set and how can I prevent it from clearing?
