BPM, Workflow, and Case

BPM, Workflow, and Case

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
Expand all | Collapse all

automatically starting the process every month

  • 1.  automatically starting the process every month

    Posted Mon October 30, 2023 01:08 PM

    Hi, I need to start process automatically on the 5th of every month. I know for undercover agent, but there is just options for every,first or last day of week, but I need to launch process on a certain date. Can someone to help?



    ------------------------------
    Andjela Andrijasevic
    ------------------------------


  • 2.  RE: automatically starting the process every month

    Posted Tue October 31, 2023 02:31 AM

    Hey, maybe you can make it run every day and your first step is to check if the date is really the 5th before starting the real work. 
    If you don't want to put that logic in the main process / service, you can have a wrapper service flow that calls the real one.

    Just an idea

    Jean



    ------------------------------
    QuikJean
    ------------------------------



  • 3.  RE: automatically starting the process every month

    Posted Tue October 31, 2023 10:05 AM

    Hey, thanks for answering. I had the same idea, but it wasn't work.

    I created undercover agent which is run every day, and in script i wrote code:

        var currentDate=new Date();
       if(currentDate.getDate()==31)
       {
        tw.system.startProcessByName("Izvještavanje o realizaciji strateškog plana društva");
       }

    I have two separated parts in the process. First (1) is start event and script in which I check if date is 31.(today day because of testing) and second (2) is main process. I'm not sure is this correct, but I didn't have other idea, and this isn't working, task doesn't appear in the Process Portal.



    ------------------------------
    Andjela Andrijasevic
    ------------------------------



  • 4.  RE: automatically starting the process every month

    Posted Tue October 31, 2023 10:23 AM

    Hi, I don't know if that start event triggers the script task but if it does the problem might be input parameters. Do you have any input parameters in your process? Here is the IBM BAW documentation for this:

    The method tw.system.startProcessByName() returns a TWProcessInstance object and takes 2 parameters:
    name (String)
    Name of the process.
    inputValues (Map)
    Map containing the input parameters for the process.
    var inputs = new tw.object.Map();
    inputs.put("parm1", "parm1 value");
    inputs.put("parm2", "parm2 value");
    tw.system.startProcessByName("StartProcess2", inputs);

    I am not sure if this is why you can't start it, but you can try.



    ------------------------------
    Rahmi Buğra Ünal
    ------------------------------



  • 5.  RE: automatically starting the process every month

    Posted Tue October 31, 2023 05:13 PM

    @Rahmi Buğra Ünal , @QuikJean

    Hi, thanks for answering.

    I don't have any input parameters in main process, I have just private variable, so I tried to pass empty object as input, but it still doesn't work.

    I work in development environment (Process Designer), and I test all process there or from development Process Portal. Is it possible that process can not be automatically started from Process Designer? Have I to make snapshot on test server to test automatically starting of process?



    ------------------------------
    Andjela Andrijasevic
    ------------------------------



  • 6.  RE: automatically starting the process every month

    Posted Tue October 31, 2023 10:32 AM

    Yeah I think what's missing is the input vars 

    mine is like

        var input = new tw.object.Map();
        tw.system.startProcessByName("Name of the process", input, false);



    ------------------------------
    QuikJean
    ------------------------------



  • 7.  RE: automatically starting the process every month

    Posted Thu November 02, 2023 01:46 PM

    You have to separate the script part from the main process and put it into a dedicated Service Flow. 

    The Service would be like

    And the UCA 


    Pay attention to the "attached service" in the UCA config

    Your process should only contain your part "2" and part "1" must be deleted.

    Now that being said, in Dev, UCAs don't get trigger on time unless you create a snapshot and make it active.. it's a bit painful to do so... so it's just better to hit the "Run Now" button



    ------------------------------
    QuikJean
    ------------------------------



  • 8.  RE: automatically starting the process every month

    Posted Fri November 03, 2023 06:14 AM

    Hi, I had the same idea, so I tried it, but it didn't work unfortunately.

    I have idea with gateway, but I don't know what to do with "no decision". I connect it to end event, but I have problem if it's not correct date, process is finished, and start event won't continue to fire every day.

    It works when I click on "Run Now" button when date of running this button fulfills the condition from "yes decision" . But if,for example, date of running is 2.11. and if decision is made for tw.local.startProcess.getDate()==3, it doesn't work. 



    ------------------------------
    Andjela Andrijasevic
    ------------------------------



  • 9.  RE: automatically starting the process every month

    Posted Mon November 06, 2023 04:46 AM

    Can you please provide more info about what does not work ? 



    ------------------------------
    QuikJean
    ------------------------------



  • 10.  RE: automatically starting the process every month

    Posted Mon November 06, 2023 07:17 AM

    I tried the following: in the gateway decision I checked whether the date was 3. I started the start event with "Run Now" on 3.11.and process was created automatically. I wasn't sure what the end event would do if the start date was not the same as the date in the gateway's decision, so I set the gateway to check if the date is 4.11. I clicked "Run now" on 3.11., but process wasn't created automatically on 4.11. I don't know how to "start event" continue to run every day if the date isn't correct.



    ------------------------------
    Andjela Andrijasevic
    ------------------------------



  • 11.  RE: automatically starting the process every month

    Posted Tue November 07, 2023 09:47 AM

    It is normal that that in Process/Workflow center, the UCA is NOT triggered automatically... by default only through "Run Now"

    Since your TIP snapshot is not enabled, the UCA is not scheduled. It is possible to workaround that, by creating a snapshot in your dev environment and then to activate it.



    ------------------------------
    QuikJean
    ------------------------------



  • 12.  RE: automatically starting the process every month

    Posted Fri November 03, 2023 09:09 AM

    Hello,

    Another option would be to use an external scheduling component, depending on the environment where you are running  - that might support an 'every 5th of the month' style of schedule. Then have that scheduling component start the process via the REST APIs.

    Stuart Jones



    ------------------------------
    Stuart Jones
    Business Automation Technical Specialist
    IBM
    Cedar Rapids IA
    630 390 4436
    ------------------------------