• CAfromCA
  • NEWBIE
  • 5 Points
  • Member since 2010
  • Developer/Analyst/Admin/Trainer/Whatever


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies

Before I ran off and created an IdeaExchange post I thought I'd run an idea past the great minds here and make sure I'm not overlooking obvious work-arounds!

 

I'd really like to create some reusable extensions to Apex functionality, such as a multimap implementation, where the same code could work with arbitrary objects while maintaining good type safety for each specific instance.

 

With Java-style generics, I could, for example, declare a class like:

 

public with sharing class MultiMap<K,V> { foo... }

 

The "<K,V>" would be the variable types used for the multimap's key and value data, perhaps implemented as Map<K,Integer> and List<List<V>>, respectively (map ties keys to the index of the outer list).

 

Instantiating a multimap would be as easy as:

 

MultiMap<String,Contact> myVar = new MultiMap<String,Contact>{};

 
Because that instance uses concrete object types (String and Contact), all data passed to or returned from the multimap would be automatically checked (and cast, if appropriate).
 
The only alternative I can see would be defining something like:
 
public with sharing class MultiMap {
  private Schema.SObjectType keyType { get; set; }
  private Schema.SObjectType valueType { get; set; }
  MultiMap(Schema.SObjectType K, Schema.SObjectType V) {keyType = K; valueType = V;}
  foo...
}
 
... and then instantiating it like:
 
MultiMap myVar = new MultiMap( String.sObjectType, Contact.sObjectType );
 
If anyone can think of a way to do something like this in a type-safe manner without resorting to a ton of assertions, I'd love to hear it.
 
If not (and assuming the consensus reply is not "Andy, you are an idiot"), I'll file this in IdeaExchange.

Hi all,

 

i hope someone could help me. Is it possibile to send Report and Dashboards to Chatter Free user by email?

 

Than you,

 

Silvio

  • November 07, 2011
  • Like
  • 0

I came across another post similar to this but there was no solution posted, so I am going to attempt to raise the issue again - I have a custom UI built in VisualForce, and I've noticed that any lookup fields that have Lookup Filters established do not display filtered search results - they search window shows results that are outside of the filter criteria.  Yet when an option is selected that does not meet the filter criteria, the following error is generated:

 


Insert failed. First exception on row 0; first error: FIELD_FILTER_VALIDATION_EXCEPTION, Value does not exist or does not match filter criteria.: [EXAMPLE_FIELD__c]

 

 

I have not been able to find any documentation related to forcing a VF component to respect the Lookup Filter behavior.  If I create a new record for the object in the standard UI, the lookup filter works as it should with regard to the search results.  How do I reconcile this discrepancy in functionality between VisualForce and the standard UI?

 

 

Thanks,

 

Mike


Hey guys,

 

needed a way to convert from a 15 digit ID to an 18 digit one.

Found the javascript version for just such an action here: http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=13148

 

tried to make my own apex version but the last digit keeps coming out wrong.  Any Ideas?

 

Thank's

 

 

 

String id = '001Q0000002NXad'; //a sample id

 

String suffix = '';

for(integer i=0;i<3;i++){

Integer flags = 0;

for(integer j=0;j<5;j++){
String c = id.substring(i*5+j,i*5+j+1);

if(c >= 'A' && c <='Z'){

flags += 1 << j;
}
}

if (flags <= 25) {

suffix += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.substring(flags,flags+1);

}else suffix += '012345'.substring(flags-26,flags-26+1);
}

System.debug('15-DIGIT:'+Id);
System.debug('18-DIGIT:'+Id + suffix);

 

 

 

Message Edited by astro on 05-01-2009 10:04 PM
Message Edited by astro on 05-01-2009 10:10 PM
  • May 01, 2009
  • Like
  • 0