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
Pablo ArgentinaPablo Argentina 

Search Problem

Hi guys. i'm trying to create a search field within two custom objects. My idea is to have a PC models database on one object and on another, need to search within data of the other object.
When i create a search field, this one, only search for the ID of the other object, but i want to search another field. The idea is to type a PC model, and if it founds it on the other object, then bring up to this new object all the information regarding to that model. 
Am i clear? any help? thanks!!!

AdrianCCAdrianCC

Hello,

 

Let me see if I got this right. You have 2 objects. They are related not through a standard Lookup relationship but through another field that appears on both of them(a pivot).

 

Let's say you have Obj1 and Obj2 with a Custom_Key__c field on both. 

When creating Obj1 you want to automativally search for Obj2, find it and populate data from it.

 

That's done through a trigger. Before insert and before update, if Custom_Key__c has a valid value in it, then you do a soql on the DB to retrieve the related record and copy whatever you need from it.

 

I would suggest making Custom_Key__c unique on Obj2.

 

Does this sound right?

 

Thanks,

Adrian

Pablo ArgentinaPablo Argentina

Adrian, thanks for your answer.

What can i say... WOW!!!!

 

Actually, what you are saying is more difficult than what i want.

 

I have 2 objects:

 

Object 1 name: DB

field: PC MODEL (text)

Field OS (text)

Field Color (text)

.... and so on.

 

Object 2 name: LOAD

field1: lookup field from DB object

field2: OS (formula)

Field3: Color (formula)

 

What i want is when i llokup on LOAD object for the model name on the DB object, then that all the other fields were automatically filed in.

But, the problem is that mi SEARCH field just luuk for IDs on the other object, not for the PC MODEL names.

 

thanks again

AdrianCCAdrianCC

Okay, so I didn't understand it right.

 

When you say "that mi SEARCH field just luuk for IDs on the other object, not for the PC MODEL names." you mean the lookup search window on the field1 from DB?

You want it to show also the Pc Model? That's done through the Search Layout section of that object in Setup. 

 

If you want to input the Pc Model in the search input text I'm afraid that won't work. For custom objects the input searches only the name... :(

One way around this would be to have a workflow rule add the Pc Model to the Name. For example, instead of 'Test Name' it would be 'Test Name - Model No 12345'. Link: https://na13.salesforce.com/help/doc/user_ed.jsp?loc=help§ion=help&target=search_fields.htm%23LookupSearchFields

 

 

"Lookup Search Fields

The lookup icon, which appears as a magnifying glass next to many fields, opens a dialog that allows you to search for other records. Below is the list of fields that are used for matching when searching in the standard or enhanced lookup dialog.

Type of Record Fields Searched Standard Lookups Enhanced Lookups

AccountAccount Name

Account Name (Local)

Website

  
CampaignCampaign Name  
CaseCase Number  
CommunityCommunity Name  
ContactFirst Name

First Name (Local)

Last Name

Last Name (Local)

  
ContractContract Name

Contract Number

  
DiscussionTitle  
DocumentDocument Name

Keywords

  
IdeaTitle  
LeadCompany

Company (Local)

Name

Name (Local)

  
OpportunityAccount Name

Opportunity Name

  
ProductProduct Code

Product Name

  
Self-Service UserFirst Name

Last Name

  
SolutionSolution Title  
UserNote
Only active users are searchable.
First Name

Last Name

Name

  
Custom ObjectsName  

 "

 

Hope this helps,

Adi