Pre/Post-Delete User Defined Script

Hello, 

I am trying to capture a value when it has been deleted and store it to be used in another script. I have tried tying it to a Pre-Delete and Post-Delete event on the table storing the data, but neither are giving me anything. Can someone tell me if there is something wrong with my code?


ContactCode = ""

retVal = 0


retVal = oBusObj.GetValue("ContactCode$", ContactCode)
retVal = oScript.SetStorageVar("ContactCode", ContactCode)

Top Replies

Parents Reply Children
  • 0 in reply to jepritch

    retVal = 0
    oAudit = 0
    
    Set oAudit = oSession.AsObject(oSession.GetObject("CM_UDTMaint_bus", "AR_UDT_CUSTOMERCONTACTAUDIT"))
    
    ContactCode = ""
    
    retVal = oScript.GetStorageVar("ContactCode", ContactCode)
    
    Customer = ""
    retVal = oBusObj.GetValue("CustomerNo$", Customer)
    
    Email = ""
    retVal = oBusObj.GetValue("EmailAddress$", Email)
    
    CustomerName = ""
    retVal = oBusObj.GetValue("CustomerName$", CustomerName)
    
    user = ""
    user = oSession.UserName
    
    dateStamp = ""
    userKey = ""
    retVal = oSession.GetStampInfo(userKey, timeStamp, dateStamp)
    
    retVal = oAudit.SetKey(Customer+" "+dateStamp)
    If retVal > 0 Then
    retVal = oAudit.SetValue("UDF_CHANGE_DATE$", dateStamp)
    retVal = oAudit.SetValue("UDF_CHANGE_USER$", userKey)
    retVal = oAudit.SetValue("UDF_CUSTOMER$", Customer)
    retVal = oAudit.SetValue("UDF_CONTACT_EMAIL$", Email)
    retVal = oAudit.SetValue("UDF_CONTACT_NAME$", CustomerName)
    retVal = oAudit.SetValue("UDF_OLD_VALUE$", ContactCode)
    retVal = oAudit.SetValue("UDF_NEW_VALUE$", ContactCode)
    retVal = oAudit.Write()
    If retVal=0 Then
    	' error on the write to audit table
    End If
    End If

  • 0 in reply to jepritch

    This script is a Table-Pre-Write. Now I'm wondering if I need to change this to Post-Delete as well?

  • 0 in reply to Sarah Holbrook

    Oh wow, that was exactly my problem. SORRY!