You need to sign in to do that
Don't have an account?
Having a Save Error for an Apex Class
I have created the following code. When I try to save I get "Save Error: expecting a right parentheses, found 'true'"
}
public class CloneProtocalArmActivities{
private Protocol_Arm__c contactClone = null;
private final Protocol_Arm__c contactBase = null;
public CloneProtocalArmActivities(ApexPages.StandardController controller) {
protocolarmBase =
[SELECT Id, Protocol__c,
(SELECT Subject, WhoId, WhatId, ActivityDate, Status FROM Tasks)
FROMProtocol_Arm__c
WHERE Id = :ApexPages.currentPage().getParameters().get('Id')];
}
public PageReference cloneProtocolArm() {
protocolarmClone = protocolarmBase.clone(
false, // preserve ID
true, // deep clone (all fields and relationships)
false, // preserve readonly timestamps
false // preserve autonumbers
);
insert protocolarmClone;
if (!protocolarmBase.Tasks.isEmpty()) {
List<Task> tasks = protocolBase.Tasks.deepClone(
false, // preserve ID
false, // preserve readonly timestamps
false // preserve autonumbers
);
for (Task t : tasks) {
t.WhoId = protocolarmClone.Id;
}
insert tasks;
}
}
PageReference newProtocolArmPage = new ApexPages.StandardController(protocolarmClone).view();
newProtocolArmPage.setRedirect(true);
return newProtocolArmPage;
}
Please help.
This should save it for you.
All Answers
I think it is because there is an extra '}' before 'PageReference newProtocolArmPage'
Please remove that and check.
Regards,
Pankaj Raijade
This should save it for you.