We need to uniquely identify multiple lightning components on same page(added using lightning app builder) and we need to save respected responses and use them later. For this purpose we need a unique ID for every component that we add on the page, ID that is not changed later. For this we tried two solutions given below :

  1. GlobalId : If we try to use Global id using getGlobalId() method then there is a problem that GlobalId is not static and global id not guaranteed to be same beyond the lifetime of the component. Link for this reference is given below : https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_ids.htm

  2. Design Resources : We can get dynamic picklist values in design resources using datasource, It works perfectly to get any dynamic value. So we are trying to generate a random number with combination of some string values, But if we do so then in case of random number we are getting error Invalid Value[myuniqueKey]. Even if we just make it time dependent using gettime which will return timestamp then we get same error while saving the page. The code is given below :


String componentKey  = String.valueOf(System.now().getTime()) ; 
VisualEditor.DynamicPickListRows timeframeRows = new VisualEditor.DynamicPickListRows(); 
VisualEditor.DataRow row1 = new VisualEditor.DataRow(componentKey, componentKey ); 

return timeframeRows;

Any help will be really appreciated.

enter image description here

1 Answer 1


The problem might be that the blank "Unique Id" field does not match the picklist value. Try using:

VisualEditor.DataRow row1 = new VisualEditor.DataRow(

that pre-selects the row.

You must log in to answer this question.

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