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
scottyscotty 

Contact formula with record type

I have a formula that works as designed but need to make it work only for a specific record type.  My formula is below.  I appreciate any help provided.

 

IF ( INCLUDES ( Account.Blog_Selections__c , "used-car-values.com" ), "used-car-values.com; ",null ) &
IF ( INCLUDES ( Account.Blog_Selections__c , "my-home-improvement.com" ), "my-home-improvement.com; ",null ) &
IF ( INCLUDES ( Account.Blog_Selections__c, "rentals-on-vacation.com" ), "rentals-on-vacation.com; ",null ) &
IF ( INCLUDES ( Account.Blog_Selections__c, "client’s website blog" ), "client’s website blog; ",null )

Steve :-/Steve :-/

You need in add a reference to 

 

$RecordType.Name = "Your Record type Name"

in your VR 

 

scottyscotty

Thanks for the help.

 

This is not a VR. This passes data from the Account object t the account object based on Subscribing to a blog, but on contact record types of "Business Contact (Email)" should have the field populated with the blog names they sunbscribe to.  When I add the line as you indicated and I validate the formula, I get an error that the formula is not the correct type.  It is text.

Steve :-/Steve :-/

Can you post the Formula you tried to use?

scottyscotty

AND ($Recordtype.Name = " Business Contact (Email) ", "Business Contact (Email) ") &
IF ( INCLUDES ( Account.Blog_Selections__c  , "used-car-values.com" ), "used-car-values.com; ",null ) &
IF ( INCLUDES ( Account.Blog_Selections__c , "my-home-improvement.com" ), "my-home-improvement.com; ",null ) &
IF ( INCLUDES ( Account.Blog_Selections__c, "rentals-on-vacation.com" ), "rentals-on-vacation.com; ",null ) &
IF ( INCLUDES ( Account.Blog_Selections__c, "client’s website blog" ), "client’s website blog; ",null )

Steve :-/Steve :-/

okay here you go (and you owe me a beer!) 

 

 

IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"used-car-values.com")), "used-car-values.com",  
IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"my-home-improvement.com")), "my-home-improvement.com", 
IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"rentals-on-vacation.com")), "rentals-on-vacation.com",
IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"client’s website blog")), "client’s website blog",
NULL))))

 

 

 

 

scottyscotty

This still does not take the record count into account?

scottyscotty

sorry, ready wrong post.

scottyscotty

Not sure why it doesnt work, but it doesnt.  I dont get an error? It does not populate any values on the contact record.

Steve :-/Steve :-/

What is the datatype of the fields that you are evaluating?  Are there any picklists?

scottyscotty

Its a Multi pick list

Steve :-/Steve :-/

Okay, Record Types, Picklists and Multi-Picklists are tricky animals.  When you evaluate them in a VR, Formula, or WFR the spelling and punctuation in your formula must match exactly (spelling, punctuation, upper/lower case, blank spaces, etc).   

If you get no syntax error but the formula doesn't fire I would verify each value first.  

scottyscotty

It worked perfectly before I added the record type statement.  Just strange the way this can be affected.

Steve :-/Steve :-/

Okay that's good!  So we know that our Pickvals are good, now onto stage 2 verify the RT Name (same rules apply: spelling, punctuation, yadda yadda yadda)

scottyscotty

I have tried every scenrio I can tink of. Using the ID, Developer name or name with no luck.  Her is the screenshot of my data. Just don't understand. I am assuming since it is populating the corract record with data from the account that the record type can be based from the contact.

IDNAMEDEVELOPERNAME
01230000000DGjHAAWBusiness Contact (Email)BusinessContactEmail
Steve :-/Steve :-/

Can you copy&paste the exact formula you're using?

 

 

IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"used-car-values.com" )),"used-car-values.com; ", 
IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"my-home-improvement.com")), "my-home-improvement.com; ",
IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"rentals-on-vacation.com")), "rentals-on-vacation.com; ",
IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"client’s website blog")), "client’s website blog; ",
NULL))))

 

 

 

scottyscotty
IF(AND($RecordType.Name="Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"used​-car-values.com")), "used-car-values.com",  
IF(AND($RecordType.Name="Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"my-h​ome-improvement.com")), "my-home-improvement.com", 
IF(AND($RecordType.Name="Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"rent​als-on-vacation.com")), "rentals-on-vacation.com",
IF(AND($RecordType.Name="Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"clie​nt’s website blog")), "client’s website blog",
NULL))))

 

Steve :-/Steve :-/

I've got it!!!

 

IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account__r.Blog_Selections__c,"used-car-values.com")), "used-car-values.com",  
IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account__r.Blog_Selections__c,"my-home-improvement.com")), "my-home-improvement.com", 
IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account__r.Blog_Selections__c,"rentals-on-vacation.com")), "rentals-on-vacation.com",
IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account__r.Blog_Selections__c,"client’s website blog")), "client’s website blog",
NULL))))

 

 

scottyscotty

The Account__r does not exist. Am I missing something?

Steve :-/Steve :-/

Where are you creating this formula field?

scottyscotty

In the contact record, pulling data from the associated Account.

Steve :-/Steve :-/

Are you using the Formula Bulider Wizard?  

Steve :-/Steve :-/

Can you create a List view or report that includes the Account fields and Contact fields from your formula and your custom formula field and post a screenshot?

Steve :-/Steve :-/

