Question

How Schedule bussines process

Hello everyone!! I need make a bussines process that run every 30 minutes. How can add to schedule that? I'm working in the cloud site.

Regards, 

 

File attachments

Like

3 comments

Dear Federico,

 

To reach your aim you can use the scheduler. You need to add the ScriptTask element to the business process and insert the following script there (please note that in the example below the process would run every 24 hours):

var userConnection = Get<UserConnection>("UserConnection");
string schedulerJobGroupName = "MyProcessGroup";//- any name
string jobProcessName = "UsrMyTestScheduleProcess"; //- the name of the process
string schedulerJobName = "MyJobName"; //- any name
int startOffset = 1; //- interval to the next start of the process in days
AppScheduler.RemoveJob(schedulerJobName, schedulerJobGroupName);
var job = AppScheduler.CreateProcessJob(schedulerJobName, schedulerJobGroupName, jobProcessName, userConnection.Workspace.Name, userConnection.CurrentUser.Name);
var trigger = new SimpleTriggerImpl(schedulerJobName + "Trigger", schedulerJobGroupName, DateTime.UtcNow.AddDays(startOffset));
AppScheduler.Instance.ScheduleJob(job, trigger);
return true

You need to add the following information to the process names (Usings):

- Quartz.Impl

- Quartz

- Quartz.Impl.Triggers

- Terrasoft.Core.Scheduler

Then you need to manually start the process once. When it’s done, the trigger is being created and it will start the process automatically according to the interval settings (in the case above once a day). 

Lisa

I tired this solutions and changed the schedule for every 5 minutes, but the process only runs once, or only during the intial run.  Any clue what I might be doing wrong? Has anyone else used this successfully?

var userConnection = Get<UserConnection>("UserConnection");
string schedulerJobGroupName = "mnetGroupName5Mins";
string jobProcessName = "mnetProcessName5Mins";
string schedulerJobName = "mnetSchedulerName5Mins";
int startOffset = 5;
AppScheduler.RemoveJob(schedulerJobName, schedulerJobGroupName);
var job = AppScheduler.CreateProcessJob(schedulerJobName, schedulerJobGroupName, jobProcessName, userConnection.Workspace.Name, userConnection.CurrentUser.Name);
var trigger = new SimpleTriggerImpl(schedulerJobName + "Trigger", schedulerJobGroupName, DateTime.UtcNow.AddMinutes(startOffset));
AppScheduler.Instance.ScheduleJob(job, trigger);
return true;

 

Show all comments