Ladies & Gentlemen,
Epicor E70.2.700 Public cloud here and I have a requirement in a Pre-Processing Method Directive to add a record into the UD Codes filewith a specific CodetypeID and CodeID if it doesn’t exist already. getting data from the ttable isn’t a problem using code similar to the following:
foreach(var MyUDCodes in (from ThisUDCodes in Db.UDCodes.With(LockHint.UpdLock) where ThisUDCodes.Company == Session.CompanyID && ThisUDCodes.CodeTypeID == "NEXT" && ThisUDCodes.CodeID == "CUST_AUT" select ThisUDCodes))
Obviously this reads the database table directly and works fine.
However, I need to know how to add a specific entry into the table if it isn’t already there and I guess don’t want to be updating the table directly so I am looking at the Business Object to add records as required to avoid attempting to update the tables directly with inherent locking problems etc…
I have successfully used the Ice.BO.UserCodesSVc Business Object using Postman and I can successfully add records using the POST operation as well as retrieve records using the GET procedure but I have no idea on how I can incorporate the BO call to retrieve a record, test if it is there and then add it in if it doesn’t exist into my custom C# Method directive code using the BO.
Any help would be most welcome.