Updating a Job Variable via C# - VisualCron - Forum

Community forum

Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
Offline david.fisher  
#1 Posted : Friday, March 24, 2017 4:30:14 PM(UTC)
david.fisher

Rank: Paid support

Joined: 8/22/2016(UTC)
Posts: 3
United States
Location: CT

Was thanked: 1 time(s) in 1 post(s)
I'd like to 'insert' a variable into an email from an external application, so I created a job variable {JOB(Active|Variable|specialmessage)}

I'd like to update it programmatically before running the job, tried this:
using (Client c = new Client())
{
try
{
using (Server s = c.Connect(conn, true))
{
var job = s.Jobs.GetJobByName(jobName);
s.Jobs.JobVariables.AddUpdate("{JOB(Active|ID)}", "specialmessage", "let's see if this works");
JobRunResultClass jrsc = s.Jobs.Run(job.Id, false, false, false, string.Empty, false, string.Empty, null, false);


but that doesn't seem to do the trick. Am I missing something?

Edited by moderator Monday, March 27, 2017 10:09:17 AM(UTC)  | Reason: Not specified

Offline david.fisher  
#2 Posted : Friday, March 24, 2017 4:42:54 PM(UTC)
david.fisher

Rank: Paid support

Joined: 8/22/2016(UTC)
Posts: 3
United States
Location: CT

Was thanked: 1 time(s) in 1 post(s)
nevermind, i found an old post that helped:
var job = s.Jobs.GetJobByName(jobName);
JobVariableClass jvc = new JobVariableClass()
{
Key = "specialmessage",
ValueObject = c.Encrypt("myValue")
};

JobRunResultClass jrsc = s.Jobs.Run(job.Id, false, true, false, string.Empty, false, string.Empty, new List<JobVariableClass>() { jvc }, true);
thanks 1 user thanked david.fisher for this useful post.
Support on 3/27/2017(UTC)
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Scroll to Top