'I want to filter the list which i'm retrive the list of sobject and filter to remove the name starts with skyvvasolution__?
I have make field with picklist value and retrieve the sobject list and show in the form but with list i got the other custom object to that i don't want to show.
Component: this is just a component to show the list.
<div class="slds-form-element slds-size_1-of-2 slds-float_left slds-p-around_xx-small">
<lightning:select name="Objects" label="Select SObject:" aura:id="onjId" value="
{!v.selectedValue}">
<aura:iteration aura:id="list" items="{!v.option}" var="objectname">
<option value="{!objectname}" text="{!objectname}"/>
</aura:iteration>
</lightning:select>
</div>
Controller:
helper.getObjectTypePicklist(component);
helper:(in comment I tried but not get the result)
getObjectTypePicklist: function(component) {
var action = component.get("c.getObjectName");
// var list = component.get("v.option");
// component.find("list").set("v.option", Replace(list,'Select Name Where
%skyvvasolutions__',''));
// action.setParams({
// Replace(list, 'skyvvasolutions__', '')
// });
action.setCallback(this, function(response) {
var state = response.getState();
if (state === "SUCCESS") {
var allValues = response.getReturnValue();
component.set("v.option", allValues);
}
else if (state === "ERROR") {
var errors = response.getError();
if (errors) {
if (errors[0] && errors[0].message) {
console.log("Error message: " +
errors[0].message);
}
}
else {
console.log("Unknown Error");
}
}
});
$A.enqueueAction(action);
}
Controller:
@AuraEnabled
public static List<String> getObjectName(){
List<String> objects=new List<String>();
List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();
for(SObjectType sot:gd){
objects.add(sot.getDescribe().getName());
objects.sort();
}
return objects;
}
I just want to remove names from my list which starts with the skyvvasolution__
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
