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
SalesforceDF2011SalesforceDF2011 

Formula Help!

Hi,

 

I was wondering if you could help me with a formula. Here is the scenario:

Product object has a field called Status
User object has a field called User_Status 

I am trying to create a formula which would display a value on the Product object as "True" or "False" if the Product status field = User status field.
Please note: The user status field could have multiple value

ex: Product has Status field as "Awake"
User status has field as Awake, Sleep, Not Sleepy

Now the Formula should display True based on the above scenario, since Awake is listed as one of the option.
Any Suggestions :smileyindifferent:
Thanks!
Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

Do you still need help with this or are you all set now?

All Answers

Steve :-/Steve :-/

How are the Product object and User object being connected to each other?

SalesforceDF2011SalesforceDF2011

Hi Steve,

 

Thanks for the reply.

 

I am trying to use the $User.Status__c field in the formula field on the Product.

 

I am trying to get the logic to compare two text field, something like "Is the Product_Status__c values one of those specified in the $User.Status__c field, if yes display True else False.

 

Thanks!

Steve :-/Steve :-/

What is the datatype of the $User.Status field and the datatype of the Product status field?  Are you trying to write a Validation Rule or a Formula(Text) field on the Product object?

SalesforceDF2011SalesforceDF2011

Datatype of both the fields is text and its a formula field on the Product.

 

thanks!

Steve :-/Steve :-/

okay then you could try this

 

IF($User.Status__c = Status__c, "TRUE","FALSE")

 

SalesforceDF2011SalesforceDF2011

Hi Steve,

 

Would this work if the User.Status field has multiple values.

 

The User.status could have multiple values, and what i am trying to achieve, is if the Product.Status field is or contains one of the value defined in the User.status field then display True, else False

 

Thanks!

SalesforceDF2011SalesforceDF2011

I tried this formula, but it doesnt display the correct values,

 

IF( CONTAINS( $User.Status__c , "Status__c"),"True","False")

Steve :-/Steve :-/

What is that?  That's not the formula I posted.

Steve :-/Steve :-/

Do you still need help with this or are you all set now?

This was selected as the best answer
SalesforceDF2011SalesforceDF2011

Hi Steve,

 

Thanks for following up and guiding me in the right direction.

 

Here is the formula which worked for me:

 

IF( CONTAINS( $User.Status__c , Product_Status__c),"True","False")

 

Since the status field on the User object is a text field which could have multiple values, i used the CONTAINS syntax.

 

Thanks!

Steve :-/Steve :-/

No problem, glad to hear you got it working