1

I've built a simple lightning component that displays the chatter feed and publisher for a single chatter group. The component has an attribute that allows setting CollaborationGroupId in lightning app builder.

This all works fine if I set up the design file so that I can manually enter an Id.

Now i'm trying to use the dynamicpicklist class to generate a list of Chatter Groups. The basic functionality works, ie a picklist of groups is generated in the app builder, but the component throws an uncaught error on save. Note that preview works properly, and the preview updates to reflect the selected group - but on save I get a gack.

We had trouble processing the request. We've reported the problem to Customer Support with error ID: -583343216

Is there any special trick to this? The docs dont indicate that anything is required beyond setting the datasource in the design file to the apex class, but wanted to check in case anyone has figured this out before I file a case.

Code below

COMPONENT

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes">
    <aura:attribute name="groupId" default="select one" type="String" required="true" description="18 char id" />
    <forceChatter:publisher context="RECORD" recordId="{!v.groupId}" />
    <forceChatter:feed type="Record" subjectId="{!v.groupId}" feedDesign="DEFAULT"/>
</aura:component>

DESIGN

<design:component >
<design:attribute name="groupId" default="Select Group" label="Select Group" datasource="apex://GroupPicklist" description="dynamic picklist" placeholder="select group" />             
</design:component>

APEX CLASS

 global class GroupPicklist extends VisualEditor.DynamicPickList{

        list<CollaborationGroup> groupList = new list<CollaborationGroup>([Select Id,Name FROM CollaborationGroup WHERE IsArchived = FALSE]);

        global override VisualEditor.DataRow getDefaultValue(){
            VisualEditor.DataRow defaultValue = new VisualEditor.DataRow('Select One','SELECTONE');      
            IF(grouplist.size() > 0){
            string groupName = groupList[0].Name;
            string groupId = groupList[0].Id;
            VisualEditor.DataRow populatedValue = new VisualEditor.DataRow(groupName,groupId);
            return populatedValue;
            }           
            ELSE{
                return defaultValue;
            }
        }
        global override VisualEditor.DynamicPickListRows getValues() {
            VisualEditor.DynamicPickListRows  myValues = new VisualEditor.DynamicPickListRows();
                        list<VisualEditor.DataRow> DataRowList = new list<VisualEditor.DataRow>();
            FOR (CollaborationGroup cg : groupList){            
                string cgName = cg.Name;
                string cgId = cg.Id;
                VisualEditor.DataRow dr = new VisualEditor.DataRow(cgName,cgId);                
                DataRowList.add(dr);
            }
            myValues.addAllRows(DataRowList);
            return myValues;
        }
    }
2
  • In case of gack, your best help is salesforce support. You would have to raise a case with them. Commented Mar 25, 2018 at 21:23
  • Thanks, just checking if I'm missing anything basic as js and lightning components are a stretch for me. I have no js controller, helper, etc - just the elements listed in the post.
    – gorav
    Commented Mar 25, 2018 at 22:03

1 Answer 1

0

There is now a known issue for this. Will update once resolved.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .