Jade Global
CompanyForum Replies Created
-
Please check out : Trailhead.com
-
Jade
MemberDecember 6, 2018 at 9:15 am in reply to: Marketing Cloud for Campaign Activities in SalesforceSeems like Journey Builder can help here. Please check out this :
https://help.salesforce.com/articleView?id=mc_jb_campaign_member_activity.htm&type=5
-
Jade
MemberDecember 6, 2018 at 9:05 am in reply to: How to reassign (Draft) knowledge articles in Salesforce?Managing Article lifecycle could be tricky in Salesforce.
Please check out this link for the programmatic approach.
-
Jade
MemberNovember 23, 2018 at 9:32 am in reply to: Sharing Javascript between salesforce lightning componentsHi Kumar,
Lightning Component Framework is built on OOPS concept, not exactly but somehow. So to answer to your question, you can reuse the functions of one component's HELPER in another Component.
Lightning Component inheritance is similar to object-oriented inheritance in programming languages like Apex or Java. When a sub component extends a super component it inherits the super component’s attributes, event handlers, and helper methods. The controller methods of the super component can be called by the sub component but the documentation warns not to do that and suggests that it may become deprecated. The recommended approach is to use the helper for any super component code a sub component needs to use. Additionally, abstract components and interfaces can be created.
When you want to create a component that can be extended you must set a value of true for the extensible attribute of the aura:component. By default, components are not extensible, just like Apex classes are not. You must put {!v.body} inside your base component’s code. This will allow your base component to handle the events generated by Sub Components.
Super Component: Base.cmp
<aura:component extensible="true">
{!v.body}
</aura:component>
Super Component Helper: BaseHelper.js
({
callServer : function(component, method, callback, params, setStorable) {
var action = component.get(method);//Set params if any
if (params) {
action.setParams(params);
}if(setStorable){
actions.setStorable();
}action.setCallback(this,function(response) {
var state = response.getState();
if (state === "SUCCESS") {
// pass returned value to callback function
callback.call(this,response.getReturnValue());
} else if (state === "ERROR") {
// generic error handler
var errors = response.getError();
if (errors) {
console.log("Errors", errors);
this.showToast({
"title": "ERROR IN SERVER CALL",
"type": "error",
"message": errors
});
if (errors[0] && errors[0].message) {
throw new Error("Error" + errors[0].message);
}
} else {
throw new Error("Unknown Error");
}
}
});$A.enqueueAction(action);
},/*
* This function displays toast based on the parameter values passed to it
* */
showToast : function(params) {
var toastEvent = $A.get("e.force:showToast");
if(toastEvent){
if(!params){
toastEvent.setParams({
"title": "TOAST ERROR!",
"type": "error",
"message": "Toast Param not defined"
});
toastEvent.fire();
} else{
toastEvent.setParams(params);
toastEvent.fire();
}
} else{
alert(params.message);
}
},
})Sub Component: SubComponent.cmp - Extends Base Component in Component Definition
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes"
extends="c:Base" controller="AccountController" access="global" >
<aura:attribute name="data" type="Account[]"/>
<aura:handler name="init" action="{!c.doInit}" value="{!this}"/><aura:iteration items="{!v.data}" var="acc">
<p><lightning:formattedText value="{!acc.Name}" /></p>
</aura:iteration>
</aura:component>Sub Component Controller - SubComponentController.js
({
doInit : function(component, event, helper) {
helper.getAllAccounts(component, helper);
},
})
Sub Component Helper - SubComponentHelper.js
({
getAllAccounts : function(component, helper) {
//Calling base component's helper method to call Aura Method
helper.callServer(component, "c.getAccounts",
function(response){
if(response){
component.set("v.data", response);
//Calling showToast method of Base component
helper.showToast({
"title": "SUCCESS",
"type": "success",
"message": "Account details are loaded"
});
}
});
},
})
This is how you can share the same code between multiple components and avoid boiler plate codes.
Few Important Points :
- Attributes of the component markup, Controller and Helper methods gets inherited and can be used by Sub Components. Along with these, events are also get inherited which can be handled by both Base and Sub Components.
- You must make your base component, either abstract=true or extensible=true.
- Your Base component markup must include “{!v.body}”
Hope this will help.
Thanks
-
Jade
MemberNovember 23, 2018 at 8:57 am in reply to: What are the types of custom events in Salesforce Lightning condition?Hello Shradha,
Basically there are two types of Events as everyone answered -
Let me tell you the basic difference and when to choose what -
COMPONENT EVENT : It only works if one component is in Parent-child relationship with other component.
In Other words- To talk to a parent using the capture and bubbling mechanism, like with DOM events. Usually, one component is interested by the event, like an event aggregator.
Component must reference events by name, much like an aura:id, and retrieve them from its component (hence component.get()) value provider:
var evt = cmp.get("e.myEvent");
You would then declare myEvent on the component as:
<aura:registerEvent name="myEvent" type="namespace:eventName"/>
Declaring events on a component allows other components to call controller methods. You had to declare a handler:
<aura:handler name="myEvent" action="{!c.myEventHandler}"/>
That allowed you to call myEventHandler from another component and respect the interface:
component.get("e.myEvent").fire();
For Example refer this Link : https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_component_example.htm
APPLICATION EVENT : This will help you in communication between components which are not necessarily related.
In other words :
To broadcast to other components and not exclusively ancestors. Applications events can talk to many components that can be interested by the event. The broadcast can be boxed to an area of the DOM (everything below a DIV for example).
This is obtained from the global (hence $A.get()) event value provider:
var evt = $A.get("e.myNamespace:myEvent");
For Example Refer this link : https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_application_example.htm
Hope this will help.
Thanks
- This reply was modified 6 years ago by Jade.
-
Jade
MemberNovember 21, 2018 at 1:11 pm in reply to: What is difference between Sales cloud and service cloud in Salesforce?Hi Ankit,
Salesforce offers multiple flavors of Clouds for different kind of customer business needs. Sales and Service Clouds are offerings from Salesforce.
Sales cloud can be used while dealing with Prospect, Account, Opportunities, Forecasting, Quotas, Big Deals and to implement standard sales cycle for business.
Meanwhile, Service cloud deals with Cases, Entitlements, Milestones, Service console in order to facilitate Service Representatives to operate services and follow the support process.
-
Jade
MemberNovember 21, 2018 at 12:57 pm in reply to: what would be the best practise for connecting mailchimp with Salesforce?Hey Eiyu,
It seems like you are using MailChimp for Salesforce Campaigning.
If so you might consider using some of the recommended best practices in your implementation.