function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ASFASF 

Can any one help how to call the methods with paramerters to another method.

public static   List<Level2sClass> Level2List;
public static List<Level2sClass> getList2Details(Level1s__c lvl)
{
// Level1s__c lvl;

Level2List= new List<Level2sClass>();
if(ApexPages.currentPage().getParameters().get('S') == null)
{
lstLevel2 = [Select id,name,Level1_Name__c,Level1__c, (select id,account__r.name from Level2s__r where account__c =:accid ) from Level2s__c where Level1__c =:lvl.id order by id];

}else
{
lstLevel2 = [Select id,name,Level1_Name__c,Level1__c, (select id,account__r.name from Level2s__r where account__c =:accid ),(select id from Level3s__r limit 1) from Level2s__c where Level1__c =:lvl.id and id in (Select cLevel2__c from Level2__c where Account__c=:accid) order by id];

}
for(level2s__c s: lstLevel2)
{
Level2List.add(new Level2sClass(s));
}
lvl1 = lvl;

return Level2List;
}

 

 

 

public void Save()
{

///////////// LEVEL2 /////////////////////

List<level2s__c> selectedLevel2= new List<level2s__c>();




for(Level2sClass cCon : getList2Details(Level1s__c lvl))          // here i call the method it passing a null value.
{
system.debug('@@@@@@@@@@@@@Level1@@@$$$$$$'+le1.id);
if(cCon.selected == true)
{
selectedLevel2.add(cCon.lev2);
}
}
}


Level2__c[] levl2= [Select Id from Level2__c where Account__c=: ApexPages.currentPage().getParameters().get('id')];
delete levl2;
if(selectedLevel2 != null)
{
for(level2s__c con : selectedLevel2)
{
//system.debug('CCCCCCCCCC:'+con+'\n');
string acctid =ApexPages.currentPage().getParameters().get('id');
List<Level2__c> lvl2obj= new Level2__c[0];
lvl2obj.add(new Level2__c(Name='Level2',Account__c=acctid,cLevel2__c=con.id));
insert lvl2obj;

}
}

 

 

 

how to call the method with parameters???????????????

bob_buzzardbob_buzzard

You've called the method with a parameter - it just happened to be null.  Can you clarify what parmeters you are wishing to pass?

ASFASF

I have Two Objects Like Level1s__c and Level2s__c.  Level2 have relationship with Level1.  i want to pass Level1s__c  details in that parameters