Is it possible to add values to a picklist dynamically rather than predefined values? Kindly let me know.
There is no functionality to have this. Options are predefined during the field creation.
When we add some JQuery codes like $("#picklistName").append("<option value='new'>NEW</option>"); this will have the NEW option BUT values will not be saved.
- Create a new object (e.g. Product) and create a relationship to your main object (Warehouse).
- In the New and Edit page of Warehouse, go to design page change the lookup style to "Picklist"
- Every time you add new record to Product that will be automatically available as option in the picklist.
Can you tell us the exact scenario where in you want to add values to picklist dynamically.
In general while importing data from spreadsheet we have an option to create picklist values on the fly. During submit a checkbox is provided "Create new picklist items during import".
Basically I am trying to access the metadata 'objects' definitions available to me and I would like to get them as a picklist dynamically as it would change. Any suggestions?
Is this a picklist field you are referring to or a lookup that was rendered as picklist?
But I have a list of objects available to me via a REST API call. All I want is to populate this list as a picklist. Is it not possible in any other way?
I see, via REST API call, there is a method "updateFieldDef()", I haven't tried calling it but seems like this will do the updating of the picklist via REST.
See Chapter 14 > REST Metadata Methods > updateFieldDef (as of now at Page 697)
I'd recommend to use Lookup field instead (relationship).
Indeed, creating a related object that would contain all the picklist values is a more flexible approach.
Create an object with
- Picklist label
- Integration code
Do not use the record ID as an integration code since its value may change if you migrate the data to another Rollbase instance for example.
Then create a 1:M relationship between the picklist object and your existing object
This object that would contain the picklist label and integration code needs to contain all the objects available in rollbase (to choose from). Any suggestions on how I could get that done? I currently have done that via a REST API call: GetObjDefNames() and have populated the list of available objects to me. Is there any other way?
Goal: To achieve my object list as given below and then use that as a picklist in my related object picklist field.