How do I implement "Run Job - With Options" using c# - VisualCron - Forum

Community forum

edfscott
2016-02-29T17:31:14Z
I want to implement the "Run Job - With Options" using the c# client api. I don't see a way to do this, what I am missing? The only way I can update a job variable value is by calling server.Jobs.JobVariables.AddUppdate. This updates the variable on the job forever, not just for this specific instance / run. The client UI can do this so I am hopefully that functionality is exposed in the underlying API and I am just overlooking something.
Support
2016-02-29T17:42:00Z
Here is the code we use in the Client:


JobRunResultClass jrc = ConnectionAPI.CurrentServer.Jobs.Run(strJobId, chkUseJobConditions.Checked, false, rdoFromTask.Checked, strFromTaskId, rdoToTask.Checked, strToTaskId, UcJobVariables1.GetJobVariables, chkUpdateJobVariables.Checked);

Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2016-02-29T17:44:48Z
By the way, which exact version of the Server do you currently use?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
edfscott
2016-02-29T17:48:40Z
Version 8.0.2, we just installed it.

The piece I am missing is this: UcJobVariables1.GetJobVariables

I can't see how I build that list of job variables? I can't find a way to set a job variable value as they are encrypted values I there is no call to encrypt a string that I can see.
Support
2016-02-29T18:07:24Z
What do you want to do? Use an existing Variable, use a new Variable, update an existing Variable?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
edfscott
2016-02-29T18:59:54Z
I want to use an existing variable and change the value of it. But I just want to change the value for the specific run. Say I have a job variable called FileDestination, the job has it set to "\\server\prod\". I want to change FileDestination to be "\\server\other_prod" for the current job run only. I don't want to Job variable to be updated for subsequent jobs.
Support
2016-02-29T21:29:47Z
The idea is that you can create any list of Job Variables. To set a value of a Job Variable you set the ValueObject property. This is an encrypted value so you either use:

Client.Encrypt(..


or

Server.Encrypt(..


JobVariable jv = new JobVariable();
jv.Key = "Test";
jv.ValueObject = ClientObj.Encrypt("myValue");

Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
edfscott
2016-02-29T21:40:28Z
Thank you, that is the piece I was missing. Works perfectly now.
Scroll to Top