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
JenniferMJoyJenniferMJoy 

Trying to Map a Contact Field to a Custom Object Field as a Read Only

This is the formula I wrote to try to map a custom Contact field to a custom object field, but it doesn't seem to be connecting and populating the custom object field with the information in the contact field.  Is something missing?

 

IF(ISNULL(Contact_Met_del_del__r.Campaign_Connected_To__r.Name), Contact_Met_del_del__r.Campaign_Connected_To__r.Name ,Contact_Met2__r.Campaign_Connected_To__r.Name)

Steve :-/Steve :-/

Hi Jen,

 

What is the relationship between the Contact and your Custom Object?  Is it Master-Detail or Lookup?  

 

Are you trying to do a Field Update, or is this a straight Formula(text) field? 

JenniferMJoyJenniferMJoy
The relationship between the Contact and the custom object is a look-up.  The field I am trying to populate in the Custom Object is a formula field based on a look up field in the contact. (so I think the answer to your second question is that its a straight formula(text) field?
Steve :-/Steve :-/

Try using a LEN function (instead of ISNULL) when you evaluate your text field.  

 

 

 

Message Edited by Stevemo on 09-08-2009 05:40 PM
JenniferMJoyJenniferMJoy

SF Guru,

 

The length of the text would differ per record depending on which campaign that contact was associated to.  Is there still a way to use LEN if that's the case?

Steve :-/Steve :-/

Hi Jen,

 

actually I'm more like a Salesforce Idiot Savant than a "Guru".

 

Anyway, you should be okay regardless of the length of the fields that you are evaluating.  What the LEN function does (instead of the ISNULL function) is it counts the number of characters in a Text field.  So when you say something like IF(LEN(Fieldname) = 0...  or IF(LEN(Fieldname) <1...  what you're basically doing is saying "If this field is blank, then..."

 

Without being able to look under the hood of your SFDC Org, your formula should look something like

 

 

IF(LEN(Contact_Met_del_del__r.Campaign_Connected_To__r.Name) < 1), Contact_Met_del_del__r.Campaign_Connected_To__r.Name,Contact_Met2__r.Campaign_Connected_To__r.Name)

 

 You might also want to consider using a Workflow Rule with a Field Update.

 

Message Edited by Stevemo on 09-08-2009 05:56 PM
JenniferMJoyJenniferMJoy

Haha, making progress!... 

 

Formula for how I got the field to populate: Contact_Met_del_del__r.Campaign_Connected_To__r.Name

 

Now that I got the field to populate, I think I need to create a validation rule similar to that first formula I started with.  The issue is that there are 4 "Contact Met" options (contact met, contact met 2, contact met 3, etc).  The field is only populated for one of the Contacts, so I want my validation rule to say if the field is blank in contact met, then check contact met 2, if blank in contact met 3, then check contact met 4. (9 out of 10 times, it will be in contact met 2 if not in the Contact Met.  This is as close as I can get but I still get errors:

 

IF(LEN(Contact_Met_del_del__r.Campaign_Connected_To__r.Name) = 0,  Contact_Met2__r.Campaign_Connected_To__r.Name, Contact_Met_del_del__r.Campaign_Connected_To__r.Name)
Daina Quinones is typing a message.
Daina Quinones: Error: Formula result is data type (Text), incompatible with expected data type (true or false).

Steve :-/Steve :-/

Okay, you're probably going to have to amend your code to evaluate each field and move on to the next one if it is blank until it finds one that is populated.  

 

If I have a chance, I'll try to take another crack at it later.