BOI Create Completion Transaction for Work Ticket

SOLVED

I'm trying to use Business Objects to create a completion transaction for a Work Ticket in Sage 100 2022.  I can't seem to figure out how to add the work ticket to the actual transaction.  Below is a slimmed down version at its simplest form of what I'm trying to do.

$r = $this->oSS->nSetProgram($this->oSS->nLookupTask("PM_Transaction_UI"));
$o = $this->oPVX->NewObject("PM_Transaction_bus", $this->oSS);

$transactionNo = new \VARIANT("");
$r = $o->nGetNextTransactionNo($transactionNo);
// $transactionNo returns "0240859" (Different every time)
// $r returns 1

$r = $o->nSetKeyValue('TransactionNo$', $transactionNo);
$r = $o->nSetKey();
// both $r's return a 1

$r = $o->nSetValue('TransactionType$', $transactionType);
// $r returns a 1

$r = $o->oLines->nAddLine();
// $r returns a 2 (No clue what a 2 means)

$r = $o->oLines->nSetValue('WorkTicketNo$', $workTicketNo);
// $r returns a 0
// LastErrorMsg gives me "The 0240859 is invalid."

$r = $o->oLines->nWrite();
// $r returns a 0

$r = $o->nWrite();
// $r returns a 0
// Last ErrorMsgs gives me "You must enter at least one line."

$this->oSS->DropObject();
$this->oSS = null;

Any ideas what I'm missing here?  Should I not be using the oLines object like I do pretty much everywhere else?  This in in PHP but hopefully the logic is sound.

Parents
  • +1
    verified answer

    I finally managed to get this working with all your help.  Something was definitely wrong with the initial installation.  After the reinstall, and using the proper code for getting the WorkTicketKey (and a few minor other fixes just for logging) it finally went through.  Thanks again for all your help in figuring this one out.

Reply
  • +1
    verified answer

    I finally managed to get this working with all your help.  Something was definitely wrong with the initial installation.  After the reinstall, and using the proper code for getting the WorkTicketKey (and a few minor other fixes just for logging) it finally went through.  Thanks again for all your help in figuring this one out.

Children
No Data