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
Georgia2Georgia2 

Make field conditionally blank

I am trying to make a formula field blank based on a picklist value.

 

i.e. I have a custom object (RMA) that uses a formula to autopopulate the field 'Account Shipping Address' from the related Account.  I then have a text field named 'Alternate Shipping Address' and a Ship To picklist with the two options: 'Account Shipping Address' and 'Alternate Shipping Address' 

 

If the picklist equals 'Alternate Shipping Address' I would like the 'Account Shipping Address' to default to blank so there is only one address within the record.

 

Thoughts?

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/
Okay, I think you want to change that Formula Field to be something like

IF(ISPICKVAL(Ship_To__c, "Account Shipping Address"),
Customer_Contact__r.Account.ShippingStreet & br() & Customer_Contact__r.Account.ShippingCity & ", " & Customer_Contact__r.Account.ShippingState & " " & Customer_Contact__r.Account.ShippingPostalCode & br() & Customer_Contact__r.Account.ShippingCountry, NULL)

 

and you should be Good to Go.  Let me know how/if it works out for you. 

 

Also, you don't need that other Validation Formula now either.

Message Edited by Stevemo on 10-08-2009 12:51 PM

All Answers

Steve :-/Steve :-/
Can you post an example of your formula using the Clipboard [C] icon in the post message window?  
Message Edited by Stevemo on 09-04-2009 02:15 PM
Georgia2Georgia2

Hi

I don't really have a good example anymore.  I tried several different formulas and either they had syntax errors or did not do what I was hoping it would.

Here is the one I have left:

and( ispickval(Ship_To__c , "Alternate_Shipping_Address__c "), not(ispickval ( Ship_To__c , "")) )

 

Does this help at all?

 

Thank you

Steve :-/Steve :-/
Are all of the fields in your formula located on your custom object?  what is the relationship between your custom object and the Account object?  is it Master-Detail or just Lookup?
Steve :-/Steve :-/

Okay, it's a little bit of a guess without having all the information  (field dataypes, object relationships, etc.)

 

But if your custom address field is a formula then you could give something like this a shot.

 

 

IF(ISPICKVAL(Ship_To__c, "Alternate_Shipping_Address__c"), Account Shipping Address, NULL)

 

 

 

Georgia2Georgia2

Hi

I am sorry I just saw these replies.  I have the "email me when someone replies" box checked but I don't receive anything.

 

Anyhow, the Ship To is a pick list on the Object with the two ship to options:

Account Shipping Address  Alternate Shipping Address

 

The Account Shipping Address is a text formula that pulls the address from the Customer Contact on the RMA object.  And the Customer Contact is a lookup to a Contact.

 

The Alternate Shipping Address is a text field within the Object.

 

All three fields are located on the custom object.  There is no relationship between the Object and the Account; only a lookup to the Contact as mentioned above.

 

I used this formula

IF(ISPICKVAL(Ship_To__c, "Alternate_Shipping_Address__c"), Account_Shipping_Address__c, NULL)

 

and I get this error.  Error: Formula result is data type (Text), incompatible with expected data type (true or false).

 

Thank you!

Steve :-/Steve :-/

Hi Georgia,

 

Sorry if I'm getting a little confused, but are you looking for a formula that will conditionally populate your Formula(text) Account_Shipping_Address__c field, or is that field populated by another formula, and you are looking to override that with a NULL is the user selects "Alternate Shipping Address" from the picklist?

Georgia2Georgia2

Hi

The latter.   The Account Shipping Address is populated by another formula (look up to contact address), and I want to override that with a NULL if the user selects "Alternate Shipping Address" from the picklist.

 

Thanks!

Steve :-/Steve :-/
Okay, I don't think that you can do that through SFDC Formula Language, because what you basically end up with is a tug-of-war between your 2 formulas.  Can you post the formula that you are using to do your initial calculation of your "Account Shipping Address" field?  I think that you might be able to just amend that formula to evaluate your "Ship To" picklist.
Georgia2Georgia2

Hi

Here is the formula used to pull the "Account Shipping Address"

Customer_Contact__r.Account.ShippingStreet & br() & Customer_Contact__r.Account.ShippingCity & ", " & Customer_Contact__r.Account.ShippingState & " " & Customer_Contact__r.Account.ShippingPostalCode & br() & Customer_Contact__r.Account.ShippingCountry

 

 

Thank you

Steve :-/Steve :-/
Okay, I think you want to change that Formula Field to be something like

IF(ISPICKVAL(Ship_To__c, "Account Shipping Address"),
Customer_Contact__r.Account.ShippingStreet & br() & Customer_Contact__r.Account.ShippingCity & ", " & Customer_Contact__r.Account.ShippingState & " " & Customer_Contact__r.Account.ShippingPostalCode & br() & Customer_Contact__r.Account.ShippingCountry, NULL)

 

and you should be Good to Go.  Let me know how/if it works out for you. 

 

Also, you don't need that other Validation Formula now either.

Message Edited by Stevemo on 10-08-2009 12:51 PM
This was selected as the best answer
Georgia2Georgia2

Hi

I changed the Account Shipping Address to what you suggested and it only half worked.  It made it blank no matter what the pick list value.  It was blank whether the Ship To field was Account Shipping Address or Alternate Shipping Address.

 

So I changed the formula to "Alternate Shipping Address"

IF(ISPICKVAL(Ship_To__c, "Alternate Shipping Address"),Customer_Contact__r.Account.ShippingStreet & br() & Customer_Contact__r.Account.ShippingCity & ", " & Customer_Contact__r.Account.ShippingState & " " & Customer_Contact__r.Account.ShippingPostalCode & br() & Customer_Contact__r.Account.ShippingCountry, NULL)

 

and that didnt work either.
Georgia2Georgia2

Ok- it worked!  I  just had to change the formula to say (Ship_To__c, "Account Shipping Address (Above)")

since that was the pick list value... not "Account Shipping Address".

Thanks!

Steve :-/Steve :-/

No problem...

 

 

Whose house???  RUN's House!!! Whose house???  RUN's House!!!    :smileywink: