0

I have a custom object called P. P has many custom fields in it. One of the custom field is called obj, which is a picklist value. The value are following:

  1. ASAP
  2. RSVP
  3. BYOB

I am creating a VF page named letter which gets the fields of the page 'P' and displays in the page letter. I would like this picklist values to be expanded and displayed in the page letter. So when user has selected any or all of the picklist values in the field obj, the letter should display its corresponding expansion which are :

  1. "As soon as possible,"
  2. "respond, if you please."
  3. "Bring your own bottle"

I tried this using Formula(text) custom field in 'P' page. Named it as obj_expansion(API- object_expansion__c) and applied the below formula:

IF(INCLUDES(obj__c, "RSVP"), "respond, if you please.", null) & IF(INCLUDES(obj__c, "ASAP"), "As soon as possible", null) & IF(INCLUDES(obj__c, "BYOB"), "Bring your own bottle", null) &

But this does'nt seem to work. Any suggestion how can go about this?

1
  • Please clarify what you mean by "this doesn't seem to work".
    – Adrian Larson
    Sep 23 '15 at 19:24
0

If you were using a picklist you could use a CASE formula function:

CASE(MyPicklist__c,
    "ASAP", "As soon as possible",
    "RSVP", "Respond if you please",
    "BYOB", "Bring your own beer",
    "Fallback value"
)

Sounds like you are using a multi-select picklist. Try replacing your null values with empty strings (""):

IF(CONTAINS(MyPicklist__c, "ASAP"), "As soon as possible,", "") &
IF(CONTAINS(MyPicklist__c, "RSVP"), "Respond if you please,", "") &
IF(CONTAINS(MyPicklist__c, "BYOB"), "Bring your own beer,", "")
5
  • Hi I get this error - MyPicklist__c is a multi-select picklist field. Multi-select picklist fields are only supported in certain functions
    – SfdcBat
    Sep 23 '15 at 19:14
  • Also, In my VF page called letter I am getting the Formula(text) data type field as <p style="font-size:18px;">Object expansion :<apex:outputText value="{!P.object_expansion__c}"> style="font-size:18px;"/></p>. But I do not get any output for this. looks like it is not picking any value from the object_expansion__c formula(Text) field.
    – SfdcBat
    Sep 23 '15 at 19:18
  • That could easily be a permissions issue...
    – Adrian Larson
    Sep 23 '15 at 19:24
  • How to check the permission for this field? I am the admin and I think I should have access to all fields right?
    – SfdcBat
    Sep 23 '15 at 19:30
  • Setup > Manage Users > System Administrator > Object Settings > My_Object__c. Check that you have Read access on MyPicklist__c.
    – Adrian Larson
    Sep 23 '15 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.