I created a Custom Code in BPM to look and if all firm release checkboxes in every line are checked check a box that i created on the OrderHed called FirmReleaseAll_c
i run the code and I keep getting this error
Error CS0120: An object reference is required for the non-static field, method, or property ‘Erp.Tables.OrderHed.FirmReleaseAll_c.get’ [InTran.FirmReleaseAll.cs(180,9)]
What am I doing wrong in my code?
This is my code:
Erp.Tables.OrderRel OrderRel;
foreach (var ttOrderHedRow in ttOrderHed)
{
foreach (var OrderRel_iterator in (from OrderRel_Row in Db.OrderRel
where OrderRel_Row.Company == ttOrderHedRow.Company
&& OrderRel_Row.OrderNum == ttOrderHedRow.OrderNum
select OrderRel_Row))
{
OrderRel = OrderRel_iterator;
if (OrderRel.FirmRelease = true)
{
OrderHed.FirmReleaseAll_c = true;
}
Here is a template I use. It is pretty much plug and play. Check how you are referencing the variables. You will need the code inside the outer set of {} for every table you are using. So where as you are using both OrderHed and OrderRel, these both need to be declared. You need to add the OrderDtl in there as well, in the case of multiple detail lines. In which case you would simply use the template code inside the OrderDtl {} section. Just as a double check, be sure after you created your new field that you regenerate the data module.
Erp.Tables.XXX XXX;
foreach (var XXX_Recs in (from XXX_Row in Db.XXX
where XXX_Row. Company == Session.CompanyID
&& XXX_Row.YYY == ZZZ_Recs.YYY
select XXX_Row))
{
var XXXRow = XXX_Recs;
if (XXX_Recs != null)
{
callContextBpmData.CCC = XXX_Recs.YYY;
}
} /*** XXX ***/
Thanks for the outline, I’m new to code in BPMs so the template will help. Question, is “CurOrderNum” a built in variable for method BPMs I assume if true.
@bmgarver What did you use in the Set Field of a Post-Processing to actually change the OrderHed table. I don’t believe setting ttOrderHed.FieldName would do anything on a post.