You need to sign in to do that
Don't have an account?
Staci
Just copying the wrapper class from SFCD and changing the variable to match what I need I'm getting a unexpected token 'class' at line 70 column 11
Line 70
public class lntypes {
What is my problem?
unexpected token 'class'
public class wrapperClassController { // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value public class lntypes { public License_Numbers__c con {get; set;} public Boolean tobeEdited {get; set;} //This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false public lntypes(License_Numbers__c c) { con = c; tobeEdited = false; } } //Our collection of the class/wrapper objects cContact public List<lntypes> licList {get; set;} //This method uses a simple SOQL query to return a List of Contacts public List<lntypes> getLicenseList17() { if(licList == null) { licList = new List<lntypes>(); for(License_Numbers__c c:[select id, Name, X2016_Cost__c, Business_Unit__c, X2016_Starting_Amount__c, X2016_Subtotal__c, BMS_Code__c, License_Type__c, Monthly_Unit_Price__c, Org__c FROM License_Numbers__c ]) { // As each contact is processed we create a new cContact object and add it to the contactList licList.add(new lntypes(c)); } } return licList; } public PageReference saveRecord() { //We create a new list of Contacts that we be populated only with Contacts if they are selected List<License_Numbers__c> selectedTypes = new List<License_Numbers__c>(); //We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list for(lntypes cCon: getLicenseList17()) { if(cCon.tobeEdited == true) { selectedTypes.add(cCon.con); } } // Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc System.debug('These are the selected Contacts...'); for(License_Numbers__c con: selectedTypes) { system.debug(con); } contactList=null; // we need this line if we performed a write operation because getContacts gets a fresh list now return null; } }I have a wrapper class that is suppose to loop through some license records and then if one is edited to update it.
Just copying the wrapper class from SFCD and changing the variable to match what I need I'm getting a unexpected token 'class' at line 70 column 11
Line 70
public class lntypes {
What is my problem?
All Answers
check all { open and closed places and check are writing class in in side methode or some like that . best to copy past in developer counsole once .
If it is passible to show code .
Regards,
Harish.R
all {} are counted for and matching. Dev Console only shows unexpected token: 'class' as well
Not sure what you mean by "check are writing class inside method"
Can you please tell if the above code is the only code in your controller class? Because i can see only 51 lines and error message says that you are getting error on line 70.
also at line 46 in above code, you have not declared any variable named as contactList.
its only the wrapper class, I fixed line 46, that was left over from me copying SFDC's wrapper class. Still doesn't work
Here's is all the code
I had renamed lntypes to mylist because I got the same error with lntypes.
Error: Unknown property 'LicenseList.lntypes.Id'
I guess I don't understand what this is doing / connected to my vf page. is lntypes just a name? Am I supposed to refer to it in my vf page somewhere?
public class lntypes { public License_Numbers__c con {get; set;} public Boolean tobeEdited {get; set;}
Thank you so much for your patience and explanation! I've got it working now!!!
Can you please help me below test class its only cover 48%
Code
public with sharing class ProjectControler {
@AuraEnabled
public static List<ProjectControler.Projectserviceclaritywrapper> getprojectserviceclarity(Id projectid){
List<ProjectControler.Projectserviceclaritywrapper> projserverlist = new List<ProjectControler.Projectserviceclaritywrapper>();
Set<Id> projaccid = new Set<Id> ();
List<Project__c> projlist = new List<Project__c> ();
Set<String> fyear = new Set<String>();
projlist = [select id, Account__c,financial_year__c from Project__c where Id =:projectid ];
for (Project__c pro : projlist )
{
projaccid.add(pro.Account__c);
fyear.add(pro.financial_year__c);
}
System.debug('projaccid--'+projaccid+'--'+fyear);
List<Service_Clarity__c> sercl = [ select Id, Name, Account__r.Name, Document_Type__c, Documents_checked__c,Financial_Year__c from Service_Clarity__c where Account__r.Id IN :projaccid AND Financial_Year__c IN : fyear ];
System.debug('--sercl--'+sercl);
for(Service_Clarity__c sc :sercl)
{
ProjectControler.Projectserviceclaritywrapper projserwrapper = new ProjectControler.Projectserviceclaritywrapper();
projserwrapper.Name = sc.Name;
projserwrapper.DocumentType = sc.Document_Type__c;
projserwrapper.DocumentCheck = sc.Documents_checked__c;
projserwrapper.Account = sc.Account__r.Name;
projserwrapper.Financial = sc.Financial_Year__c;
projserverlist.add(projserwrapper);
}
return projserverlist;
}
public class Projectserviceclaritywrapper
{
@AuraEnabled public String Name {set; get;}
@AuraEnabled public String DocumentType { set; get; }
@AuraEnabled public String DocumentCheck { set; get; }
@AuraEnabled public String Account { set; get; }
@AuraEnabled public Id SerId { set; get; }
@AuraEnabled public String Financial { set; get; }
}
}
Test Class
@IsTest
public class TestProjectControler
{
public static testmethod void ProjectControler_Test()
{
string name='Test Account1';
string DocumentType='MSA';
String DocumentCheck= 'Yes';
String Account ='Test';
String Financial = '2014-15';
Account acc = new Account(name='Test Account1');
Insert acc;
Project__c proj1 = new Project__c(Account__c = acc.id, Financial_Year__c ='2014-15');
insert proj1;
Service_Clarity__c sc = new Service_Clarity__c (Project__c = proj1.id, Document_Type__c = 'MSA',Documents_Checked__c = 'Yes',Service_as_per_CPC__c = 'Test',
Eligible__c = 'Yes',Financial_Year__c='2014-15',Foreign_Client_Name__c ='Test',Remarks__c ='Test');
insert sc;
List<ProjectControler.projectserviceclaritywrapper> projwrapper = new List<ProjectControler.projectserviceclaritywrapper>();
Test.startTest();
ProjectControler.getprojectserviceclarity(proj1.id);
// ProjectControler.name('Test Account1');
Test.stopTest();
/*for(Service_Clarity__c scc:sc)
{
projwrapper.Name = scc.Name;
projwrapper.DocumentType = scc.Document_Type__c;
projwrapper.DocumentCheck = scc.Documents_checked__c;
projwrapper.Account = scc.Account__r.Name;
}*/
}
}