Tuesday, January 15, 2013

How to time trigger workflows through command prompt

If you have workflows in your CRM system that are required to be run everyday, but for some reason you are running them manually, this might be a good solution for you to save some time.

This solution demonstrates how you can trigger your Siebel workflows at specific intervals of time on windows. For, Siebel environments on other operating systems, you will have to create a solution similar to this, the only difference being the batch file will have to be written in shell (for Linux/Unix) or the programming language that is supported by the OS.

Step 1 - Write the batch file

Copy the below code in a text file and save it with the .bat extension

::Set Localization
  setlocal
::Gets The Parameters and sets into Environment Variables
   set GTYSRV=%1
   set ENTSRV=%2
   set SIEBSRV=%3
   set SIEBUSR=%4
   set SIEBPWD=%5
  
chdir C:\sia81\siebsrvr\BIN
  
   :: The workflow process name
   set wf=Test Workflow
   set command=run task for comp WfProcMgr with ProcessName='%wf%'
   c:\sia81\siebsrvr\bin\srvrmgr /g %GTYSRV% /e %ENTSRV% /s %SIEBSRV% /u %SIEBUSR% /p %SIEBPWD% /c "%command%"


This will connect to the siebel server via the command prompt and call the "Test Workflow" Workflow process.

Step 2 - Schedule the batch file

The next step would be to schedule the workflow process to run at a certain interval in the day. On windows you will need to schedule this through the Windows task scheduler. On Linux/Unix you will probably have to use crontab.

How to schedule a task in windows

How to schedule a task via Crontab

Note: You will have to add the following parameters in the Add Parameters section each separated by a space.

<ENTSRV> <SIEBSRV> <SIEBUSR> <SIEBPWD>

example: Siebel81G siebelDev siebelDev sadmin sadmin@123

Share/Bookmark