You need to sign in to do that
Don't have an account?
SFDC@Chennai
How to add values in List
I have 10 inputtext values each i need to add in a single list.
My code(for eg)
Forecast_Revenue_Report__c frr = new Forecast_Revenue_Report__c();
List<Forecast_Revenue_Report__c> frList = new List<Forecast_Revenue_Report__c>();
frr.opp_id__c = opp.Id;
if(frr.Forecast_Amount__c != 0){
frr.Forecast_Month__c = this.month1;
frr.Forecast_Amount__c = this.amount1;
frList.add(frr);
frr= null;
System.debug('this is for ffff'+frr);
}else if(frr.Forecast_Amount__c != 0){
frr.Forecast_Month__c = this.month2;
frr.Forecast_Amount__c = this.amount2;
frList.add(frr);
frr= null;
}
In above coding i can get only values for 1st condition(month1 & amount 1), but i need to get like all the 10 values in loop.
Please help me for this!
My code(for eg)
Forecast_Revenue_Report__c frr = new Forecast_Revenue_Report__c();
List<Forecast_Revenue_Report__c> frList = new List<Forecast_Revenue_Report__c>();
frr.opp_id__c = opp.Id;
if(frr.Forecast_Amount__c != 0){
frr.Forecast_Month__c = this.month1;
frr.Forecast_Amount__c = this.amount1;
frList.add(frr);
frr= null;
System.debug('this is for ffff'+frr);
}else if(frr.Forecast_Amount__c != 0){
frr.Forecast_Month__c = this.month2;
frr.Forecast_Amount__c = this.amount2;
frList.add(frr);
frr= null;
}
In above coding i can get only values for 1st condition(month1 & amount 1), but i need to get like all the 10 values in loop.
Please help me for this!
As per my understanding, you just want to add 10 instances of "Forecast_Revenue_Report__c" object in the list. If you need this then you should do some changes in the code.
Please see the code below:
Please mark as best answer if it helps you.
Regards,
Grazitti Team,
www.grazitti.com
You can refer below code:
If this solves your problem, kindly mark it as the best answer.
Thanks,
Vatsal