How to pass picklist values dynamically - apex

We have a custom Metadata type named 'Type' with only one field as 'Type'. We will add/delete the records to the Metadata. We do have a custom Object named 'Header' with two fields 'Name' and 'Type'. 
So here my question is:
I need to pass the records available in metadata(Type filed) as a picklist values to the field 'Type' available in Custom Object "Header". I'm stuck with this. I don't know how to proceed. Could anyone please provide some inputs on how to proceed in this scenario?

Related

Get value of a field with Ndepend

I'm trying to make a rule for detect fields that hava assigned values with Ndepend. But I don't know if it's possible to get the value of the fields.
For example, if I have String X='abc' I want to retrieve the x value that would be 'abc'

Parse ClassFormDefinition for a Custom Page Type Field's Values

I want to populate a dropdown in my webpart from a custom page type field's values.
so for e.g I have a custom pagetype my.pagetype which has a field called myfield and has value like 1,2,3. How Do I get these 1,2,3 values ?
How do I access through SQL or macro so far I have reached till here and this code is giving me a long XML Schema string which has all fields definition and values of the custom page type.
CMSContext.Current.GlobalObjects.Classes["my.pagetype"].ClassFormDefinition
How do I get around?
Are you populating the drop down list in that Page Type manually? (e.g. 1, 2, 3)
If you want to reuse the same list of value in multiple places, it's better for you to create a custom table to store those value (e.g. customtable_myListX). Then for the drop down list, you can use the SQL option (SELECT Value, Display FROM customtable_myListX).

Restrict Custom Field Value Responses for Contacts

When sending a GET query for matters, you can use the custom_field_ids[] key with a custom field id as the value to pull down the fields for a specific custom field assigned to a matter.
The documentation shows no similar functionality for the contact object. I'm having to pull all custom_field_values{field_name,value} and parse this result to find the specific custom field value I'm looking for, when I'm querying a contact.
Is there a better way to get the custom field value for a specific custom field id for contacts than what I'm doing above? If not, I'd love to see the custom_field_ids[] parameter applied to the contact object.

Symfony2 - render an array collection within an entity as radio not as (dropdown) chioce field

I created a form with an collection of forms - the user shall be able to edit many items within one screen.
Each entity in the collection of forms consists for example of a text field and a choice field. The choice field contains some text options (of course).
I know that there is an option like here [ Default values for symfony2 choice radio box ] to define the possible values within the form type by giving an array.
But I do not want to iterate over my array collection within the form builder when I can avoid that. Because the collection is not just an array of strings but it is a collection of an entity (with a __toString() function so that I can get a textual representation for each of it).
Is there a way to render a radio field instead of the default dropdown choice field within the twig teamplate? Or by giving a special option to the form builder (without a loop)?
If you need to display a entity field using radios instead of select, you just have to set the expanded attribute to true:
$builder->add('post', 'entity', ['expanded' => true]);
If you also add the multiple attribute, you have a set of checkboxes instead.
Reference

Symfony2 - Form with a checkbox column

I'm trying to build an HTML table with some data of an entity, and then, add a column with a checkbox for each row, in order to validate if the precious data is valid or not. After user checks or not each checkbox, I have to update the database table with this info.
As when I build the form I don't know exactly how many checkboxes I have, I pass to twing template an array of entities, and then I buid a new input type"checkbox" at last column for each row.
But when I submit my form (POST method), I'm not able to get this info. $request object doesn't have any of the checkboxes nor form reference. $request->request->all() is getting a null value. How can I get fields of a manual form build in a twig template?
Thanks
Now It's working. Thanks a lot ($request->request->all() is getting values now). It's a mistery...