Wednesday, June 28, 2017

Lightning: Advanced Events Example

This example is built on the simpler component and application event examples. It uses one notifier component and one handler component that work with both component and application events.


<!--c:compEvent-->
<aura:event type="COMPONENT">
<!-- pass context of where the event was fired to the handler. -->
<aura:attribute name="context" type="String"/>
</aura:event>
<!--c:appEvent-->
<aura:event type="APPLICATION">
<!-- pass context of where the event was fired to the handler. -->
<aura:attribute name="context" type="String"/>
</aura:event>
view raw compEvent.evt hosted with ❤ by GitHub

<!--c:eventsNotifier-->
<aura:component>
<aura:attribute name="parentName" type="String"/>
<aura:registerEvent name="componentEventFired" type="c:compEvent"/>
<aura:registerEvent name="appEvent" type="c:appEvent"/>
<div>
<h3>This is {!v.parentName}'s eventsNotifier.cmp instance</h3>
<p>
<lightning:button label="Click here to fire a component event" onclick="{!c.fireComponentEvent}" />
</p>
<p>
<lightning:button label="Click here to fire an application event" onclick="{!c.fireApplicationEvent}" />
</p>
</div>
</aura:component>
/* eventsNotifierController.js */
{
fireComponentEvent : function(cmp, event) {
var parentName = cmp.get("v.parentName");
// Look up event by name, not by type
var compEvents = cmp.getEvent("componentEventFired");
compEvents.setParams({ "context" : parentName });
compEvents.fire();
},
fireApplicationEvent : function(cmp, event) {
var parentName = cmp.get("v.parentName");
// note different syntax for getting application event
var appEvent = $A.get("e.c:appEvent");
appEvent.setParams({ "context" : parentName });
appEvent.fire();
}
}
/* eventsNotifier.css */
.cEventsNotifier {
display: block;
margin: 10px;
padding: 10px;
border: 1px solid black;
}

<!--c:eventsHandler-->
<aura:component>
<aura:attribute name="name" type="String"/>
<aura:attribute name="mostRecentEvent" type="String" default="Most recent event handled:"/>
<aura:attribute name="numComponentEventsHandled" type="Integer" default="0"/>
<aura:attribute name="numApplicationEventsHandled" type="Integer" default="0"/>
<aura:handler event="c:appEvent" action="{!c.handleApplicationEventFired}"/>
<aura:handler name="componentEventFired" event="c:compEvent" action="{!c.handleComponentEventFired}"/>
<div>
<h3>This is {!v.name}</h3>
<p>{!v.mostRecentEvent}</p>
<p># component events handled: {!v.numComponentEventsHandled}</p>
<p># application events handled: {!v.numApplicationEventsHandled}</p>
<c:eventsNotifier parentName="{#v.name}" />
</div>
</aura:component>
/* eventsHandlerController.js */
{
handleComponentEventFired : function(cmp, event) {
var context = event.getParam("context");
cmp.set("v.mostRecentEvent",
"Most recent event handled: COMPONENT event, from " + context);
var numComponentEventsHandled =
parseInt(cmp.get("v.numComponentEventsHandled")) + 1;
cmp.set("v.numComponentEventsHandled", numComponentEventsHandled);
},
handleApplicationEventFired : function(cmp, event) {
var context = event.getParam("context");
cmp.set("v.mostRecentEvent",
"Most recent event handled: APPLICATION event, from " + context);
var numApplicationEventsHandled =
parseInt(cmp.get("v.numApplicationEventsHandled")) + 1;
cmp.set("v.numApplicationEventsHandled", numApplicationEventsHandled);
}
}
/* eventsHandler.css */
.cEventsHandler {
display: block;
margin: 10px;
padding: 10px;
border: 1px solid black;
}

<aura:application extends="force:slds">
<c:eventsHandler name="eventsHandler1"/>
<c:eventsHandler name="eventsHandler2"/>
</aura:application>

Reference: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_demo.htm
Share This:    Facebook Twitter

Tuesday, June 27, 2017

Links: Salesforce Developers Blog

Lightning

Building a Lightning Connect Proof of Concept
Communicating between Lightning Components and Visualforce Pages
Create your own Lightning Progress Bar
Create a Lightning Component for Drag-and-Drop Profile Pictures
Creating a Lightning Weather Component
Creating a Salesforce Lightning Map Component
Creating Lightning Components: Events and Messaging
Creating Loosely Coupled Components with the Lightning Component Framework and App Builder
danpeter's Blog Posts
Debugging Lightning Components
Extending Lightning Components by Example
Introducing the Salesforce Lightning Inspector
JavaScript Buttons, Lightning, and You: A Blog Series
Lightning Components Best Practices: Caching Data with Storable Actions
Lightning Inter-Component Communication Patterns
Loading External JavaScript And CSS Libraries To Lightning Components
LockerService and Lightning Container Component: Securely Using Third-Party Libraries in Lightning Components
Mass Update Leads Using the Lightning Component Framework
Mastering Salesforce Lightning Design System Grids and Lightning Layouts
Modularizing Code in Lightning Components
New Version of DreamHouse Packed with New Lightning Features
Salesforce Lightning inputLookup: the missing component
Summer ’17 Highlight: Diving Into Lightning Data Service
Understanding System Events In Lightning Components – Part 1
Understanding System Events In Lightning Components – Part 2


Data Model

Simplify Your Salesforce Data with Custom Metadata Type Relationships
Salesforce Data Security Model — Explained Visually
Introducing custom metadata types: the app configuration engine for Force.com
Integrating Multiple Orgs using the OAuth 2.0 SAML Bearer Assertion Flow


