Telligent 8.5 and XML to Ilist or object Conversion

following method returns values in Dynamic Configuration XML format. i have a filed called Role where i have multiple values. how can i convert xml into ilist or object or array fo that i can read all values through loop anoer after another.

#set($stringResponse = $core_v2_userProfileField.DynamicFormXml($userProfileFieldName))

do we have built in API to convert xml into List.

Thanks,

Ravinder

Parents
  • Hi

    Are you trying to build a form or just read values about a user's configuration? 

    The $core_v2_userProfielField.DynamicFormXml is intended for use with $core_v2_dynamicForm.RenderForm, where RenderForm() renders a form based on the data types, options defined in the XML returned from DynamicFormXml. The "User Profile Fields" widget is an example of using these APIs.

    However, it sounds like you're more interested in reading a user's profile field values? DynamicFormXml won't help with that. Instead, just refer to the user object's ProfileFields property.

    For example:

    #set ($user = $core_v2_user.Accessing)
    <ul>
    #foreach ($field in $user.ProfileFields)
        <li>$field.Label: $field.Value</li>
    #end
    </ul>

  • Thanks for the response Michael, following code is returning the all profile fields and value of current user.  but i have custom requirement where i read the all values i have given to a particular field, for example Role is i filed which is in form of Dropdown and  role filed is having approx 20 different values and user can only choose one role , but i want to read all 20 roles 

    #set ($user = $core_v2_user.Accessing)
    <ul>
    #foreach ($field in $user.ProfileFields)
    <li>$field.Label: $field.Value</li>
    #end
    </ul>

  • I think I follow now. To get details about what profile fields exist, along with the options for those fields, you can still us the $core_v2_userProfileField extension. In particular, $core_v2_userProfileField.List() will return a list of UserProfileField objects. UserProfileField objects contain details about the field, including its name and data type, and its list of ProfileFieldTypeChoice options under the FieldTypeChoices property.  

    It's potentially worth reiterating that if you want these details in order to render a custom form, you're probably better off using DynamicFormXml with RenderForm instead, since it will automatically support rendering a usable form for any profile field's data type.

Reply Children
No Data