You need to sign in to do that
Don't have an account?
SalesForce Dummy
Issues with system.schedule parameters
I'm attempting to create a scheduled job programatically using system.schedule but I'm running into issues. I'm trying to pass the parameters "Schedule Name", "Schedule Time" and "Class Name" from strings from an object in SFDC. The problem is I don't know exactly how to change a string into an object.
This is what I have so far:
//Iterate through list of job descriptions
For(Manage_ScheduleJobs__c addJobs : schJobs)
{
//Get class name and job name
string ClassName = addJobs.Class_Name__c;
string jobName = addJobs.Job_Name__c;
//Attempt to change string to class
object classDev = ClassName;
//Get the id of the new scheduled job
Id jobId = System.schedule(jobName, '0 0 0 * * ?', new classDev());
}
What am I doing wrong?
Thanks.
can ClassName be passed as a paremeter to the classdev object ? the problem is that you cant assign an object the value of a string. is there a specific variable of classdev that can hold the value of ClassName ? or perhaps casting the string as an object could work, but i have my doubts. the line of code would have to be more like this:
classDev.[*/Specific Element Here /*] = ClassName
All Answers
can ClassName be passed as a paremeter to the classdev object ? the problem is that you cant assign an object the value of a string. is there a specific variable of classdev that can hold the value of ClassName ? or perhaps casting the string as an object could work, but i have my doubts. the line of code would have to be more like this:
classDev.[*/Specific Element Here /*] = ClassName
OK. I'm at a loss. What I'm trying to do is allow our admins to schedule our Apex classes via a custom object. They input the necessary parameters like time, class name, job name, etc. I then created a new Apex class that pulls the values from the custom object to construct the systems.schedule method parameters. Is there any way to take a string from the custom object and implement a class based on the value of the string?
I found the answer and it's a resounding no. However, it is on IdeaExchange so, hopefully, it will be implemented soon.
http://sites.force.com/ideaexchange/apex/ideaview?id=08730000000J5QfAAK
Ahhh, i see. Forgive me i think i misunderstood the problem.