AnsweredAssumed Answered

OptionsService not return any resaults

Question asked by iang on Jan 29, 2017
Latest reply on Feb 27, 2017 by afaust

I am confused and frustrated - not an unusual state I admit. However my problem is that despite reworking my code for the last week and finding many silly errors (like trying to use OptionService instead of OptionsService) I still can get this dam select box to populate with a list of users.

 

I have been able to get it to work using the optionsConfig fixed from the documentation example.

 

Following Dave Drapers video I can see the users from the service but get an empty select box 

 

I am now at the point were I dont know what to do next, probably a stupid error (slight dyslexia so used to that) but if anyone can spot it there a virtual brew in it for you.

 

The form is in a dashlet as follows:

 

 

model.jsonModel = {
    rootNodeId: args.htmlid,
    pubSubScope: instance.object.id,
    bodyHeight: "400px",
    services: [
        // {   name: "alfresco/services/LoggingService",
        //     config: {
        //         loggingPreferences:{
        //             enabled: true,
        //             all: true
        //         }
        //     }
        // },
        "alfresco/services/OptionsService"
    ],
    widgets: [
        // {
        //     name: "alfresco/logging/DebugLog",
        // },
        {
            name: "alfresco/dashlets/Dashlet",
            config: {
                title: "My Messages",
                bodyHeight: args.height || null,
                componentId: instance.object.id,
                widgetsForTitleBarActions: [
                    {
                        id: "MESSAGING_DASHLET_ACTIONS",
                        name: "alfresco/html/Label",
                        config: {
                            label: "Title-bar actions"
                        }
                    }
                ],
                widgetsForToolbar: [
                    {
                        id: "MESSAGING_DASHLET_TOOLBAR",
                        name: "alfresco/html/Label",
                        config: {
                            label: "Toolbar"
                        }
                    }
                ],
                widgetsForBody: [
                    {
                        id: "HELLO_DASHLET_VERTICAL_LAYOUT",
                        name: "alfresco/layout/VerticalWidgets",
                        config: {
                            widgetWidth: "350px",
                            widgets: [
                                { name: "alfresco/forms/Form",
                                    config: {
                                        showOkButton: true,
                                        okButtonLabel: "Send",
                                        showCancelButton: false,
                                        okButtonPublishTopic: "PUBLISH_TOPIC_MESSAGE",
                                        okButtonPublishGlobal: true,
                                        widgets: [{
                                            name: "alfresco/forms/controls/TinyMCE",
                                            config: {
                                                fieldId: "MESSAGE_TEXT",
                                                name: "message",
                                                label: "Message",
                                                widgetWidth: 200
                                            }
                                        },
                                        {
                                            name: "alfresco/forms/controls/Radio",
                                            config: {
                                                fieldId: "RECIPENT",
                                                name: "recipient",
                                                label: "Send to",
                                                optionsConfig: {
                                                    publishTopic: "ALF_GET_FORM_CONTROL_OPTIONS",
                                                    publishPayload: {
                                                        url: url.context + "/proxy/alfresco/api/people",
                                                        itemsAttribute: "people",
                                                        labelAttribute: "firstName",
                                                        valueAttribute: "userName"
                                                    }
                                                }
                                           }
                                        }]
                                    }
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
};

Outcomes