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

9 comments:

  1. can you invoke business service through command prompt? If so, how?

    ReplyDelete
  2. I realize that this is not the correct place but I cannot find any link to "contact" the blog :)

    If you are updating your Blog List for Siebel CRM I would humbly propose you link to our blog :
    http://www.ondemand-education.com/blog

    Thanks

    ReplyDelete
  3. Hi OdEd,

    I would be happy too, You have some great stuff on you blog!

    Regards

    ReplyDelete
  4. Hi Anonymous,

    No, we cannot directly invoke a business service from command prompt. However, indirectly we can. The indirect way would be to use the business service in a workflow and invoke the workflow via command prompt which is essentially the same thing.

    Regards

    ReplyDelete
  5. Hi Ryan! Great blog matey! :)

    With regards to the article, why would you use this over a Repeating Component Job that invokes Workflow Process Manager?

    At least you have a degree of audit and control doing it this way as it's common for the admin to view the result of an RCJ every day.

    The danger of invoking through the command line is that you may not have tracability.

    Regards,

    Oli

    ReplyDelete
  6. Hey Oli,

    Thanks mate! - We were initially trying this via RCJ and for some unknown reason it just wouldn't work. This approach was a result of the work around we used. I agree with the not having traceability and control of the workflow, but we decided to go with it anyway.

    Regards,
    Ryan

    ReplyDelete
  7. Hi Ryan,

    Is it possible to pass process properties in this approach?? I mean if I have to Object Id or any other properties??

    Regards,
    John Wesly J

    ReplyDelete
  8. Very Nice Thoughts. Thanks For Sharing with us. I got More information about Oracle from Besant Technologies. If anyone wants to get Oracle Training in Chennai visit Besant Technologies.

    ReplyDelete
  9. Your blog is really useful for me. Thanks for sharing this informative blog. If anyone wants to get real time Oracle Course in Chennai reach FITA

    ReplyDelete

Share/Bookmark