I have tested the Formula field on my DE Org and it works fine, if the Contact Record Type is correct the appropriate value for the Account Multi-Picklist option is inserted into the Text Field.  If the Contact Record Type is incorrect the value is NULL. 

Steve :-/Steve :-/

Try this one

 

IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"used-car-values.com" )),"used-car-values.com; ",NULL) + 
IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"my-home-improvement.com")), "my-home-improvement.com; ",NULL) +
IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"rentals-on-vacation.com")), "rentals-on-vacation.com; ",NULL) + 
IF(AND($RecordType.Name = "Business Contact (Email)",INCLUDES(Account.Blog_Selections__c,"client’s website blog")), "client’s website blog; ",NULL)

 

 

scottyscotty

Still doent work, May have to figure out how to do this as a field update from workflow.  Thanks

Steve :-/Steve :-/

I can get this to work on my DE Org, my gut is that there is something wrong with either the Record Type in the Formula, or the records do not match the criteria of the formula.  Can you post the screenshots that I asked for? 

scottyscotty

I am not having any luck pasting the screen shot of the report I just built.

 

The criteria used in plain text is

 

Contact record type equals Business Contact (Email) and

Blog selections (from the account) include Clients website blog.

 

Due to the formula not working I can not pull the data based on how I would like it to populate in the contact record with the same data that resides in the account.  I only want the "Blog Selections" data to populate in the contact records that are a "Business Contact (Email) record type.  It really appears that this should be very a very simple task.  I do appreciate the help. 

 

Once this is finished, where do I send the Case of your favorite "BEER" I will owe you?

 

Steve :-/Steve :-/

Hi Scotty, let's get this thing fixed first, then we can settle up on the beers ;-)  

Can you post your screenshot to a secure hosted site like Picas, Flickr, GoogleDocs, Screencast etc. and paste the URL link? 

Steve :-/Steve :-/

Hi Scotty, thatnks for the screenshot.  Can you change the report so that the Contact.Record Type and Account.Blog Selections, and your custom Contact Formula(Text) field are on the report so that I can see the fields, values, and formula results side-by-side on 1 screen?  

Steve :-/Steve :-/

I think I've got it!!!

 

If you're gonna use $RecordType.Id in your formula you can't use the 18 char ID you have to use the 15 char ID, also the correct syntax is $RecordType.Id  

like this:

 

IF(AND($RecordType.Id  = "01230000000DGjH",INCLUDES(Account.Blog_Selections__c,"used​-car-values.com" )),"used-car-values.com; ",NULL) + 
IF(AND($RecordType.Id  = "01230000000DGjH",INCLUDES(Account.Blog_Selections__c,"my-h​ome-improvement.com")), "my-home-improvement.com; ",NULL) + 
IF(AND($RecordType.Id  = "01230000000DGjH",INCLUDES(Account.Blog_Selections__c,"rent​als-on-vacation.com")), "rentals-on-vacation.com; ",NULL) + 
IF(AND($RecordType.Id  = "01230000000DGjH",INCLUDES(Account.Blog_Selections__c,"clie​nt’s website blog")), "client’s website blog; ",NULL)

or you can use the $RecordType.Name   

 

 

 

scottyscotty

This still does not work.  Could itbe that the record type needs to be at the other end of the formula? All of the cotact records have a record type, they will not all have the blog selections populated.

Steve :-/Steve :-/

Hi Scotty, just to back up the truck and make sure that we didn't over-think ourselves into a corner here.  

The desired result is that if the Contact Record Type = "Business Contact (Email)" then a custom Formula(Text) field should display whatever values were selected in a Mult-Picklist field on the Account object called "Blog Selections", other wise the Contact.Formula(Text) field should be blank.  

 

Am I right or wrong on that? 

scottyscotty

you are correct

Steve :-/Steve :-/

Then there has to be something wrong with either the picklist field values, or the record type name references in your formula, because when I test this on my DE Org I get exactly that result.  

Can you copy&paste the printable view of the Multi-Picklst values?

scottyscotty

Not sure which area fixed it but it works.  I decided to re copy all of the picklist values again.  Where do i send your favorite brew?

Steve :-/Steve :-/

When you're writing a VR or Formula that references a Picklist Value or Text Value the spelling and punctuation have to match exactly (upper/lower case, blank spaces, etc.) 

scottyscotty

Thanks for all the help.  I will have to have someone else get you a beer. We are in the process of moving to oracle on demad.  Wish we would stay with salesforce.com but there is no way.

 

Thanks again.

Steve :-/Steve :-/

ouch, I am very sorry for your loss, please accept my deepest condoloences.

Reginald MartinReginald Martin
We can create a custom/formula field with the value Record-Type ID. Make sure you pick Formulaas the type and then Formula Text and click (https://www.hairstylenext.com)Next.
...
Go to the Record Type.
Setup> Customize> (object)> Record Types.
Click on the record type.
Find the Record Type IDin the URL between id= and &type.
We get the Id from the link.
Jonye KeeJonye Kee
All commercial cleaners (https://www.sparkleofficeclean.com.au/) within the commercial cleaning company are insured, reliable, and trustworthy. Our commercial cleaning team is dedicated to providing commercial office cleaners that meet your exact requirements for commercial location cleanliness. 
Mark StvenMark Stven
I have best brake pads (https://nrsbrakes.com/) website for ready to setup and i want to know that can i use your snippet code to place on homepage of my website as it is related to my website!