You need to sign in to do that
Don't have an account?
Tim Jones 71
In a Batchable Class Update the parent object form one of the scope records
Afternoon evryone,
Administrator making the move to developer so be easy on a rookie.
I have a class the implements Database.Batchable
Start
In the start I am setting my scope with a SOQL query that gets all the members of a campaign where a logic check box is not set, scope
Execute
Now I am looping through those records and creating a new record in a form processor object that will be exposed in a public community for tokenized email responces
Loop through for cm :scope
Create a new form processeor record for each cm and add to list
If the record count of list is >0 insert the list
Finish
Sending an email to the user letting them know the batch completed.
Problem
How can I check the logic box on the campaign after the member records are sent to batch
Code available if needed
Administrator making the move to developer so be easy on a rookie.
I have a class the implements Database.Batchable
Start
In the start I am setting my scope with a SOQL query that gets all the members of a campaign where a logic check box is not set, scope
Execute
Now I am looping through those records and creating a new record in a form processor object that will be exposed in a public community for tokenized email responces
Loop through for cm :scope
Create a new form processeor record for each cm and add to list
If the record count of list is >0 insert the list
Finish
Sending an email to the user letting them know the batch completed.
Problem
How can I check the logic box on the campaign after the member records are sent to batch
Code available if needed
Here is how you will check if an email is sent or not
Posting a sample code here. You need to move the select checkbox logic to the finish method
I did not explain it well. I am including my code to assist.
The problem I cannot solve, is this.
This batch executes on contact members of a campaign. It is triggered by a logic bolean on the campign record.
When the box is checked but the batch processed date is null, then the batch runs.
When the batch is finished, I need to populate the processed date on the campaign.
I am successfully creating the batch, and sending the email when it is done.
What I am not able to do is populate the campaign record field processed date.
So what it tried was to populate a string cId with the campaign id from the scope. That way in the finish, I could do an updated on that record
But whenever I try to extract the CampaignId from scope and assign it to Cid I get an error saying invalid list error.
Once I get cId populated, I would just do a lookup on the campaign record, and update the processed date.
That value is stored in loop variable cm.CampaignId or in the scope CampaignId field
this to the Finish Method