Hello community!
I have a business proces that when run manually works perfect but if use the schedule code, the code schedule the proces perfect but when ejecute return a error about the null object.
Can you help me to find the error?
The bussines proces to ejecute (think that error is about the userConnection):
var userConnection = (UserConnection)HttpContext.Current.Session[ "UserConnection" ];
var delete = new Delete(userConnection)
.From("BGlobalSurveyLinks");
delete.Execute();
var insert = new Insert(userConnection).Into("BGlobalSurveyLinks")
.Set("Name", Column.Const(surveyLink))
.Set("Description", Column.Const(surveyTitle));
insert.Execute();
The schedule code (that work perfect becouse the BP execute every 5 minutes):
var userConnection = (UserConnection)HttpContext.Current.Session["UserConnection"];
string schedulerJobGroupName = "BGlobal";//- any name
string jobProcessName = "BGlobalSincronize"; //- the name of the process
string schedulerJobName = "Schedule"; //- any name
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(5));
AppScheduler.Instance.ScheduleJob(job, trigger);
return true;