Saturday, 17 November 2018

                                             Design Attribute In Salesforce:


Community1:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
 
    <aura:attribute name = "Name" type = "String"/>
    <aura:attribute name = "Phone" type = "String" />
    <aura:attribute name = "Position" type ="String"/>
    <p>
        Name: {!v.Name}
    </p>
    <p>
        Number: {!v.Phone}
    </p>
    <p>
        Position: {!v.Position}
    </p>
</aura:component>

Design Attributes:

<design:component  >
   <design:attribute name ="Name" label="Name"></design:attribute>
    <design:attribute name ="Phone" label="Phone Number"></design:attribute>
    <design:attribute name ="Position" label="Position" datasource = "CEO, President, Manager"></design:attribute>
</design:component>


 Design Attribute value  Specification:


If we add label for design attributes,component will change to design attribute name

<design:component label="design Practise" >
   <design:attribute name ="Name" label="Name"></design:attribute>
    <design:attribute name ="Phone" label="Phone Number"></design:attribute>
    <design:attribute name ="Position" label="Position" datasource = "CEO, President, Manager"></design:attribute>
</design:component>




Saturday, 10 November 2018


How to find the field data type of particular Object:

In this example,I had taken account as a example

String objType='Account';
Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
Schema.SObjectType leadSchema = schemaMap.get(objType);
Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();
system.debug('field map keyset'+fieldMap.keyset());
system.debug('values###'+fieldMap.values());
for (String fieldName: fieldMap.keySet()) {
//for finding name of the field 
String fieldLabel = fieldMap.get(fieldName).getDescribe().getLabel();
 system.debug('fieldLabel>>>>>'+fieldLabel);
//get data types for each fields like string,datetime etc..
Schema.DisplayType fielddataType = fieldMap.get(fieldName).getDescribe().getType();
    //system.debug('fieldtype>>>'+fielddataType);
    if(fielddataType == Schema.DisplayType.DateTime) {
system.debug('field type*********'+fielddataType);
}
}