You need to sign in to do that
Don't have an account?
Yogesh Jamgaonkar
List of fields and functions which can be used with respective field type?
Hello,
I need the list of fields and functions which can be used with respective field type.
Ex.
Field Type: Picklist
Function can be used with: ISPICKVAL
I need the list of fields and functions which can be used with respective field type.
Ex.
Field Type: Picklist
Function can be used with: ISPICKVAL
Hey, Yogesh!
I think you can have further clarifications looking at the following Salesforce's docs, that cover all details for each kind of function.
https://help.salesforce.com/articleView?id=customize_functions_a_h.htm&type=5 (https://help.salesforce.com/articleView?id=customize_functions_a_h.htm&type=5)
https://help.salesforce.com/articleView?id=customize_functions_i_z.htm&type=5 (https://help.salesforce.com/articleView?id=customize_functions_i_z.htm&type=5)
https://help.salesforce.com/articleView?id=customize_functions.htm&type=5 (https://help.salesforce.com/articleView?id=customize_functions.htm&type=5)
K R,
Guilherme
Use the below code for show list of SObject and related field API & data type.
Component===>
<aura:component controller="PickListOfobject">
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="objInfo" type="List"/>
<aura:attribute name="selectObjRelatedField" type="List"/>
<aura:attribute name="apiName" type="String[]"/>
<div class="slds-grid slds-wrap">
<div class="slds-col slds-size_6-of-12">
<span>
<lightning:select aura:id = "selectObj" onchange="{!c.doSomething}" label="Choose SObject:">
<aura:iteration items="{!v.objInfo}" var="vr">
<option value="{!vr}">{!vr}</option>
</aura:iteration>
</lightning:select>
</span>
</div>
<div class="slds-col slds-size_6-of-12">
<span>
<lightning:select aura:id = "selectField" onchange="{!c.ShowApi}" label="Choose Field:">
<aura:iteration items="{!v.selectObjRelatedField}" var="vrr">
<option value="{!vrr}">{!vrr}</option>
</aura:iteration>
</lightning:select>
</span>
</div>
</div>
<div class="slds-grid slds-grid_pull-padded-medium">
<div class="slds-col slds-p-horizontal_medium">
<span Style="margin-left:50px; margin-top:45px;">
<aura:iteration items="{!v.apiName}" var="vrR" indexVar="key">
{!vrR}
</aura:iteration>
</span>
</div>
</div>
</aura:component>
JS controller===>
({
doInit : function(component, event, helper)
{
console.log('doInit called::');
helper.fetchPickListVal(component, event, helper);
},
doSomething : function(component, event, helper)
{
console.log('doSomething called::');
helper.doSomethinghelper(component, event, helper);
},
ShowApi : function(component, event, helper)
{
console.log('ShowApi called::');
helper.ShowApihelper(component, event, helper);
}
})
Helper controller===>
({
fetchPickListVal: function(component, event, helper) {
console.log('fetchPickListVal called::');
var pickVal = component.get("c.getAllObjects");
pickVal.setCallback(this, function(response) {
var state = response.getState();
console.log('selectedValue :::'+state);
if (component.isValid() && state === "SUCCESS") {
component.set("v.objInfo", response.getReturnValue());
}
else {
console.log("Failed with state: " + state);
}
});
$A.enqueueAction(pickVal);
},
doSomethinghelper : function(component, event, helper){
console.log('doSomethinghelper called::');
var pickVal = component.get("c.getTestOptions");
var selectValue123 = component.find("selectObj").get("v.value");
console.log('selectedValue :::'+selectValue123);
pickVal.setParams({
"selectValue" : selectValue123
});
pickVal.setCallback(this, function(response) {
var state = response.getState();
if (component.isValid() && state === "SUCCESS") {
component.set("v.selectObjRelatedField", response.getReturnValue());
}
else {
console.log("Failed with state: " + state);
}
});
$A.enqueueAction(pickVal);
},
ShowApihelper : function(component, event, helper){
console.log('ShowApihelper called::');
var pickVal = component.get("c.getApiName");
var selectValue = component.find("selectObj").get("v.value");
var selectFieldObj = component.find("selectField").get("v.value");
console.log('selectedValuesss :::'+selectFieldObj);
pickVal.setParams({
"selectObj" : selectValue,
"selectField" : selectFieldObj
});
pickVal.setCallback(this, function(response) {
var state = response.getState();
var array = [];
array = response.getReturnValue().split(',');
console.log("Failed Todayt: " + state);
if (component.isValid() && state === "SUCCESS") {
component.set("v.apiName", array);
}
else {
console.log("Failed with state: " + state);
}
});
$A.enqueueAction(pickVal);
}
})
Apex Controller===>>
public class PickListOfobject {
@AuraEnabled
public static List<String> getAllObjects(){
List<string> SObjectList = new List<string>();
for(Schema.SObjectType objTyp : Schema.getGlobalDescribe().Values()){
String name = objTyp.getDescribe().getName();
String Label = objTyp.getDescribe().getLabel();
SObjectList.add(name);
SObjectList.add(Label);
System.debug( 'Name : ' + name);
}
return SobjectList;
}
@AuraEnabled
public static List<String> getTestOptions(String selectValue){
String ObjectName = selectValue;
List<String> FieldList = new List<String>();
Map<String , Schema.SObjectType> schemaGlobalDescription = Schema.getGlobalDescribe();
Schema.sObjectType objType = schemaGlobalDescription.get(ObjectName);
Schema.DescribeSObjectResult objDescribeSObjectResult = objType.getDescribe();
Map<String , Schema.SObjectField> mapFieldList = objDescribeSObjectResult.fields.getMap();
for(Schema.SObjectField field : mapFieldList.values())
{
Schema.DescribeFieldResult fieldResult = field.getDescribe();
if(fieldResult.isAccessible())
{
System.debug(fieldResult.getName());
FieldList.add(fieldResult.getLabel());
}
}
return FieldList;
}
@AuraEnabled
public static String getApiName(String selectObj , String selectField){
system.debug('fieldss::'+selectField);
system.debug('object::'+selectObj);
List<String> FieldDetail = New List<String>();
SObjectType type = Schema.getGlobalDescribe().get(selectObj);
Map<String,Schema.SObjectField> mfields = type.getDescribe().fields.getMap();
for(String strField:mfields.keySet())
{
Schema.DisplayType fielddataType = mfields.get(strField).getDescribe().getType();
SObjectField fl = mfields.get(strField);
if(selectField == fl.getDescribe().getlabel())
{
system.debug('datatype::'+fielddataType);
return +'API Name : '+strField +' DataType : '+fielddataType;
}
}
return null;
}
}
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
Would you please help me get the component visible at frontend. I've added the apex, controller, Helper and component.