Solving a Search Dilemma regarding CustomObject.Name

Share

On a recent project, I was migrating a customer from the Contracts object to a Custom Object (Contracts are not supported in Customer Portal for some odd reason).  The Contract Number was being imported to the Name field on the new Custom Object.  To do so, I had to make the Name field a Text field so that we could maintain the value.  We also wanted to keep the formatting of 00000123 for contract #123.

After import, I converted the Name field to an Auto Number and set its mask to be {00000000} and its starting number to be the next one in the sequence.  When you change from a Text to an Auto Number field on the Name field of a Custom Object, the old data is left alone.  Had I imported, “123” into the Name field, Salesforce would not apply the mask.  Thus, I had to import “00000123” on the migrated records.

The issue my client discovered is that you can’t search for “123” in the Sidebar Search to find the Custom Object record that was imported.  It will work for records generated after the field was changed to an Auto Number, but not the converted data.  To find the legacy data, we’d have to tell the users to search for the full value of “00000123”.  Not good.

The resolution was actually pretty simple.  I added a new text field to the object and have a Workflow Rule that copies the Contract Number to it.  On Custom Objects, all text fields are indexed.  Voila!  It was searchable.

5 Comments »

  1. Jeff Douglas Said,

    July 14, 2009 @ 10:09 am

    You my friend are a genius. I was having this exact same problem with an inventory item custom object. I was wondering how to make the field searchable. So you could, in theory, create a text field and stick a bunch of keywords in it?

  2. Scott Hemmeter Said,

    July 14, 2009 @ 10:11 am

    @Jeff

    Yes, you could do that if you wanted. I am not sure if the indexing is limited to text fields or if it includes Text Area and Long Text. However, using a Text field you could do that.

  3. Chris Noe Said,

    July 14, 2009 @ 7:01 pm

    @Jeff

    All custom fields of type text, text area, and long text area are searched when using the Advanced Search feature on custom objects.

    @Scott

    Great work around. I’m assuming you are searching from the Advanced Search on this new text field. Is that correct? I am not aware of this working from the normal search unless the text field is indexed (set as an external id).

  4. Scott Hemmeter Said,

    July 14, 2009 @ 11:00 pm

    @Chris Noe

    My solution is working with the Standard Search in the sidebar. This goes against what the Help file states regarding fields that are indexed, but it seems to be working.

  5. Gary B Said,

    July 15, 2009 @ 4:00 am

    Marking a field as an External ID should also cause it to be indexed, though there is a limit on how many external IDs you can have on an object (I believe it’s as few as 4).

RSS feed for comments on this post · TrackBack URI

Leave a Comment

All comments are moderated. Other visitors will not see your comment until it has been approved.