OrderComments on FulFillment Workbench

I am trying to add OrderComments to the Fulfillment workbench Order Fulfillment tab. We are running 10.2.500.40. I found this article Add UD fields from other BO in grid - #15 by A.Baeisa It gave me a few ideas but they do not seem to be working.


‘’’ foreach (var ttOrderAllocList in (from row in OrderAllocRelease select row))
{

  var dbOrderHeadOrderComment = (from row in Db.OrderHed
                        where row.Company == Session.CompanyID &&
                              row.OrderNum == ttOrderAllocList.OrderNum &&
                              row.OrderComment
                              select row.)FirstOrDefault();
                              
                              
  if(dbOrderHeadOrderComment != null)
  {
      ttOrderAllocList.Warehousecode = dbOrderHeadOrderComment.OrderComment;
  }
  else
  {
      ttOrderAllocList.Warehousecode = " ";
  }

}‘’’

Has anyone done this before that could lend some help?

I think you want…

var dbOrderHeadOrderComment = (from row in Db.OrderHed
                        where row.Company == Session.CompanyID &&
                              row.OrderNum == ttOrderAllocList.OrderNum
                              select row.OrderComment).FirstOrDefault();
1 Like


then i get an additional error at the bottom. I probably should have posted my errors to start with.

1 Like

I think you want to swap ttOrderAllocList and OrderAllocRelease in your foreach statement. Then where you reference ttOrderAllocList inside of the foreach, swap that with OrderAllocRelease.

Then remove the .OrderComment from the end of dbOrderHeadOrderComment. Like this:

foreach (var OrderAllocRelease in (from row in ttOrderAllocList select row))
{
  var dbOrderHeadOrderComment = (from row in Db.OrderHed
                        where row.Company == Session.CompanyID &&
                              row.OrderNum == OrderAllocRelease.OrderNum
                              select row.OrderComment).FirstOrDefault();

if (dbOrderHeadOrderComment != null)
{
  OrderAllocRelease.WarehouseCode = dbOrderHeadOrderComment;
}
else
{
  OrderAllocRelease.WarehouseCode = "";
}
}
2 Likes

I made the changes, but i am getting this error even though i have added the assembly.

1 Like

I see the issue. You need to change ttOrderAllocList to OrderAllocRelease in the LINQ statement. That was my bad. I’ll correct it on that post.

1 Like

Do i then have to create tatableset variable here?
image

Only if you have to use that in another widget within that BPM. Otherwise, you have already instantiated the OrderAllocRelease variable within the custom code which should be an OrderAllocListTable or whatever type it is.

1 Like

I asked that because i am still getting an error.
image

1 Like

image

1 Like

I totally misread that sorry. I am testing it now and ill let you know if it works.

1 Like