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
GoForceGoGoForceGo 

Restricting PickList values during API calls

I have Unit of measure (UOM) pick list variable which should be only milligram or gram.

During API calls, when a new record is created, how do i enforce this? In other words if someone provides kilogram as UOM, I don't want the record to be inserted.

The system today will insert a record with kilogram.

The API manual (see below) talks about a variable called "RestrictedPickList", but I am not sure how to set it.

In the Field object associated with the DescribeSObjectResult, the restrictedPicklist field defines whether the field is
a restricted picklist or not. The API does not enforce the list of values for advisory (unrestricted) picklist fields on create()
or update.When inserting an unrestricted picklist field that does not have a PicklistEntry, the system creates an “inactive”
picklist value. This value can be promoted to an “active” picklist value by adding the picklist value in the Salesforce user
interface.




james_galindojames_galindo
Not sure about using SFDC to do validation on the backend...does your interface allow "free text" from the user for this value or do you giev them a combo dropdown element to pick from?  I almost always write my own validation either at the inteface level or in my own code as I am retrieving values for the API call.