• Kasper Kristensen 3
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi.

I have a lightning component, with a design file that includes a two picklists. These picklists are currently being populated by referencing a class that extends "VisualEditor.DynamicPickList", using the datasource attribute on the design:attribute control. Like this : datasource="apex://ClassName.

This works fine, but i am getting all the fields specifically from the Account object right now, like this:
"Map<String, Schema.SObjectField> fldObjMap = schema.SObjectType.Account.fields.getMap();" and using that to populate the picklist.

What i would like to do, is to populate the picklist with all fields, based on what object the user is inserting the lightning component on. If the user inserts the lightning component on a Contact, it should list all Contact fields. If it is inserted on a Campaign object, it should list all the Campaign fields etc.

I am kinda stuck at how to to this.

I am supposed to be able to get the recordId, from the URL i guess. When i go into "Edit page" (where this should be used), i have a querystring in the URL called "pageId". And i should be able to get that through apex code. Something like this "ApexPages.CurrentPage().getparameters().get('id');".

But i can't get this to work. And i guess this has something to do with, that i am trying to do this in the "VisualEditor.DynamicPickList" extending class. But if someone could point me in the right direction, it would be awesome.

I just want to get the current object type in this extending class, that populates the picklists with field values. Simple as that. 
Hi.

I have a lightning component, with a design file that includes a two picklists. These picklists are currently being populated by referencing a class that extends "VisualEditor.DynamicPickList", using the datasource attribute on the design:attribute control. Like this : datasource="apex://ClassName.

This works fine, but i am getting all the fields specifically from the Account object right now, like this:
"Map<String, Schema.SObjectField> fldObjMap = schema.SObjectType.Account.fields.getMap();" and using that to populate the picklist.

What i would like to do, is to populate the picklist with all fields, based on what object the user is inserting the lightning component on. If the user inserts the lightning component on a Contact, it should list all Contact fields. If it is inserted on a Campaign object, it should list all the Campaign fields etc.

I am kinda stuck at how to to this.

I am supposed to be able to get the recordId, from the URL i guess. When i go into "Edit page" (where this should be used), i have a querystring in the URL called "pageId". And i should be able to get that through apex code. Something like this "ApexPages.CurrentPage().getparameters().get('id');".

But i can't get this to work. And i guess this has something to do with, that i am trying to do this in the "VisualEditor.DynamicPickList" extending class. But if someone could point me in the right direction, it would be awesome.

I just want to get the current object type in this extending class, that populates the picklists with field values. Simple as that. 
Hi.

I have a lightning component, with a design file that includes a two picklists. These picklists are currently being populated by referencing a class that extends "VisualEditor.DynamicPickList", using the datasource attribute on the design:attribute control. Like this : datasource="apex://ClassName.

This works fine, but i am getting all the fields specifically from the Account object right now, like this:
"Map<String, Schema.SObjectField> fldObjMap = schema.SObjectType.Account.fields.getMap();" and using that to populate the picklist.

What i would like to do, is to populate the picklist with all fields, based on what object the user is inserting the lightning component on. If the user inserts the lightning component on a Contact, it should list all Contact fields. If it is inserted on a Campaign object, it should list all the Campaign fields etc.

I am kinda stuck at how to to this.

I am supposed to be able to get the recordId, from the URL i guess. When i go into "Edit page" (where this should be used), i have a querystring in the URL called "pageId". And i should be able to get that through apex code. Something like this "ApexPages.CurrentPage().getparameters().get('id');".

But i can't get this to work. And i guess this has something to do with, that i am trying to do this in the "VisualEditor.DynamicPickList" extending class. But if someone could point me in the right direction, it would be awesome.

I just want to get the current object type in this extending class, that populates the picklists with field values. Simple as that.