Adding Msc line charge via rest

I did the usual process of doing a trace and then making similar calls to the BO’s but I seem to be missing a secret ingredient. There is a call to “GetMiscChrgDefaults” but I don’t need the defaults for the msc code so I didn’t include that, I’m willing to set them in the code. I’m not thinking at 100% right now so I figure it might be something obvious… Getting an OK response but nothing happens.

dynamic mscData = EpicorRest.DynamicPost("Erp.BO.QuoteSvc", "GetNewQuoteMsc", new { Company = "78863", quoteNum = quote, quoteLine = line, qtyNum = "0", MiscCode = "PSur", MiscAmt="10.0", ds = new object() });
EpicorRest.DynamicPost("Erp.BO.QuoteSvc", "Update", mscData.parameters.ds);

I think you need to set your values after GetNew not in th get new call

Didn’t seem to help:

dynamic mscData = EpicorRest.DynamicPost("Erp.BO.QuoteSvc", "GetNewQuoteMsc", new { Company = "78863", quoteNum = quote, quoteLine = line, qtyNum = "0", MiscCode = "PSur", MiscAmt="10.0", ds = ds1 });
mscData.parameters.ds.QuoteMsc[0]["quoteNum"] = quote;
mscData.parameters.ds.QuoteMsc[0]["quoteLine"] = line;
mscData.parameters.ds.QuoteMsc[0]["qtyNum"] = "0";
mscData.parameters.ds.QuoteMsc[0]["MiscCode"] = "PSur";
mscData.parameters.ds.QuoteMsc[0]["MiscAmt"] = "10.0";
EpicorRest.DynamicPost("Erp.BO.QuoteSvc", "Update", mscData.parameters.ds);

What response are you getting back from the server?

Hmm well the msc charge code is invalid because we had a pilot refresh last night and so its gone, let me try fixing that and see what happens :slight_smile:

Hi Evan,

You also missing to set RowMod = “A”. Try adding that but also consider calling the methods to load misc charge defaults too. See below.

For Quotes you should be doing something like this:

newQuoteMsc.MiscCode = "SURC";
quoteSvc.GetMiscChrgDefaults(ref qTS, "QuoteMsc");
newQuoteMsc.RowMod = "A";

And for SalesOrder:

 newOrderMsc.MiscCode = "SURC";
 orderSvc.ChangeMiscCode(ref oTS, "OrderMsc");
 newOrderMsc.RowMod = "A";

The two custom methods there will populate all defaults from the misc charge table based on the misc code.

Hope that helps.
PSE

I got it working:


                    dynamic mscData = EpicorRest.DynamicPost("Erp.BO.QuoteSvc", "GetNewQuoteMsc", new { Company = "78863", quoteNum = quote, quoteLine = line, qtyNum = "0", MiscCode = "PSur", MiscAmt="10.0", ds = ds1 });
                    mscData.parameters.ds.QuoteMsc[0]["quoteNum"] = quote;
                    mscData.parameters.ds.QuoteMsc[0]["quoteLine"] = line;
                    mscData.parameters.ds.QuoteMsc[0]["qtyNum"] = "0";
                    mscData.parameters.ds.QuoteMsc[0]["MiscCode"] = "Draw";
                    mscData.parameters.ds.QuoteMsc[0]["MiscAmt"] = "10.0";
                    mscData.parameters.ds.QuoteMsc[0]["DocMiscAmt"] = "10.0";
                    mscData.parameters.ds.QuoteMsc[0]["DspMiscAmt"] = "10.0";
                    mscData.parameters.ds.QuoteMsc[0]["DocDspMiscAmt"] = "10.0";
                    mscData.parameters.ds.QuoteMsc[0]["Description"] = "PLate price increase";
                    mscData.parameters.ds.QuoteMsc[0]["FreqCode"] = "E";
                    EpicorRest.DynamicPost("Erp.BO.QuoteSvc", "Update", mscData.parameters);
1 Like