SOQL

SOQL for the SQL Developer
Basic SOQL Relationship Queries


Declarative Tools

Enhancing Workflows with The Weather Company Data service
Lightning Process Builder: Taking Point-and-Click Development to a New Level
Cross-Object Owner Fields: A Powerful New Formula Option
Lightning Process Builder Hot Topics: Q&A with Product Manager, Shelly Erceg


Lightning Training

https://www.salesforce.com/services-training/learnlightning.jsp
Creating Lightning Components: Single Page Applications


Apex

Trust, but Verify: Apex Metadata API and Security
Introducing the Apex Metadata API
Machine-to-Machine Salesforce Integrations in Java with REST and SOAP
Integrating With Salesforce Using Apex
Testing Apex Callouts using HttpCalloutMock
Force.com SOAP API Sample WSDL Structures
Avoiding Apex Speeding Tickets (Concurrent Request Limits via Synchronous Callouts)
Introducing Lightning Connect Custom Adapters
Queueable Apex: More Than an @future


Share This:    Facebook Twitter

force:showToast and force:closeQuickAction events

<!--quickAdd.cmp-->
<aura:component implements="force:lightningQuickAction" >
<lightning:input type="number" name="myNumber" aura:id="num1" label="Number 1"/>
<lightning:input type="number" name="myNumber" aura:id="num2" label="Number 2"/>
<br/>
<lightning:button label="Add" onclick="{!c.clickAdd}"/>
</aura:component>
view raw quickAdd.cmp hosted with ❤ by GitHub
/*quickAddController.js*/
({
clickAdd: function(component, event, helper) {
// Get the values from the form
var n1 = component.find("num1").get("v.value");
var n2 = component.find("num2").get("v.value");
// Display the total in a "toast" status message
var resultsToast = $A.get("e.force:showToast");
resultsToast.setParams({
"title": "Quick Add: " + n1 + " + " + n2,
"message": "The total is: " + (n1 + n2) + "."
});
resultsToast.fire();
// Close the action panel
var dismissActionPanel = $A.get("e.force:closeQuickAction");
dismissActionPanel.fire();
}
})

One more example: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_using_lex_s1_config_action_recordid.htm

Share This:    Facebook Twitter

Monday, June 19, 2017

Understanding __c and __r


I will use the Property__c and Broker__c sobjects. When a relationship is created between these two sobjects, the following fields are created in salesforce schema of these objects.

Property__c (child):
global Id Broker__c;
global Broker__c Broker__r;

Broker__c (parent):
global List<Property__c> Properties__r;

Upward traversal: get fields of parent object for a given child object


Downward traversal: get fields of child object for given parent object


Reference: http://11concepts.com/sfdc/blog/understanding-__c-and-__r/
Share This:    Facebook Twitter

Saturday, June 17, 2017

SOAP UI - TLS 1.0 has been disabled in this organization.Please use TLS 1.1 or higher when connecting to Salesforce using https

Solution:
Step 1: Navigate to C:\Program Files\SmartBear\SoapUI-5.3.0\bin folder.
Step 2: Edit SoapUI-5.2.1.vmoptions file with System admin permission in any text editor.
Step 3: Add following entry and save the file. It will only enable TLS 1.2 protocol.
-Dsoapui.https.protocols=TLSv1.2
Step 4: Close and Re-launch the Soap UI.
Share This:    Facebook Twitter

Total Pageviews

510017

My Social Profiles

View Sonal's profile on LinkedIn

Tags

__proto__ $Browser Access Grants Accessor properties Admin Ajax AllowsCallouts Apex Apex Map Apex Sharing AssignmentRuleHeader AsyncApexJob Asynchronous Auth Provider AWS Callbacks Connected app constructor Cookie CPU Time CSP Trusted Sites CSS Custom settings CustomLabels Data properties Database.Batchable Database.BatchableContext Database.query Describe Result Destructuring Dynamic Apex Dynamic SOQL Einstein Analytics enqueueJob Enterprise Territory Management Enumeration escapeSingleQuotes featured Flows geolocation getGlobalDescribe getOrgDefaults() getPicklistValues getRecordTypeId() getRecordTypeInfosByName() getURLParameters Google Maps Governor Limits hasOwnProperty() Heap Heap Size IIFE Immediately Invoked Function Expression Interview questions isCustom() Javascript Javascript Array jsForce Lightning Lightning Components Lightning Events lightning-record-edit-form lightning:combobox lightning:icon lightning:input lightning:select LockerService Lookup LWC Manual Sharing Map Modal Module Pattern Named Credentials NodeJS OAuth Object.freeze() Object.keys() Object.preventExtensions() Object.seal() Organization Wide Defaults Override PDF Reader Performance performance.now() Permission Sets Picklist Platform events Popup Postman Primitive Types Profiles Promise propertyIsEnumerable() prototype Query Selectivity Queueable Record types Reference Types Regex Regular Expressions Relationships Rest API Rest Operator Revealing Module Pattern Role Hierarchy Salesforce Salesforce Security Schema.DescribeFieldResult Schema.DescribeSObjectResult Schema.PicklistEntry Schema.SObjectField Schema.SObjectType Security Service Components Shadow DOM Sharing Sharing Rules Singleton Slots SOAP API SOAP Web Services SOQL SOQL injection Spread Operator Star Rating stripInaccessible svg svgIcon Synchronous this Token Triggers uiObjectInfoApi Upload Files VSCode Web Services XHR
Scroll To Top