BPM Code to create RFQ Sugg issue

,

Having a lot of trouble creating a simple code block to create a RFQ Sugg. Not a RFQ PO Sugg. It won’t save to the database. I looked at the contract xml file to see if I’m missing any requirements. I’ve tried in post and pre proc.


try
{
    using (var rfqSuggService = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.RFQSuggSvcContract>(Db))
    {
        Erp.Tablesets.RFQSuggTableset rfqSuggTableset = new Erp.Tablesets.RFQSuggTableset();

        
        rfqSuggService.GetNewRFQSugg(ref rfqSuggTableset);
        rfqSuggTableset.RFQSugg[0].Company = "TEST";
        rfqSuggTableset.RFQSugg[0].PartNum = "113028";
        rfqSuggService.Update(ref rfqSuggTableset);
        
       // rfqSuggTableset.RFQSugg[0].SugNum = 10;
       // rfqSuggTableset.RFQSugg[0].BuyerID = "JDP";
        //rfqSuggTableset.RFQSugg[0].RowMod = "A";
        
        //rfqSuggTableset.RFQSugg[0].LineDesc = "HI";
        rfqSuggTableset.RFQSugg[0].PartNum = "113028";
        rfqSuggTableset.RFQSugg[0].IUM = "LB";
        rfqSuggTableset.RFQSugg[0].QuoteNum = 0;
        rfqSuggTableset.RFQSugg[0].QuoteLine = 0;
        rfqSuggTableset.RFQSugg[0].RFQVendQuotes = 1;
        rfqSuggTableset.RFQSugg[0].ProcessRFQ = false;
        rfqSuggTableset.RFQSugg[0].RcvInspectionReq = false;
        
      
        // Set other values...

        // Submit the changes to the server
        rfqSuggService.Update(ref rfqSuggTableset);
        Db.Validate();
        Console.WriteLine("Update successful");
    }
}
catch (Exception ex)
{
    Console.WriteLine($"Error: {ex.Message}");
}


OR


var SUGG = Ice.Assemblies.ServiceRenderer.GetService<Erp.Proxy.BO.RFQSuggImpl>(Db);
Erp.BO.RFQSuggDataSet SUGGTs = new  Erp.BO.RFQSuggDataSet();
SUGG.GetNewRFQSugg(SUGGTs);
SUGGTs.RFQSugg[0].PartNum = "113028";
SUGGTs.RFQSugg[0].LineDesc = "GH1234";
SUGGTs.RFQSugg[0].IUM = "LB";


SUGG.Update(SUGGTs);

End Goal would be to loop through BAQ results prior to code block and create a new RFQ Sugg entry for each one. Im not necessarily looking to create an actual RFQ num. Just a Sugg Num.


string PartNum = string.Empty;
string LineDesc = string.Empty;
string IUM = string.Empty;
string RevisionNum = string.Empty;


try
{
    if (BAQ.Tables[0] != null)
    {
        using (var boSuggService = Ice.Assemblies.ServiceRenderer.GetService<Erp.Proxy.BO.RFQSuggImpl>(Db))
        {
            Erp.BO.RFQSuggDataSet SUGG = new Erp.BO.RFQSuggDataSet();

            foreach (DataRow baqRow in BAQ.Tables[0].Rows)
            {
                // Get a new RFQHead for each row
                boSuggService.GetNewRFQSugg(SUGG);

                // Set common values for all items in RFQHead
                //SUGG.RFQSugg[0].SugNum = 100;
                SUGG.RFQSugg[0].BuyerID = "JDP";
                SUGG.RFQSugg[0].RowMod = "A";
                SUGG.RFQSugg[0].Company = "TEST";
                
                SUGG.RFQSugg[0].ReqNum = 0;
                SUGG.RFQSugg[0].ReqLine = 0;
                SUGG.RFQSugg[0].GlbQuoteQuoted = false;
                SUGG.RFQSugg[0].GlbJobProdQty = 0;
                SUGG.RFQSugg[0].RequiredQty = 1;
                SUGG.RFQSugg[0].RcvInspectionReq = false;
                SUGG.RFQSugg[0].GlbSuggestion = false;
                SUGG.RFQSugg[0].QtyList = "1.00";
                SUGG.RFQSugg[0].ProcessRFQ = false;     
                SUGG.RFQSugg[0].RFQVendQuotes = 4;                  
                
                // Use the outer scope PartNum and LineDesc
                PartNum = baqRow["VendPart_PartNum"].ToString();
                LineDesc = baqRow["Part_PartDescription"].ToString();
                IUM = baqRow["Part_IUM"].ToString();
                RevisionNum = baqRow["PartRev_RevisionNum"].ToString();

                // Set values specific to each RFQHead using variables from BAQ
               SUGG.RFQSugg[0].CommentText = LineDesc;
               SUGG.RFQSugg[0].IUM = PartNum;
               SUGG.RFQSugg[0].PartNum = PartNum;

                // Submit the changes to the server for each row
                boSuggService.Update(SUGG);
                
                    Console.WriteLine("Update Response: Update successful");

            }
        }
    }
}
catch (Exception ex)
{
    Console.WriteLine("Error: " + ex.Message);
}

I don’t see you setting a row mod anywhere. Have you checked to see if that’s set correctly?

I added in Row mod A but its still not sticking.

Company, PartNum, RequiredQty, RowMode = “A”

Got an error somewhere trying to use the BO widget. Seems these are our requirements?

SugNum is required.
Description is required.
Part is required.
Class is required.
Job is required.
Quote is required.
Line is required.
Asm is required.
Supplier Number is required.

Exception caught in: Epicor.ServiceModel