You need to sign in to do that
Don't have an account?
Neal Lightfeldt
Can't comment out Apex Class
I am adding "*/" at line 141 just above the last two brackets and I get this error: "Error: Compile Error: Expecting '}' but was: '*' at line 141 column 9"
Here's the code:
/*
* Crane Barksdale Sandbox
* Created : 8-NOV-2012
*
*
*/
public with sharing class CallPlanner_detailcontroller
{
/*
public string mutualpyramid{get;set;}
public string customer{get;set;}
public List<Event>lstEvent{get;set;}
public boolean isEvent{get;set;}
public final Call_Planner_2__c cplan;
public CallPlanner_detailcontroller(ApexPages.StandardController ctlr)
{
mutualpyramid = '';
customer= '';
customer = system.label.Customer_Needs; // image Link
mutualpyramid = system.label.Mutual_Pyramid; // image Link
isEvent = false;
lstEvent = new List<Event>();
try
{
//Get related events for this Call planner
integer iCount = [ select count()
from event
where whatid = :ctlr.getId()
];
if (iCount != 0)
{
isEvent = true;
}
else
{
this.cplan = (Call_Planner_2__c)ctlr.getRecord();
if (cplan.event__c == '' || cplan.event__c == null)
{
isEvent = false;
}
else
{
lstEvent = [ select id
from event
WHERE Id = :cplan.event__c
];
if (!lstEvent.isEmpty())
{
isEvent = true;
}
else
{
isEvent = false;
}
}
}
}
catch(Exception ex)
{
System.Debug(ex);
}
}
/**************************
Test Method
**************************/
static testMethod void myUnitTest1() {
//creating Account
Account objAcc = new Account();
objAcc.Name='test';
//objAcc.Market_Code__c='910-china';//commented for migration on 3rd may
//objAcc.District__c='413-Nancy Rapp';//commented for migration on 3rd may
insert objAcc;
//Creating Contact
Contact objcon= new Contact();
objcon.AccountId = objAcc.id;
objcon.LastName='test';
objcon.FirstName='test';
//objcon.Business_Phone_1__c='5555555555';
insert objcon;
//creating Opportunity
Opportunity objopp= new Opportunity();
objopp.AccountId =objAcc.id;
objopp.Name = 'test';
objopp.Type='simple';
objopp.StageName='Universe';
objopp.CloseDate=system.today();
//objopp.Product__c = 'test';
//objopp.Price_Target__c=578; //commented for migration frm sand to sand on 3rd may
insert objopp;
//creating Event
Event objevent = new Event();
//objevent.AccountId =objAcc.Id;
objevent.WhatId =objAcc.Id;
objevent.Subject ='Email';
objevent.StartDateTime=system.today();
objevent.EndDateTime=system.today();
insert objevent;
//creating Call_Planner
Call_Planner_2__c objclp = new Call_Planner_2__c();
objClp.Contact__c =objcon.Name;
objClp.Call_Objective__c = 'test';
objClp.Opportunity__c = objopp.id;
insert objClp;
ApexPages.StandardController c = new Apexpages.StandardController(objclp);
CallPlanner_detailcontroller objdetail = new CallPlanner_detailcontroller(c);
objClp.event__c = objevent.id;
update objClp;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
objevent.whatid = objClp.id;
update objevent;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
delete objevent;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
*/
}
}
Here's the code:
/*
* Crane Barksdale Sandbox
* Created : 8-NOV-2012
*
*
*/
public with sharing class CallPlanner_detailcontroller
{
/*
public string mutualpyramid{get;set;}
public string customer{get;set;}
public List<Event>lstEvent{get;set;}
public boolean isEvent{get;set;}
public final Call_Planner_2__c cplan;
public CallPlanner_detailcontroller(ApexPages.StandardController ctlr)
{
mutualpyramid = '';
customer= '';
customer = system.label.Customer_Needs; // image Link
mutualpyramid = system.label.Mutual_Pyramid; // image Link
isEvent = false;
lstEvent = new List<Event>();
try
{
//Get related events for this Call planner
integer iCount = [ select count()
from event
where whatid = :ctlr.getId()
];
if (iCount != 0)
{
isEvent = true;
}
else
{
this.cplan = (Call_Planner_2__c)ctlr.getRecord();
if (cplan.event__c == '' || cplan.event__c == null)
{
isEvent = false;
}
else
{
lstEvent = [ select id
from event
WHERE Id = :cplan.event__c
];
if (!lstEvent.isEmpty())
{
isEvent = true;
}
else
{
isEvent = false;
}
}
}
}
catch(Exception ex)
{
System.Debug(ex);
}
}
/**************************
Test Method
**************************/
static testMethod void myUnitTest1() {
//creating Account
Account objAcc = new Account();
objAcc.Name='test';
//objAcc.Market_Code__c='910-china';//commented for migration on 3rd may
//objAcc.District__c='413-Nancy Rapp';//commented for migration on 3rd may
insert objAcc;
//Creating Contact
Contact objcon= new Contact();
objcon.AccountId = objAcc.id;
objcon.LastName='test';
objcon.FirstName='test';
//objcon.Business_Phone_1__c='5555555555';
insert objcon;
//creating Opportunity
Opportunity objopp= new Opportunity();
objopp.AccountId =objAcc.id;
objopp.Name = 'test';
objopp.Type='simple';
objopp.StageName='Universe';
objopp.CloseDate=system.today();
//objopp.Product__c = 'test';
//objopp.Price_Target__c=578; //commented for migration frm sand to sand on 3rd may
insert objopp;
//creating Event
Event objevent = new Event();
//objevent.AccountId =objAcc.Id;
objevent.WhatId =objAcc.Id;
objevent.Subject ='Email';
objevent.StartDateTime=system.today();
objevent.EndDateTime=system.today();
insert objevent;
//creating Call_Planner
Call_Planner_2__c objclp = new Call_Planner_2__c();
objClp.Contact__c =objcon.Name;
objClp.Call_Objective__c = 'test';
objClp.Opportunity__c = objopp.id;
insert objClp;
ApexPages.StandardController c = new Apexpages.StandardController(objclp);
CallPlanner_detailcontroller objdetail = new CallPlanner_detailcontroller(c);
objClp.event__c = objevent.id;
update objClp;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
objevent.whatid = objClp.id;
update objevent;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
delete objevent;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
*/
}
}
check for my comments that starts with "->" this symbol
/*
* Crane Barksdale Sandbox
* Created : 8-NOV-2012
*
*
*/ --> this is perfect
public with sharing class CallPlanner_detailcontroller
{
/* --> you tried to comment from here. The above is the class and it is having open parenthesis so it needs to have a closed one as well.
public string mutualpyramid{get;set;}
public string customer{get;set;}
public List<Event>lstEvent{get;set;}
public boolean isEvent{get;set;}
public final Call_Planner_2__c cplan;
public CallPlanner_detailcontroller(ApexPages.StandardController ctlr)
{
mutualpyramid = '';
customer= '';
customer = system.label.Customer_Needs; // image Link
mutualpyramid = system.label.Mutual_Pyramid; // image Link
isEvent = false;
lstEvent = new List<Event>();
try
{
//Get related events for this Call planner
integer iCount = [ select count()
from event
where whatid = :ctlr.getId()
];
if (iCount != 0)
{
isEvent = true;
}
else
{
this.cplan = (Call_Planner_2__c)ctlr.getRecord();
if (cplan.event__c == '' || cplan.event__c == null)
{
isEvent = false;
}
else
{
lstEvent = [ select id
from event
WHERE Id = :cplan.event__c
];
if (!lstEvent.isEmpty())
{
isEvent = true;
}
else
{
isEvent = false;
}
}
}
}
catch(Exception ex)
{
System.Debug(ex);
}
}
*/
--> Here you have multi-line comment so the system will think that you are trying to close up to here.so what you need to do is like add the closing */ multi-line comment
/**************************
Test Method
**************************/
--> Again from here you need to start commenting so it will be
/*
static testMethod void myUnitTest1() {
//creating Account
Account objAcc = new Account();
objAcc.Name='test';
//objAcc.Market_Code__c='910-china';//commented for migration on 3rd may
//objAcc.District__c='413-Nancy Rapp';//commented for migration on 3rd may
insert objAcc;
//Creating Contact
Contact objcon= new Contact();
objcon.AccountId = objAcc.id;
objcon.LastName='test';
objcon.FirstName='test';
//objcon.Business_Phone_1__c='5555555555';
insert objcon;
//creating Opportunity
Opportunity objopp= new Opportunity();
objopp.AccountId =objAcc.id;
objopp.Name = 'test';
objopp.Type='simple';
objopp.StageName='Universe';
objopp.CloseDate=system.today();
//objopp.Product__c = 'test';
//objopp.Price_Target__c=578; //commented for migration frm sand to sand on 3rd may
insert objopp;
//creating Event
Event objevent = new Event();
//objevent.AccountId =objAcc.Id;
objevent.WhatId =objAcc.Id;
objevent.Subject ='Email';
objevent.StartDateTime=system.today();
objevent.EndDateTime=system.today();
insert objevent;
//creating Call_Planner
Call_Planner_2__c objclp = new Call_Planner_2__c();
objClp.Contact__c =objcon.Name;
objClp.Call_Objective__c = 'test';
objClp.Opportunity__c = objopp.id;
insert objClp;
ApexPages.StandardController c = new Apexpages.StandardController(objclp);
CallPlanner_detailcontroller objdetail = new CallPlanner_detailcontroller(c);
objClp.event__c = objevent.id;
update objClp;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
objevent.whatid = objClp.id;
update objevent;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
delete objevent;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
} --> This one belongs to the method so we need to comment on this as well you need to change the line 140 comment ending statement to below of this line.
*/
}
now save your class. That would resolve your issue.
All Answers
Try this
/*
* Crane Barksdale Sandbox
* Created : 8-NOV-2012
*
*
*/
public with sharing class CallPlanner_detailcontroller
{
/*
public string mutualpyramid{get;set;}
public string customer{get;set;}
public List<Event>lstEvent{get;set;}
public boolean isEvent{get;set;}
public final Call_Planner_2__c cplan;
public CallPlanner_detailcontroller(ApexPages.StandardController ctlr)
{
mutualpyramid = '';
customer= '';
customer = system.label.Customer_Needs; // image Link
mutualpyramid = system.label.Mutual_Pyramid; // image Link
isEvent = false;
lstEvent = new List<Event>();
try
{
//Get related events for this Call planner
integer iCount = [ select count()
from event
where whatid = :ctlr.getId()
];
if (iCount != 0)
{
isEvent = true;
}
else
{
this.cplan = (Call_Planner_2__c)ctlr.getRecord();
if (cplan.event__c == '' || cplan.event__c == null)
{
isEvent = false;
}
else
{
lstEvent = [ select id
from event
WHERE Id = :cplan.event__c
];
if (!lstEvent.isEmpty())
{
isEvent = true;
}
else
{
isEvent = false;
}
}
}
}
catch(Exception ex)
{
System.Debug(ex);
}
}
*/
/**************************
Test Method
**************************/
/*
static testMethod void myUnitTest1() {
//creating Account
Account objAcc = new Account();
objAcc.Name='test';
//objAcc.Market_Code__c='910-china';//commented for migration on 3rd may
//objAcc.District__c='413-Nancy Rapp';//commented for migration on 3rd may
insert objAcc;
//Creating Contact
Contact objcon= new Contact();
objcon.AccountId = objAcc.id;
objcon.LastName='test';
objcon.FirstName='test';
//objcon.Business_Phone_1__c='5555555555';
insert objcon;
//creating Opportunity
Opportunity objopp= new Opportunity();
objopp.AccountId =objAcc.id;
objopp.Name = 'test';
objopp.Type='simple';
objopp.StageName='Universe';
objopp.CloseDate=system.today();
//objopp.Product__c = 'test';
//objopp.Price_Target__c=578; //commented for migration frm sand to sand on 3rd may
insert objopp;
//creating Event
Event objevent = new Event();
//objevent.AccountId =objAcc.Id;
objevent.WhatId =objAcc.Id;
objevent.Subject ='Email';
objevent.StartDateTime=system.today();
objevent.EndDateTime=system.today();
insert objevent;
//creating Call_Planner
Call_Planner_2__c objclp = new Call_Planner_2__c();
objClp.Contact__c =objcon.Name;
objClp.Call_Objective__c = 'test';
objClp.Opportunity__c = objopp.id;
insert objClp;
ApexPages.StandardController c = new Apexpages.StandardController(objclp);
CallPlanner_detailcontroller objdetail = new CallPlanner_detailcontroller(c);
objClp.event__c = objevent.id;
update objClp;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
objevent.whatid = objClp.id;
update objevent;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
delete objevent;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
}
*/
}
Explanation: If you open the class then it is not properly commented. If you are using trying to use multi-line comments then you need brake it where there is a multi-line comment already and you need to comment again.
Line 142 closing parenthesis is related to the method. and it is not closed.
I hope this helps.
check for my comments that starts with "->" this symbol
/*
* Crane Barksdale Sandbox
* Created : 8-NOV-2012
*
*
*/ --> this is perfect
public with sharing class CallPlanner_detailcontroller
{
/* --> you tried to comment from here. The above is the class and it is having open parenthesis so it needs to have a closed one as well.
public string mutualpyramid{get;set;}
public string customer{get;set;}
public List<Event>lstEvent{get;set;}
public boolean isEvent{get;set;}
public final Call_Planner_2__c cplan;
public CallPlanner_detailcontroller(ApexPages.StandardController ctlr)
{
mutualpyramid = '';
customer= '';
customer = system.label.Customer_Needs; // image Link
mutualpyramid = system.label.Mutual_Pyramid; // image Link
isEvent = false;
lstEvent = new List<Event>();
try
{
//Get related events for this Call planner
integer iCount = [ select count()
from event
where whatid = :ctlr.getId()
];
if (iCount != 0)
{
isEvent = true;
}
else
{
this.cplan = (Call_Planner_2__c)ctlr.getRecord();
if (cplan.event__c == '' || cplan.event__c == null)
{
isEvent = false;
}
else
{
lstEvent = [ select id
from event
WHERE Id = :cplan.event__c
];
if (!lstEvent.isEmpty())
{
isEvent = true;
}
else
{
isEvent = false;
}
}
}
}
catch(Exception ex)
{
System.Debug(ex);
}
}
*/
--> Here you have multi-line comment so the system will think that you are trying to close up to here.so what you need to do is like add the closing */ multi-line comment
/**************************
Test Method
**************************/
--> Again from here you need to start commenting so it will be
/*
static testMethod void myUnitTest1() {
//creating Account
Account objAcc = new Account();
objAcc.Name='test';
//objAcc.Market_Code__c='910-china';//commented for migration on 3rd may
//objAcc.District__c='413-Nancy Rapp';//commented for migration on 3rd may
insert objAcc;
//Creating Contact
Contact objcon= new Contact();
objcon.AccountId = objAcc.id;
objcon.LastName='test';
objcon.FirstName='test';
//objcon.Business_Phone_1__c='5555555555';
insert objcon;
//creating Opportunity
Opportunity objopp= new Opportunity();
objopp.AccountId =objAcc.id;
objopp.Name = 'test';
objopp.Type='simple';
objopp.StageName='Universe';
objopp.CloseDate=system.today();
//objopp.Product__c = 'test';
//objopp.Price_Target__c=578; //commented for migration frm sand to sand on 3rd may
insert objopp;
//creating Event
Event objevent = new Event();
//objevent.AccountId =objAcc.Id;
objevent.WhatId =objAcc.Id;
objevent.Subject ='Email';
objevent.StartDateTime=system.today();
objevent.EndDateTime=system.today();
insert objevent;
//creating Call_Planner
Call_Planner_2__c objclp = new Call_Planner_2__c();
objClp.Contact__c =objcon.Name;
objClp.Call_Objective__c = 'test';
objClp.Opportunity__c = objopp.id;
insert objClp;
ApexPages.StandardController c = new Apexpages.StandardController(objclp);
CallPlanner_detailcontroller objdetail = new CallPlanner_detailcontroller(c);
objClp.event__c = objevent.id;
update objClp;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
objevent.whatid = objClp.id;
update objevent;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
delete objevent;
c = new Apexpages.StandardController(objclp);
objdetail = new CallPlanner_detailcontroller(c);
} --> This one belongs to the method so we need to comment on this as well you need to change the line 140 comment ending statement to below of this line.
*/
}
now save your class. That would resolve your issue.
Can you please close the case.
Thanks.