AR_OpenInvoice change Due Date

I'm attempting to update the Due Date on the AR_OpenInvoice table from the invoice history inquiry screen. It acts like its writing but it doesn't.

What I'm missing.

'THIS DOESN'T WORK
Dim Mas_Scr_Dbg

' debug is turned off - set to 1 to enable:
Mas_Scr_Dbg = 1

Dim InvNo
Dim InvType
Dim DueDate
DueDate = ""
InvNo = ""
InvType = ""
Div = ""
Cust = ""
retval =oBusObj.GetValue("ARDivisionNo$",Div)
retval =oBusObj.GetValue("CustomerNo$",Cust)
retval =oBusObj.GetValue("InvoiceNo$",InvNo)
retval =oBusObj.GetValue("InvoiceType$",InvType)


'**** AR Invoice Header******* 

oARInvoice = oSession.GetObject("AR_OpenInvoice_bus")

  if oARInvoice<> 0 then
   Set oARInvoice= oSession.AsObject(oARInvoice)
  else
   retval = oSession.AsObject(oSession.UI).Messagebox(

"","oARInvoice failed")
  return
  end if
 retval = oSession.AsObject(oSession.UI).Messagebox( "","Opened oARInvoice " )

 Test = InvNo & InvType
 retval = oARInvoice.SetKeyValue("ARDivisionNo$",Div)
 retval = oARInvoice.SetKeyValue("CustomerNo$",Cust)
 retval = oARInvoice.SetKeyValue("InvoiceNo$",InvNo)
 retval = oARInvoice.SetKeyValue("InvoiceType$",InvType)
 retVal = oARInvoice.SetKey()
 msgbox "Inv=" & InvNo & " type=" & InvType
 

 if retVal = 1 then
  retVal = oARInvoice.GetValue("InvoiceDueDate$",DueDate)
 msgbox "Due Date " & DueDate
  DueDate = "20151231" 
  retVal = oARInvoice.SetValue("InvoiceDueDate$",DueDate)
  retval = oARInvoice.write  'THIS DOESN'T WORK
 msgbox "Due Date " & DueDate 
 else
 msgbox "No Find"
 end if
retval = oSession.DropObject("AR_OpenInvoice_bus")

Parents Reply
  • 0 in reply to W Jezewski

    Hi

    Can I assume you are trying to execute this script from inside AR Invoice History Inquiry?  If so, that is your issue.  The scripts will run under the security of the launched task.  Invoice History Inquiry is a READ-ONLY task, thus business objects created while running in that session will inherit that security.

    That is why you are getting a security error when trying to set that field.

    Elliott

Children