Forum Replies Created

Viewing 20 posts - 1 through 20 (of 44 total)
  • #54156
    Forcetalks

    1.        “before” triggers to validate data or update fields on the same record being triggered.

    2.        “after” triggers to update parent or related records

    3.        “insert” for events that occur on record creation

    4.        “update” for events on existing records

    BEFORE trigger

    1.      BEFORE triggers are usually used when validation needs to take place before accepting the change. They run before any change is made to the database.

    2.      In case of validation check in the same object.

    3.      Insert or update the same object.

    AFTER trigger

    1.      AFTER triggers are usually used when information needs to be updated in a separate table due to a change.

    2.      They run after changes have been made to the database (not necessarily committed).

    3.      Insert/Update related object, not the same object.

    4.      Notification email.

    5.      We cannot use After trigger if we want to update a record because it causes read-only error. This is because after inserting or updating, we cannot update a record.

    #54155
    Forcetalks

    Apex class
    public class ScemaMultiDisplayEx {
    public list<selectOption>notSelectedOption{set;get;}
    public list<selectOption>SelectedOption{set;get;}
    public list<selectOption>SelecteObject {set;get;}
    public set<string>NotSelectedFields{set;get;}
    public set<string>SelectedFields{set;get;}
    public list<string>FieldNames{set;get;}
    Public list<string>nonSelected{set;get;}
    Public list<string>Selected{set;get;}
    public map<string,schema.SObjectType>ObjectMap    {set;get;}
    public map<string,schema.SObjectField>fieldMap {set;get;}
    public list<Sobject>result                     {set;get;}
    public string SelectedObject                   {set;get;}
    public ScemaMultiDisplayEx(){
    ObjectMap= new map<string,schema.SObjectType>();
    notSelectedOption= new list<selectOption>();
    SelectedOption= new list<selectOption>();
    SelecteObject=new list<selectOption>();
    NotSelectedFields= new set<string>();
    SelectedFields = new set<string>();
    Selected= new list<string>();
    nonSelected= new list<string>();
    ObjectMap=schema.getGlobalDescribe();
    fieldMap=new map<string,schema.SObjectField>();
    selectOption op = new selectOption(‘None’,’-None-‘);
    SelecteObject.add(op);
    notSelectedOption.add(op);
    SelectedOption.add(op);
    for(string s:ObjectMap.keySet()){
    selectOption op1= new selectOption(s,s);
    SelecteObject.add(op1);
    }
    }
    public void getOption(){
    schema.SObjectType obj = ObjectMap.get(SelectedObject);
    schema.DescribeSObjectResult res=obj.getDescribe();
    FieldMap=res.Fields.getMap();
    NotSelectedFields.addAll(fieldMap.keyset());
    getValue();
    //system.debug(NotSelectedFields);
    }
    public void getValue(){
    notSelectedOption.clear();
    SelectedOption.clear();
    Selectoption op= new selectoption(‘None’,’-None-‘);
    if(NotSelectedFields.size()>0){
    for(string ss: NotSelectedFields){
    selectoption p1= new selectoption(ss,ss);
    notSelectedOption.add(p1);
    }
    }else{
    notSelectedOption.add(op);
    }
    if(SelectedFields.size()>0){
    for(string s:SelectedFields){
    selectoption p= new selectoption(s,s);
    SelectedOption.add(p);
    }
    }else{
    SelectedOption.add(op);
    }
    }
    public void AddRecords(){
    NotSelectedFields.removeAll(Selected);
    SelectedFields.addAll(Selected);
    getValue();
    }
    public void RemoveRecord(){
    SelectedFields.removeAll(nonSelected);
    NotSelectedFields.addAll(nonSelected);
    getValue();
    }
    }
    Visulforce page
    <apex:page controller=”ScemaMultiDisplayEx” showHeader=”false” >
    <style>
    .b{
    width:200px;
    height:200px;
    color:Blue;
    }
    </style>
    <apex:form >
    <apex:pageBlock >
    Choose a Object <apex:selectList size=”1″ value=”{!SelectedObject}”>
    <apex:selectOptions value=”{!SelecteObject}”/>
    <apex:actionSupport event=”onchange” action=”{!getOption}” reRender=”one” />
    </apex:selectList>
    <apex:panelGrid columns=”3″ id=”one”>
    <apex:selectList multiselect=”true” value=”{!Selected}” styleClass=”b”>
    <apex:selectOptions value=”{!notSelectedOption}”/>
    </apex:selectList>
    <apex:panelGrid columns=”1″>
    <apex:commandButton value=”ADD” action=”{!AddRecords}” reRender=”one” />
    <apex:commandButton value=”DEL” action=”{!RemoveRecord}” reRender=”one” />
    </apex:panelGrid>
    <apex:selectList multiselect=”true” value=”{!nonSelected}” styleClass=”b”  >
    <apex:selectOptions value=”{!soption}”/>
    </apex:selectList>
    </apex:panelGrid>
    </apex:pageBlock>
    <apex:pageBlock title=”Records” rendered=”{! !Isnull(result)}”>
    <apex:pageBlockTable value=”{!result}” var=”a”>
    <apex:repeat value=”{!FieldNames}” var=”b”>
    <apex:column value=”{!a[b]}” />
    </apex:repeat>
    </apex:pageBlockTable>
    </apex:pageBlock>
    </apex:form>
    </apex:page>

    #53951
    Forcetalks

    Here is the code, you can use:

    Apex class

    public class ContactSearch {

    @AuraEnabled

    public static list<string>getAccount(){

    list<string>options= new list<string>();

    for(contact acc:[select name from Contact]){

    options.add(acc.name);

    system.debug(‘options name values’+options);

    }

    return options;

    }

    }

    Cmp

    <aura:component controller=”ContactSearch “>

    <!–start attributes here–>

    <aura:attribute name=”selectedOptions” type=”string”/>

    <aura:attribute name=”listOfOptions” type=”string[]”/>

    <aura:attribute name=”filteredOptions” type=”string[]”/>

    <aura:attribute name=”searchLookup” type=”string”/>

    <aura:attribute name=”searchKey” type=”string”/>

    <aura:attribute name=”placeholder” type=”string”/>

    <aura:attribute name=”actionMethod” type=”string”/>

    <aura:handler name=”init” value=”{!this}” action=”{!c.myAction}”/>

    <!– clse attributes here–>

    Conatct Search {!v.listOfOptions}

    <div class=”slds-form-element”>

    <div class=”slds-form-element__control”>

    <div class=”slds-combobox_container slds-has-inline-listbox”>

    <div class=”slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-combobox-lookup”

    aria-expanded=”false”

    aria-haspopup=”listbox”

    role=”combobox”

    aura:id=”searchLookup”>

    <div class=”slds-combobox__form-element slds-input-has-icon slds-input-has-icon_right” >

    <ui:inputText updateOn=”keyup”

    keyup=”{!c.keypress}”

    class=”slds-input slds-combobox__input”

    value=”{!v.searchKey}” />

    <aura:if isTrue=”{!empty(v.selectedOptions)}”>

    <span class=”slds-icon_container slds-icon-utility-search slds-input__icon slds-input__icon_right”

    title=”Description of icon when needed”>

    <lightning:icon iconName=”utility:search” size=”small” variant=”brand”/>

    <span class=”slds-assistive-text”>Description of icon</span>

    </span>

    <aura:set attribute=”else”>

    <button class=”slds-button slds-button_icon slds-input__icon slds-input__icon_right”

    onclick=”{!c.clear}”>

    <lightning:icon iconName=”utility:close” size=”small”/>

     

    <span class=”slds-assistive-text”>Remove selected option</span>

    </button>

    </aura:set>

    </aura:if>

    </div>

    <div id=”listbox-unique-id” role=”listbox”>

    <ul class=”slds-listbox slds-listbox_vertical slds-dropdown slds-dropdown_fluid”

    role=”presentation”>

    <aura:iteration items=”{!v.filteredOptions}” var=”option”>

    <li role=”presentation”

    class=”slds-listbox__item”

    onclick=”{!c.selectOption}”

    data-record=”{!option}”>

    <span id=”listbox-option-unique-id-01″

    class=”slds-media slds-listbox__option slds-listbox__option_entity slds-listbox__option_has-meta”

    role=”option”>

    <span class=”slds-media__body”>

    <span class=”slds-listbox__option-text slds-listbox__option-text_entity”>{!option}</span>

    </span>

    </span>

    </li>

    </aura:iteration>

    </ul>

    </div>

    </div>

    </div>

    </div>

    </div>

    </aura:component>

     

    Controller.js
    ({
    myAction : function(component, event, helper) {
    helper.helperMethod(component);
    },
    keypress:function(component,event,helper){
    var searchKey= component.get(“v.searchKey”);
    //alert(‘serach key value’+searchKey);
    var searchLookup=component.get(“v.searchLookup”);
    // alert(‘serach’+searchLookup);
    var searchLookup=component.find(“searchLookup”);
    //  alert(‘search key value is ‘+searchLookup);
    if(searchKey.length>0){
    $A.util.addClass(searchLookup,’slds-is-open’);
    $A.util.removeClass(searchLookup,’slds-combobox-lookup’);
    var options=component.get(“v.listOfOptions”);
    var filteredOptions=options.filter(function (el){
    return el.toLowerCase().indexOf(searchKey.toLowerCase())>-1;
    });
    component.set(“v.filteredOptions”,filteredOptions);
    }else{

    $A.util.addClass(searchLookup,’slds-combobox-lookup’);
    $A.util.removeClass(searchLookup,’slds-is-open’);
    }
    },
    clear: function (component, event, heplper) {
    var searchLookup = component.find(“searchLookup”);
    $A.util.addClass(searchLookup, ‘slds-combobox-lookup’);
    component.set(“v.selectedOptions”, null);
    component.set(“v.searchKey”, null);
    },
    selectOption: function (component, event, helper) {
    var selectedItem = event.currentTarget.dataset.record;
    alert(‘selected value is’+selectedItem);
    component.set(“v.selectedOptions”, selectedItem);
    var searchLookup = component.find(“searchLookup”);
    $A.util.removeClass(searchLookup, ‘slds-is-open’);
    component.set(“v.searchKey”, selectedItem);

    }
    })
    Helper.js
    ({
    helperMethod : function(component){
    var actionMethod = component.get(“v.actionMethod”);
    var action = component.get(“c.getAccount”);
    action.setCallback(this, function (response) {
    var state = response.getState();
    if (state === “SUCCESS”) {
    var options = response.getReturnValue();
    //  alert(‘Returned values’+response.getReturnValue());
    //console.log(options);
    component.set(“v.listOfOptions”, options);
    }
    });
    $A.enqueueAction(action);
    },
    })
    Application
    <aura:application extends=”force:slds” >
    <c:ComponentName/>
    </aura:application>

    #53664
    Forcetalks

    In salesforce junction object is a custom object which uses one instance of a record to many child records. A custom object with two master-detail relationships. Using a custom junction object, you can model a “many-to-many” relationship between two objects. For example, you may have a custom object called “Bug” that relates to the standard case object such that a bug could be related to multiple cases and a case could also be related to multiple bugs.

    #53663
    Forcetalks

    Salesforce can create skinny tables to contain frequently used fields and to avoid joins. This can improve the performance of certain read-only operations. Skinny tables are kept in sync with their source tables when the source tables are modified.

    Skinny tables can be created on custom objects, and on Account, Contact, Opportunity, Lead, and Case objects. They can enhance performance for reports, list views, and SOQL.

    Skinny tables can contain the following types of fields.

    ·         Checkbox

    ·         Date

    ·         Date and time

    ·         Email

    ·         Number

    ·         Percent

    ·         Phone

    ·         Picklist (multi-select)

    ·         Text

    ·         Text area

    ·         Text area (long)

    ·         URL

    Considerations

    ·         Skinny tables can contain a maximum of 100 columns.

    ·         Skinny tables can’t contain fields from other objects.

    ·         For Full sandboxes: Skinny tables are copied to your Full sandbox orgs.

    For other types of sandboxes: Skinny tables aren’t copied to your sandbox organizations. To have production skinny tables activated for sandbox types other than Full sandboxes, contact Salesforce Customer Support.

    #53661
    Forcetalks

    Below Fields that are automatically indexed in Salesforce are:

    ·         Name

    ·         CreatedDate

    ·         Systemmodstamp (LastModifiedDate)

    RecordTypeId
    RecordOwner
    Relationships (lookups and master-detail)
    Custom fields marked as External ID or Unique.

    #53386
    Forcetalks

    Here is step by step process for Salesforce MailChimp integration through an app.

    Firstly, install and configure the app in Salesforce. The app is quickly available at the Salesforce AppExchange for download.

    Once you have installed the app successfully, the next step is to define MailChimp sections to your content layouts. For this purpose, go to the Setup -> leads/Contacts -> Fields -> Layouts.

    In the Layout, you can see the VisualForce page. Simply drag and drop the Membership Contact section to the layout created by the MailChimp app you installed currently.

    For professional or unlimited editions, you can also add MC fields in the layout designer section. You have the flexibility to change the fields in the Layout Designer section.

    Don’t forget to save the changes at each step.

    Reference – https://www.janbask.com/blog/mailchimp-and-salesforce-integration/

    #53203
    Forcetalks

    Community Cloud is a social stage of the Salesforce.com that is intended to associate and encourage correspondence among an association’s representatives, accomplices and clients

    Whereas sites in Salesforce empowers you to make open sites and applications that are straightforwardly coordinated with your Salesforce association—without expecting clients to sign in with a username and secret key. You can freely uncover any data which has been put away in your association through a marked URL of your choice.

    #53202
    Forcetalks

    Salesforce testing is not a very easy thing to do. You can create apps without codes but when it comes to testing you need a substantial amount of coding skills. Here are 6 practical tips for testing in Salesforce-

    ·         Focus on Code Portability
    ·         Be mindful about your Code’s coverage
    ·         Always write your Test Case in Controllers and Classes
    ·         Perform Assert Based Testing
    ·         Always do the Testing for Bulk data first

    #53191
    Forcetalks

    Macros automate a progression of tedious keystrokes that help the specialists in making the Salesforce Console for Service. You can rapidly total monotonous errands, for example, refreshing the case status, by running a full-scale check of all activities. You can oversee Macros in Salesforce Classic. Salesforce Macros gives you a chance to accelerate the undertakings, for example, choosing the correct email layouts, computerizing customary assignments and so forth, with the goal that operators can invest their energy in accomplishing more essential things.

    #53161
    Forcetalks

    Represents a record that has been transferred to a library in Salesforce CRM Content or Salesforce Files. This object is accessible in renditions 17.0 and later for Salesforce CRM Content. This object is accessible in API variant 21.0 and later for Salesforce Files.

    The greatest number of archives that can be distributed is 30,000,000. For this reason, the filed documents check toward this limit and toward capacity use limits as well.

    #53160
    Forcetalks

    Lightning Locker uses various technologies and techniques to make Lightning Components secure. It is powerful security architecture for Lightning components. Locker Service enhances security by isolating Lightning components that belong to one namespace from components in a different namespace. Locker Service also promotes best practices that improve the supportability of your code by only allowing access to supported APIs and eliminating access to non-published framework internals.

    At a high level, Lightning Locker uses various technologies and techniques that are intended to do the following:

    Prevent:

    ·         Components from causing XSS and similar security issues

    ·         Components from reading other component’s rendered data without any restrictions

    ·         Components from calling undocumented/private APIs

    Enable:

    ·         Cool new features like client-side API versioning similar to REST API versioning*

    ·         Faster security review

    ·         Better and more secure JS development practices

    ·         Running 3rd party JS frameworks like React, Angular and so on*

    ·         Easily adding or removing new security features and policies’

    #53159
    Forcetalks

    In Salesforce we can Create 4 types of report formats

    Tabular Report: The basic form of presentation of user data is the tabular report. It has a simple listing of data without any subtotals. One can use this report if the presentation is simple.

    Summary Report: Summary reports are similar to tabular reports, but also allow users to group rows of data, view subtotals, and create charts.

    Matrix Report: Matrix reports allow you to group records both by row and by column. These reports are the most time-consuming to set up, but they also provide the most detailed view of our data. Like summary reports, matrix reports can have graphs and be used in dashboards.

    Join Report: Joined reports let you create different views of data from multiple report types. In a joined report, data is organized in blocks. Each block acts like a “sub-report,” with its own fields, columns, sorting, and filtering. You can add a chart to a joined report.

    You can delete mass reports in salesforce. In Setup, under Data Management > Mass Delete Records, select Mass Delete Reports then enter search criteria to find out reports it will display all records those meet your search criteria. Select the reports you want to delete.

    #53152
    Forcetalks

    We have two object account and contact. In this scenario, you have a contact object which has a lookup relationship to account. When processing the contact records in your trigger, you want to access some fields on the account via the relationship. Your trigger might look something like this:

    trigger parent2child on Account (after update) {

    list<id>ids = new list<id>();

    list<contact>conlist = new list<contact>();

    for(account a:trigger.new){

    ids.add(a.id);

    list<contact>con =[select id,phone,account.phone from contact where accountid in:ids];

    for(contact c:con){

    c.Phone=c.account.phone;

    conlist.add(c);

    }

    update conlist;

    }

    }

     

    • This reply was modified 2 weeks, 6 days ago by  William.
    #53151
    Forcetalks

    Managed packages in the Salesforce are used to distribute or sell app packages to customers. The packages can be created from developer edition in the Salesforce and they are displayed over the AppExchange framework for selling. At the same time, unmanaged packages are used to distribute open-source projects or templates with the basic building blocks of an application.

    #53150
    Forcetalks

    You can define multiple relationships between objects and two popular choices are master-detail relationships and many to many relationships in Salesforce. A master-detail relationship can be defined as the parent-child relationship where the master object controls the behavior of the detail object. For many-to-many relationships, one record of a particular object can be connected to multiple records of other objects simultaneously.

    #53071
    Forcetalks

    Workflow: Workflow is automated process, a point and click which doesn’t need any coding. When you want to take action (email, task, field update or outbound message) for the same object or from Child to parent object, you can use Workflow rules. You cannot perform DML operation on workflow. Workflows work only after some actions.

    Trigger: Trigger is a programmatic code approach which fires when before or after a record is inserted, updated or deleted. Using trigger you can work on multiple objects. You can query and you can perform any DML operation. The trigger works before and after some actions.

    #53070
    Forcetalks

    Before triggers are used to perform the logic on the same object and it triggers fired before the data saved into the database. For DML operation it required to commit with data base. So, we cannot use the DML operation on these triggers.

    As per Order of execution before trigger fire and then after trigger fire.

    Before insert event

    Data committed to database

    After insert event

    #52567
    Forcetalks

    For the organizations, which have a very large database CRM designing is a considerable and necessary aspect. They have to maintain hundreds or thousands of records. With database usually, many accounts are associated with the main account and this association of many accounts with a single account is known as data skew. Data skew can impact the performance of your CRM, so it is essential to prevent the data skew to get better performance of CRM by increasing the number of records, which may impact the CRM up to a great extent.

    #52223
    Forcetalks

    A Permission Set is a collection of settings and permissions that give users access .Permission sets can assign to users only can’t assign to profiles.

Viewing 20 posts - 1 through 20 (of 44 total)