'(Declarations) ' Available Objects: ' BaseObjectEngine - PCS Base Object Engine ' LookupObjectEngine - PCS Lookup Table Engine ' WorkflowData - PCS Workflow Data Engine ' MetaObjectEngine - PCS Def Object Engine ' DB - PCS Database Engine ' DataItem - PCS Workflow DataItem ' ScriptInfoObject - PCS Workflow Script Parameter Collection ' 'End of (Declarations) Public Function WorkflowScript() '****Note about using Message Boxes '============================================================== ' Using Message Boxes (MsgBox) in your script will not cause ' a problem when testing your script via the Test Script tab. ' However, when initiating a process that contains a script with ' a message box will cause the process to stop and the ' scripting activity to shut down. ' ' Please remember to remove any message boxes from your script ' before initiating a process. '============================================================== '****Note about using On Error Resume Next '============================================================== ' On Error Resume Next is the only form of error handling in ' VBScript. If an error is raised out of a script while it ' is running, the error may cause the scripting activity to ' shut down. Therefore, please use On Error Resume Next in ' conjunction with the Err Object to handle any errors that may ' occur. '============================================================== On Error Resume Next '****Accessing Parameters that are entered into the Script ' Plugin is the name of the parameter '============================================================== ' Dim ParmValue ' ' ParmValue = ScriptInfoObject("").ParameterValue '============================================================== '**** Database Update Sample Code '============================================================== ' Dim lSuccess ' Dim sSQL ' Dim objUI ' ' Set objUI = CreateObject("PCSUI.DBWrapper") ' Set objUI.PCSDB = MetaObjectEngine.SQLServerObject ' ' sSQL = "UPDATE CustomerAttrib SET Value = '42' WHERE Value = '41'" ' ' lSuccess = objUI.ExecuteSQL(sSQL) '============================================================== '****Database Recordset Sample Code '============================================================== ' Dim lSuccess ' Dim sSQL ' Dim objUI ' Dim RS ' ' Set objUI = CreateObject("PCSUI.DBWrapper") ' Set objUI.PCSDB = MetaObjectEngine.SQLServerObject ' ' sSQL="Select * FROM Def_Attrib" ' Set RS = objUI.GetRecordset(sSQL) ' If Not RS Is Nothing Then ' Do While Not RS.EOF ' MsgBox RS("AttribDefGUID") ' RS.MoveNext ' Loop ' RS.Close ' End IF '============================================================== '****WorkFlowData Sample Code '============================================================== ' is the XMLTag of the DataItem you want to access 'DataItem.Default.Value will give you the raw value 'DataItem.Default.DisplayValue will give you the Readable Text 'For example, the BillCity Attribute might be a lookup list. ' Value could be a numeric value like 23 ' DisplayValue would be Cincinnati '****Getting a Single DataItem Value ' Dim DataItem ' ' Set DataItem = WorkflowData.DataItems("") ' ' DataItem.Default.Value = DataItem.Default.Value * 37 ' DataItem.Default.DisplayValue = DataItem.Default.Value * 37 ' ' WorkFlowData.SaveData '****Multiple DataItem Values ' Dim DataItem ' Dim MyTempVar ' Dim MyTempVar2 ' ' For Each DataItem In WorkFlowData.DataItems ' Select Case DataItem.XMLTag ' Case "" ' Set MyTempVar = DataItem ' Case "" ' Set MyTempVar2 = DataItem ' End select ' Next ' ' MyTempVar.Default.Value = MyTempVar.Default.Value + 34 ' MyTempVar.Default.DisplayValue = MyTempVar.Default.Value + 34 ' MyTempVar2.Default.Value = MyTempVar2.Default.Value + 17 ' MyTempVar2.Default.DisplayValue = MyTempVar2.Default.Value + 17 ' ' WorkFlowData.SaveData '============================================================== '****Load the BaseObjectEngine, a return value of 0 means it loaded '============================================================== ' Dim lSuccess ' lSuccess = BaseObjectEngine.GroupGet(WorkFlowData.GroupID) ' BaseObjectEngine.AsOfDate = Date '============================================================== '============================================================== ' The following values are valid return codes '-------------------------------------------------------------- ' 0 = Success - (Default) ' -1 = Failure - Mark task as failed ' -2 = Failure - Mark task as failed and Raise WithException Flag ' -3 = Failure - Mark task as failed and Rollback workflow ' -4 = Failure - Mark task as failed and Stop the workflow. '============================================================== WorkflowScript = 0 '(Default) Success End Function