public static string GetJobCreator(string sessionId, string JobID)
        {
            KTA_JobServices.JobIdentity JobIdentity = new KTA_JobServices.JobIdentity();
            JobIdentity.Id = JobID;
            KTA_JobServices.JobInfo          JobInfo = new KTA_JobServices.JobInfo();
            KTA_JobServices.JobHistoryFilter Filter  = new KTA_JobServices.JobHistoryFilter();
            var jobSvc = new KTA_JobServices.JobServiceClient();

            JobInfo = jobSvc.GetJobInfoAsync(sessionId, JobIdentity, Filter).GetAwaiter().GetResult();
            return(JobInfo.Creator.Name);
        }
        public static string CreateJob(string sessionId, string process_ID, long requestNumber, InputVariableCollection inputVarCollection = null)
        {
            // Set up the create new job method
            // Create a job service client so we call the methods in the job service e.g. createjob etc

            var jobSvc = new KTA_JobServices.JobServiceClient();

            // Set up variables for the CreateJob method. Create job requires sessionid, process identity, and process initialization variables (input variables)
            // CreateJob method returns the Job Identity (Job Id).
            var procIdentity = new KTA_JobServices.ProcessIdentity();
            var jobInit      = new KTA_JobServices.JobInitialization();

            // These variables are used for the return object (job identity)
            var jobIdentity = new KTA_JobServices.JobIdentity();

            // This is the process identity of the Loan Application API process. This Id was obtained by running a select * from the Business_Process table
            procIdentity.Id = process_ID;


            if (inputVarCollection == null)
            {
                inputVarCollection = new KTA_JobServices.InputVariableCollection();

                // Set up each inputvariable to job (process initialization variables)
                // Must use the ID of the variable in the process, not its display name
                KTA_JobServices.InputVariable id = new KTA_JobServices.InputVariable();
                id.Id    = "REQUESTID";
                id.Value = requestNumber;
                inputVarCollection.Add(id);
            }

            // Populate the InputVariables to the job
            jobInit.InputVariables = inputVarCollection;

            // Create the job, passing the session id, process identity and inputvariables. A job identity object containing the job id(string) is returned
            // from the method call
            jobIdentity = jobSvc.CreateJobAsync(sessionId, procIdentity, jobInit).GetAwaiter().GetResult();


            // Return the job id
            return(jobIdentity.Id);
        }