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
David PoynterDavid Poynter 

Error when creating Predefined Field values in Lightning Quick Action

I am attempting to create a quick action from an Opportunity to create a new CSOT object. This works currently in classic via a URL hack, however when creating a quick action, I am trying to prefil a CSOT field with a formula field on the opportunity, I receive the error in the screenshot.

User-added image

Yet Reco_d_Portfolio__c IS used in other predefined field values in quick actions.
Best Answer chosen by David Poynter
David PoynterDavid Poynter
So I was eventually able to figure out the issue. Simply put, you cannot use formula fields within the formula for the predefined value. The reason for this is that fields used in the objects formula fields, do not include the proper object prefix that is (for some reason) required within the formula builder for the predefined value. What you will have to do is copy over the formula from the formula field you wanted to reference, and add in any object prefixes that might be need. Be especially careful if the formula field you are referencing is referencing OTHER formula fields as well - as these will need to be tracked down and changed as well.

It is really a pain and I don't know why it is this way, but I am glad to have found a solution to the issue. No where online could I find this information!

All Answers

Alain CabonAlain Cabon
@David Poynter

You can’t use a dependent picklist to set a predefined value (not your case surely here)

But there was a general problem that should be fixed now for this case [summer 19]:

Actions: Predefined picklists can be set by formula:

When using the Predefined Field Values in an Action, you can only set a picklist field to be a single set value.  I would like to be able to set the picklist field by using a formula.
 
https://success.salesforce.com/ideaView?id=08730000000Df0HAAS

Try also to use: TEXT ( <opportunity__c . your field > ) for tthe formula.
David PoynterDavid Poynter
Yeah none of the fields in question are dependant fields thankfully.

But I just ran in to this issue yesturday, so it definitely wasn't covered by any patch. But it does seem like that sort of issue.

I have tried the text wrap, but he formula is already returning a text value so I get the incorrect data type error with that.
David PoynterDavid Poynter
So I was eventually able to figure out the issue. Simply put, you cannot use formula fields within the formula for the predefined value. The reason for this is that fields used in the objects formula fields, do not include the proper object prefix that is (for some reason) required within the formula builder for the predefined value. What you will have to do is copy over the formula from the formula field you wanted to reference, and add in any object prefixes that might be need. Be especially careful if the formula field you are referencing is referencing OTHER formula fields as well - as these will need to be tracked down and changed as well.

It is really a pain and I don't know why it is this way, but I am glad to have found a solution to the issue. No where online could I find this information!
This was selected as the best answer