You need to sign in to do that
Don't have an account?
vanessa veron
Using Visualforce value of the future
hello...
is it possible to use a informed value in a Visualforce page in future?
For example I inform an email and I will use this email to JOB schedule ....
Are you doing this?
How do I?
Thank you
is it possible to use a informed value in a Visualforce page in future?
For example I inform an email and I will use this email to JOB schedule ....
Are you doing this?
How do I?
Thank you
global class ASchedTeste implements System.Schedulable { public String str{get;set;} public String mail{get;set;} public String nomJob{get;set;} global void execute(SchedulableContext sc) { newPublier(); } //Cria bem o job na hora informada 0 28 15 * * ? public void schedulejob(){ String NomJobSchedulable = nomJob; ASchedTeste p = new ASchedTeste(); String sch = str; system.schedule(NomJobSchedulable , sch, p); } public void newPublier(){ List<case> acclist = [Select casenumber,subject, accountid from case limit 10]; string header = 'Id, Subject,Account, '+'\n'; string finalstr = header ; for(case a: acclist) { string recordString = a.casenumber + ',' + a.subject+ ',' + a.accountid +'\n'; finalstr = finalstr + recordString; } Messaging.EmailFileAttachment csvAttc = new Messaging.EmailFileAttachment(); blob csvBlob = Blob.valueOf(finalstr); string csvname= 'cases.csv'; csvAttc.setFileName(csvname); csvAttc.setBody(csvBlob); Messaging.SingleEmailMessage email =new Messaging.SingleEmailMessage(); String[] toAddresses = new list<string> {mail}; String subject = 'Report CSV'; email.setSubject(subject); email.setToAddresses( toAddresses ); email.setPlainTextBody('Informations HERE'); email.setFileAttachments(new Messaging.EmailFileAttachment[]{csvAttc}); Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); } } -------------------------------------------------------------------------------------------------------------------- <apex:page controller="ASchedTeste"> <apex:form > <apex:PageBlock > :::::::::: TEST TEST TEST :::::::::: <br /><br /> Mail..........: <apex:inputText styleClass="classeMail" value="{!mail}"/><br /><br /> Nom Job.......: <apex:inputText styleClass="classeMail" value="{!nomJob}"/><br /><br /> Plan.....:<apex:inputText value="{!str}" /> <apex:commandButton value="Schedule" action="{!schedulejob}" /> </apex:PageBlock> </apex:form> </apex:page>
Try to pass this parameter through constructor and store them in global instance property.
So, change mail property directive from public to global
public String mail{get;set;} => global String mail{get;set;}
Then try to change method
public void schedulejob( String email ){
String NomJobSchedulable = nomJob;
ASchedTeste p = new ASchedTeste( email );
String sch = str;
system.schedule(NomJobSchedulable , sch, p);
}
global ASchedTeste( String email ){
mail = email;
}
Hope this would help
All Answers
As far as I understand, you are trying to use email selected on visualforce page inside schedule job execute method.
I think you could try to pass this parameter through constructor and store them in global instance property.
And how do I do it?
THANK YOU
Try to pass this parameter through constructor and store them in global instance property.
So, change mail property directive from public to global
public String mail{get;set;} => global String mail{get;set;}
Then try to change method
public void schedulejob( String email ){
String NomJobSchedulable = nomJob;
ASchedTeste p = new ASchedTeste( email );
String sch = str;
system.schedule(NomJobSchedulable , sch, p);
}
global ASchedTeste( String email ){
mail = email;
}
Hope this would help
thank you so much...
Thank you so much....
Have a nice weekend!
I'm glad this helped to you.
I provided the same answer to other guys here http://salesforce.stackexchange.com/a/26928/3716 but nobody even voted my answer there