CodeUnit unblocked

Hi Everybody

 

I create 1 CodeUnit and after write code on CodeUnit purpose unblocked Production Order but it's not work

 

OnRun()
IF "ProdOrder".Status="ProdOrder".Status::Released THEN
BEGIN
  IF "ProdOrder".FIND('-') THEN
  REPEAT
    "ProdOrder".Blocked:=FALSE;
    "ProdOrder".MODIFY;
  UNTIL"ProdOrder".NEXT = 0;
END;

Please help fix code. Thanks very much

  • Try to apply SetRange instead of IF condition.
  • ProdOrder.RESET;
    ProdOrder.SETRANGE(Status,ProdOrder.Status::Released);
    if ProdOrder.FINDSET then //or Find('-')
    REPEAT
    "ProdOrder".Blocked:=FALSE;
    "ProdOrder".MODIFY;
    UNTIL ProdOrder.NEXT = 0;
Related