Siebel Tools >  Reduce Workflow Monitoring levels - with batch job or eScript

Reduce Workflow Monitoring levels - with batch job or eScript

 You can create a batch file to reduce workflow processs logs to zero.You can create a batch file to reduce workflow processs logs to zero.This is useful if you have a large team testing on Workflows and the logs take upDatabase space and can cause performance issues.
I run this every few days.
There is a batch file and an sql file, both should be in the same folder.It does not matter how you name the batch file, name it something.bat

Here are the contents of the batch file.


cls@ECHO ON:
rem change it to the path where the sql file and .bat files are

cd D:\Workflowscriptfoldr


rem log folder path . set LogPath=D:\Workflowscriptfoldr\log


rem  this calculates the date

FOR /F "tokens=1-4 delims=. " %%I IN ('DATE /t') DO SET mydate=%%K_%%J_%%I

If Not EXIST D:\Workflowscriptfoldr\log mkdir D:\Workflowscriptfoldr\log


echo %date% %time%: start Workflow level reduction  >> %SLogPath%\%mydate%_Workflow.log

sqlplus sadmin/NCSADMINU99@SIEBU @wkflow.sql   >> %SLogPath%\%mydate%_Workflow.log

echo %date% %time%: End Workflow Monitor reduction >> %SLogPath%\%mydate%_Workflow.log

wkflow.sql  must be in the same folder as the batch file, otherwise the batch file may not find the sql file
The contents of wkflow.sql are 


delete from siebel.S_WFA_INST_LOG;

delete from siebel.S_WFA_INSTP_LOG;

delete from siebel.S_WFA_STPRP_LOG;

update siebel.S_WFA_DPLOY_DEF set monitor_lvl_cd = 'NONE' where TYPE_CD = 'PROCESS';

commit;

/

exit

 
If you want to do the same with eScript, you can use this function.If you want to make it automatic, add this function to a business service for example,then call the function from a workflow and add this workflow as a repeated job (RCR).


function ReduceWorkflowLog()

{
          var ObjApp = TheApplication();

          var myBusinessObject = ObjApp.GetBusObject("Front Office Workflow");

           var myBusinessComponent = myBusinessObject.GetBusComp("Workflow Process Deployment");

           var withMyBC; var logLevel = ObjApp.InvokeMethod("LookupValue", "WF_CD", "NONE");

       try

           {

                with (myBusinessComponent)

                   {

                             ActivateField("Monitoring Level");

                              SetViewMode(AllView);

                             InvokeMethod("SetAdminMode", "TRUE");

                             ClearToQuery();

                            SetSearchSpec("Monitoring Level", "<>'"+logLevel +"'");

                             ExecuteQuery(ForwardOnly);

                            if(myBusinessComponent.FirstRecord())

                            {

                                do

                                  {

                                      withMyBC = myBusinessComponent.GetPicklistBusComp("Monitoring Level");

                                      withMyBC.SetSearchSpec("Value", logLevel );

                                      withMyBC.ExecuteQuery();

                                      if(withMyBC.FirstRecord())

                                        {

                                              withMyBC.Pick();

                                         }

                                       WriteRecord();

                                  }

                             while(myBusinessComponent.NextRecord());

                              }

                         }

                      }

                     catch(e)

                      {

                           throw(e);

                      }

                    finally

                   {

                          logLevel = null;

                          withMyBC = null;

                          myBusinessComponent = null;

                          myBusinessObject = null;

                          ObjApp = null;

                      }
             }