1. Script object OG.Job

    Article: AN0002174Updated:

    This object offers functions for reading job data.

    Script functions

    Name Description
    JobList GetAll() Function returns all the jobs.
    Job GetById(int id) Function returns job according to the input Id.
    void Save(Job job, JobRoleList roles) Function saves job including the job roles.
    Job GetByCode(string code) Function returns job according to the input code.
    int RunImmediatelyScript( string code, string name, string script) Function creates one-time job that is immediately started. There will be one step created in the job for starting the input script.
    int RunImmediatelyWorkflowSeq(string code, string name, int workflowSeqId) Function creates one-time job that is immediately started. There will be one step created in the job for starting the input workflow.
    int RunOnceScript(string code, string name, TimeSpan time, string script) Function creates one-time job that is will be started at the input time. There will be one step created in the job for starting the input script.
    int RunOnceWorkflowSeq(string code, string name, TimeSpan time, int workflowSeqId) Function creates one-time job that is will be started at the input time. There will be one step created in the job for starting the input workflow.
    void RunJob( string code) Function starts a job immediately.

    Functions Run... return Id of a newly created job. Code defined in these functions has to be uniques.

    When defining job for workflow execution only existence of workflow is checked. The system checks only at the time of workflow execution within the job execution, whether the workflow is enabled, is not deleted, workflow model is enabled etc.

    In order to execute a job with function RunJob the job has to be undeleted and enabled. Logged on user has to have also Administrator access rights or access right to Start the job.

    Object call

    OG.Job

    Creation of one-time job

    OG.Job.RunImmediatelyScript( 'code', 'name', 'script...');

    var newJobId = OG.Job.RunImmediatelyWorkflowSeq( 'code', 'name', 15);

×