• Arun Kharb
  • NEWBIE
  • 15 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 2
    Questions
  • 5
    Replies
Hi All,
I have a page in which I am rendering various fields of different datatype based on some condition.

User-added image 
Here is the controller code for this.
public Map<String,String> finalselectedvalues{get;set;}
public map<String,List<SelectOption>> dataarraymap{get;set;}
public List<Objectname> lstProducts{get;set;}

public demoController() {

 finalselectedvalues=new Map<String,String>();
 dataarraymap=new Map<String,List<SelectOption>>();
SelectedValues=new Map<String,String>();
lstProducts=[//query to get values];
 lst.add(new SelectOption('Default','----none---- '));
 dataarraymap.put(String.valueof(obj.name),lst);

for(objectname obj:lstProducts)
{
     if(obj.Attribute_Type__c=='Heading' || obj.Attribute_Type__c=='State Coverage') //many more condition goes here
            {  
                 List<selectOption> lst=new List<selectOption>();
                 lst.add(new SelectOption('Default','----none---- '));
                 dataarraymap.put(String.valueof(obj.name),lst);
           }
        finalselectedvalues.put(obj.name,' ');
}
}
and in vf page i am rendering different type of input fields like this:
<apex:repeat id="dvProducts" value="{!lstProducts}" var="product">
  <apex:outputPanel rendered="{!IF(product.Attribute_Type__c=='State Coverage',TRUE,FALSE)}" >
     <apex:selectList value="{!finalselectedvalues[product.name]}" size="3"  multiselect="true" > 
      <apex:selectOptions value="{!dataarraymap[product.name]}" /> 
     </apex:selectList>
  </apex:outputPanel> 
</apex:repeat>
 
Now, Whenever I am trying to submit the page without filling up any value in selectlist, radiobutton and many more types excluding text Input Type. I am getting following error:
 
Map key {{keyvalue}} not found in map 

Error is in expression '{!finalselectedvalues[key]}'

and If I fill out all the values like select something in select list and check all radio buttons then No Error is thrown. I am not even Using  REQUIRED Attribute here. 
 
Any Help would be very much appreciated.

 
I am having two queues "GOLD" and "Platinum" which are having separate group of users.
Now I wanted to assign 40% of the total leads to GOLD queue and rest 60% of the total to PLATINUM queue which all are coming from web-to-lead.

For eg. Suppose if we are getting 10 leads at a time through web-to-lead then assign 4 to GOLD queue and 6 to PLATINUM queue.

Can someone help me here?
Hi All,
I have a page in which I am rendering various fields of different datatype based on some condition.

User-added image 
Here is the controller code for this.
public Map<String,String> finalselectedvalues{get;set;}
public map<String,List<SelectOption>> dataarraymap{get;set;}
public List<Objectname> lstProducts{get;set;}

public demoController() {

 finalselectedvalues=new Map<String,String>();
 dataarraymap=new Map<String,List<SelectOption>>();
SelectedValues=new Map<String,String>();
lstProducts=[//query to get values];
 lst.add(new SelectOption('Default','----none---- '));
 dataarraymap.put(String.valueof(obj.name),lst);

for(objectname obj:lstProducts)
{
     if(obj.Attribute_Type__c=='Heading' || obj.Attribute_Type__c=='State Coverage') //many more condition goes here
            {  
                 List<selectOption> lst=new List<selectOption>();
                 lst.add(new SelectOption('Default','----none---- '));
                 dataarraymap.put(String.valueof(obj.name),lst);
           }
        finalselectedvalues.put(obj.name,' ');
}
}
and in vf page i am rendering different type of input fields like this:
<apex:repeat id="dvProducts" value="{!lstProducts}" var="product">
  <apex:outputPanel rendered="{!IF(product.Attribute_Type__c=='State Coverage',TRUE,FALSE)}" >
     <apex:selectList value="{!finalselectedvalues[product.name]}" size="3"  multiselect="true" > 
      <apex:selectOptions value="{!dataarraymap[product.name]}" /> 
     </apex:selectList>
  </apex:outputPanel> 
</apex:repeat>
 
Now, Whenever I am trying to submit the page without filling up any value in selectlist, radiobutton and many more types excluding text Input Type. I am getting following error:
 
Map key {{keyvalue}} not found in map 

Error is in expression '{!finalselectedvalues[key]}'

and If I fill out all the values like select something in select list and check all radio buttons then No Error is thrown. I am not even Using  REQUIRED Attribute here. 
 
Any Help would be very much appreciated.

 
Hello,

Please review the code below, I don't get why its not passing 100%

Trigger:
 
trigger CreateFlightItinerary on Opportunity (after update) {    
List<Itinerary__c> fi = new List<Itinerary__c>();
    for (Opportunity a: Trigger.New)
         if (a.fi_automation_check__c == TRUE){
                 <b>fi.add (new Itinerary__c(</b>
                     Flight_Booking__c = a.Id,
					 Stop_1__c = a.Stop1_ID__c,
					 Flight_Crew_1__c = a.CrewM_1_ID__c
				));
         }
   insert fi;
}

Test class:
 
@isTest
private class testCreateFlightItinerary{
    static TestMethod void myTestClass()
    {
    	Account a = new Account();
	    a.Name = 'TestName';
	    a.Phone = '5512991224391';
        insert a;
    	
    	Opportunity o = new Opportunity();
 		o.Name = 'TestName';
		o.AccountID = a.Id;
		o.closedate = system.today();
		o.stagename = 'Sample Quote';
		o.Aircraft_Type__c = 'King Air';
		o.fi_automation_check__c=false;
		insert o; 
		
		o.fi_automation_check__c=true;
		update o;
    }
}

Thanks!
I am having two queues "GOLD" and "Platinum" which are having separate group of users.
Now I wanted to assign 40% of the total leads to GOLD queue and rest 60% of the total to PLATINUM queue which all are coming from web-to-lead.

For eg. Suppose if we are getting 10 leads at a time through web-to-lead then assign 4 to GOLD queue and 6 to PLATINUM queue.

Can someone help me here?

Salesforce introduced allowing you to assign multiple users to tasks via roles/groups etc. Is there a way to do this via Apex as I can't find anything in the spec about it...

 

  • January 04, 2012
  • Like
  • 0
Hi Guys,
  1. Until the Spring 15 release, Maps and Sets are Unordered Collections. So the returned order will be random.
  2. But beginning from Summer 15 release onwards, Maps and Set order is predictable. The order will be same that what you put from the beginning to end.
Example:
Map<String, String> orderedMap = new Map<String, String>();
orderedMap.put('Good', 'This is so good');
orderedMap.put('Bad', 'This is so bad');
System.debug(orderedMap);

If you run the above code snippet in Developer console you will get the returned order as below,

Until Spring 15 Release:

{Bad=This is so bad, Good=This is so good}

From Summer 15 Release:

{Good=This is so good, Bad=This is so bad}

This changes is not the API level, this is Schema level change. If anyone relying on the Map or Set order in your codes, change it as soon. 

Thanks.