Script to only fire off Once

Before I start to write this script, is there a way to only allow a script to fire off once?  Background of the script I will create:  Need to populate the "SO DETAILS PURCHASEORDERNO" if blank with a "C" for all customers except 3 or 4, and only on lines with vendorno = "0001226".  However, I don't want the script to fire off every time an update is made to the SO, or if we delete the "C" in the POno field.  Basically, do not want the "C" to reappear if we delete it or for a legitimate POno to get overwritten by the "C".

Parents Reply Children
  • in reply to Kevin M

    I didn't create the UDF checkbox yet, have to get all 60 something users out before creating it so couldn't test.  This is a preliminary shot at the script.  The check box part to check the box off at the end of the script, I am not positive on.

    If oSession.CompanyCode = "ROI" then
    
    
    
    nPOno = ""
    
    nCustomerNo = ""
    
    nVendorno = ""
    
    sCCheckBox = ""
    
    
    
    rVal = oBusObj.GetValue("UDF_CCheckBox$", sCCheckBox)
    
    rval = oBusObj.GetValue("VendorNo$", nVendorNo)
    
    rVal = oBusObj.GetValue("CustomerNo$", nCustomerNo)
    
    rVal = oBusObj.GetValue("PurchaseOrderNo$", nPOno)
    
    
    
    	If sCCheckBox = "N" then
    
    
    
    		If nPOno = "" then
    
    
    
    			If nCustomerNo <> "2861000" or "2303006" then
    
    
    
    				If nVendorno = "0001226" then
    
    				rVal = oBusObj.SetValue("PurchaseOrderNo$", "C")
    
    				rVal = oBusObj.GetValue("UDF_CCheckBox$", sCCheckBox)
    
    					If sCCheckBox = "Y" then
    
    					rVal = oBusObj.SetValue("UDF_CCheckBox$", "Y")
    
    					End if
    
    				End if
    
    			End if	
    
    		End if
    
    	End if
    
    End if