How to deploy platform events using Apache ANT tool in Salesforce?

Sample package.xml:


force:createRecord example in Salesforce Lightning

Sample Code:


<aura:component implements="flexipage:availableForAllPageTypes">
    <lightning:button label="Create Account" variant="brand" onclick="{!c.createAccount}"/>


createAccount: function (component) {
        var createRecordEvent = $A.get('e.force:createRecord');
        if ( createRecordEvent ) {
                'entityApiName': 'Account',
                'defaultFieldValues': {
                    'Type' : 'Prospect',
                    'Industry' : 'Apparel',
                    'Rating' : 'Hot'
        } else {
            /* Create Record Event is not supported */
            alert("Account creation not supported");

Add the lightning component to any page. I have added it to the Account detail page.


How to query all non portal user roles in Salesforce?


SELECT Id, Name FROM UserRole WHERE PortalType = 'None'


lightning:layout in Salesforce

Represents a responsive grid system for arranging containers on a page. A lightning:layout is a flexible grid system for arranging containers within a page or inside another container. The default layout is mobile-first and can be easily configured to work on different devices.

Sample Code:

<aura:component implements="flexipage:availableForAllPageTypes" >
    <div class="c-container">
        <lightning:layout horizontalAlign="center">
            <lightning:layoutItem flexibility="auto" padding="around-small">
                <ui:inputSelect multiple="false">
                    <ui:inputSelectOption label="All Types" text="" value="true"/>
            <lightning:layoutItem flexibility="auto" padding="around-small">
                <button class="slds-button slds-button_brand">Search</button>
            <lightning:layoutItem flexibility="auto" padding="around-small">
    <ui:button label="New"/>



How to set default value in picklist in Lightning Component in Salesforce?

Lightning Component:

<aura:component access="global">
    <ui:inputSelect aura:Id="makeId" multiple="false" label="Select Make">
        <ui:inputSelectOption label="Acura" text="acura" value="true"/>
        <ui:inputSelectOption label="Audi" text="Audi"/>
        <ui:inputSelectOption label="BMW" text="bmw"/>
        <ui:inputSelectOption label="Honda" text="honda"/>
        <ui:inputSelectOption label="Hyundai" text="hyundai"/>
        <ui:inputSelectOption label="Mercedes Benz" text="merc"/>
        <ui:inputSelectOption label="Nissan" text="nissan"/>
    <ui:button label="Find Vehicles" press="{!c.findVehicles}"/>

here value="true" is used to set the default value.

Lightning Component Controller:

findVehicles : function(component, event, helper) {


When Find Vehicles button is clicked, selected value will be alerted on the screen.