2

If I look here:

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_account.htm

I read this:

AccountSource -- The source of the account record. For example, Advertisement, Data.com, or Trade Show. The source is selected from a picklist of available values, which are set by an administrator. Each picklist value can have up to 40 characters.

But I am working on software that automates the import of data. Our customers have Salesforce accounts, they are buying the data from us, and they will be using our app (a managed package which will eventually be released on the Salesforce App Exchange) to import data.

I would like to put our company name in the AccountSource field. Will I get an error? Does Salesforce strictly enforce the picklist as an ENUM? If so, is there any way I can override it?

2 Answers 2

5

You can configure custom picklist fields to restrict values to only those specified in the metadata. Any picklist field that uses the Global Picklists feature must have this option enabled. Most standard fields, however, do not.

You can get the field describe and check it to see if this option is enabled using the isRestrictedPicklist method. In this case, it returns false.

system.assertEquals(false, Account.AccountSource.getDescribe().isRestrictedPicklist());
3

In a corollary to @Adrian's answer, let me add this. In a managed package, you shouldn't package picklist values for standard fields. If you do, they won't apply in the customers' installation, as explained here.

You have two choices:

1) Add the value as a string when importing data (AccountSource cannot be made global or force values)

This will add the value, but users won't be able to pick your company from the choices in the dropdown

2) You can leverage the Metadata API to add your company as a value to the picklist (you'd still need to use the value when importing contacts)

This will allow users to pick the value but, at the same time, significantly complicate your development efforts and lengthen your SecRev time (as they will likely want an explanation about why you're doing that).

1
  • 1
    "lengthen your SecRev time" -- thank you for the warning.
    – LRK9
    Commented Oct 10, 2016 at 22:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .