Forum Replies Created

Page 1 of 3
  • Achintya

    Member
    September 12, 2019 at 9:43 am in reply to: Explain Junction relationship (Many to Many ) in detail in salesforce.

    You can use master-detail relationships to model many-to-many relationships between any two objects. A many-to-many relationship allows each record of one object to be linked to multiple records from another object and vice versa. For example, you create 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. When modeling a many-to-many relationship, you use a junction object to connect the two objects you want to relate to each other.

    Junction Object
    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 create 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.

  • Achintya

    Member
    September 12, 2019 at 9:40 am in reply to: What is a notification builder in Salesforce?

    Notification Builder enables admins to create customized in-app notifications for the targeted audience. You can define when you want the notification to trigger, what message to display and which users to notify.

  • SOAP vs. REST

    SOAP – SOAP is a protocol which was designed before REST and came into the picture. The main idea behind designing SOAP was to ensure that programs built on different platforms and programming languages could exchange data in an easy manner.

    REST – This was designed specifically for working with components such as media components, files, or even objects on a particular hardware device. Any web service that is defined on the principles of REST can be called a RestFul web service. A Restful service would use the normal HTTP verbs of GET, POST, PUT and DELETE for working with the required components.

  • Achintya

    Member
    September 12, 2019 at 8:14 am in reply to: What is fieldset in Salesforce?

    Fieldset in salesforce is grouping the fields of same object type and it is very useful when we’re working with the managed package and reordering the fields in fieldset without touching the code.

    In the managed package you can’t edit either visualforce page or apex class, There comes a requirement change where you want to reorder the fields in visualforce page. For that you can go ahead with Field set concept and you can do reordering the fields in created Fieldset under standard or custom object

  • Achintya

    Member
    September 12, 2019 at 8:10 am in reply to: What is Map Class in Apex Salesforce?

    A map is a collection of key-value pairs where each unique key maps to a single value. In map Keys can be any primitive data type like string, integer, decimal, Id while values can be a primitive, sObject, collection type or an Apex object.
    Map keys and values can be of any data type—primitive types, collections, sObjects, user-defined types, and built-in Apex types.
    Map keys of type String are case-sensitive. Map methods, including put, get, containsKey, and remove treat these keys as distinct.
    The map gives value on the basis of the key.
    Key always unique but the value can be duplicated.

  • Component Events

    A component event is fired from an instance of a component. A component event can be handled by the component that fired the event or by a component in the containment hierarchy that receives the event. The component that fires an event is known as the source component. The component that fires an event can set the event’s data. To set the attribute values, call event.setParam() or event.setParams().

    Application Events

    Application event in simple words can be used in multiple components and component that has the handler for the event will be notified. To create a custom application event, you need to use the <aura: event> tag in the event resource. You need to define the type=” Application” tag. To use you need to register application event same way as the component event.

    To fire the application event you need to use event.setParam();

    Events are of the most widely used in lightning component. So when you should use which one is also important.

  • Achintya

    Member
    September 9, 2019 at 7:42 am in reply to: How to stop recursive trigger in Salesforce?

    To avoid recursive triggers you can create a class with a static Boolean variable with default value true. In the trigger, before executing your code keep a check that the variable is true or not. Once you check to make the variable false.

    Example:

    Apex Code:

    public Class checkRecursive
    {
        private static boolean run = true;
        public static boolean runOnce()
    {
        if(run)
    {
         run=false;
         return true;
        }
    else
    {
            return run;
    }}}

    Trigger Code:

    trigger updateTrigger on anyObject(after update)
    {
        if(checkRecursive.runOnce())
        {
        //write your code here           
        }
    }

     

  • Achintya

    Member
    September 9, 2019 at 7:37 am in reply to: What is the use of lightning:isUrlAddressable in Salesforce?

    To enable direct navigation to a Lightning component via URL, add the lightning:isUrlAddressable interface to the component. This interface is used with the lightning:navigation component to navigating from one component to the URL-addressable component. This navigation feature is supported only in Lightning Experience and the Salesforce App.

    The lightning:isUrlAddressable interface extends the lightning:hasPageReference interface. A component that implements lightning:isUrlAddressable then gets access to the page state through the pageReference attribute. The page state is a representation of the current URL query parameters.

    lightning:isUrlAddressable enables you to generate a user-friendly URL for a Lightning component with the pattern /cmp/componentName instead of the base-64 encoded URL you get with the deprecated force:navigateToComponent event.

  • Batchable calls were designed to allow for heavy asynchronous processing. But, it was the only asynchronous code at one point, and it was too "heavy" in terms of resource usage and had a lot of baggage associated with it. It required a long time to process and was often used only to handle callouts or things that were slightly longer than a normal transaction could handle.

    So, next came future methods. Unlike Batchable methods, they were lighter on resources and perfect for doing that job that Batchable was doing before, but much more efficiently. Unfortunately, it was too efficient. You didn't know when the job was done (no Job ID), and it only had a limited amount of space to store data (the reason why it only accepted primitives and collections thereof).

    In response to feedback, a third version of the asynchronous code was designed: Queueable. It was lighter than Batchable, but it gave you a Job ID and let you store complex data patterns. The lesser resources it used compared to batchable also meant higher limits. Queueable was meant to be a hybrid between the limited future methods and the resource-hungry Batchable interface.

    So, to get back to your question: you should always avoid passing in the entire SObjects, especially if they may change between serialization and execution. If you need heavy processing, you probably want Batchable, while if you want normal-sized transactions with increased limits, you probably want Queueable. Of course, you can still use future methods if you don't need to monitor the results of the execution, and they'll continue to work for the foreseeable future.

  • Achintya

    Member
    September 6, 2019 at 7:06 am in reply to: How to clear the Time based workflow action queue in salesforce?

    All pending actions to be triggered on a future date appear in the Workflow Queue. Here's how System administrators can view and manage the queue: Go to Setup | Customize | Monitor | Time-Based Workflow and delete the action which you don't want to fire.

    To view pending actions:

    1. From Setup, click Monitoring | Time-Based Workflow.
    2. Click Search to view all pending actions for any active workflow rules, or set the filter criteria and click Search to view only the pending actions that match the criteria. The filter options are:

    Workflow Rule Name: The name of the workflow rule.
    Object: The object that triggered the workflow rule. Enter the object name in the singular form.
    Scheduled Date: The date the pending actions are scheduled to occur.
    Create Date: The date the record that triggered the workflow was created.
    Created By: The user who created the record that triggered the workflow rule.
    Record Name: The name of the record that triggered the workflow rule.

    To cancel pending actions:
    Select the box next to the pending actions you want to cancel.
    Click Delete.

  • Achintya

    Member
    September 5, 2019 at 5:37 am in reply to: What are the steps of Approval Process in Salesforce?

    1.Use Jump start wizard – (one-step approval process)

    2. Use the Standard setup wizard. (complex approval processes)

    2. Perform automation to get approval for records.

    3. Select the object (Std/Custom)

    4. Specify conditions

    6. select an email template

    7. Select the approvers

    Let submit choose the approver manually
    Automatically assign and approver using standard and custome hirarchy feild
    Automatically assign to queue
    Automatically assign to approvers
    Approve r reject based on 1st approvers
    Require unanimous approval from all selected approvers
    8.Select the field to display approval page layout

    9.Initial submission

    the task, Email alert, Field update, Outbound message

    add more action

    10.Approve

    Final approval Action

    11.Reject

    final rejection action

    12. Recall

  • Achintya

    Member
    September 5, 2019 at 5:35 am in reply to: Explain three tier system of salesforce?

    MVC

    M- model, V-View, C-Controller

    Two-tier describes salesforce.com when using an API. The server provides the model and business logic services, while the client provides the client business logic and/or a view. This includes Visualforce that is AJAX-only, where the page is rendered by JavaScript or HTML, and all database calls are handled through JavaScript only. Mobile applications may also be considered in this category when using a native app.

    Three-tier can describe salesforce.com when using the GUI. The model provides database and business logic services, the controller can provide business and view logic services, and the view provides the graphical interface. The controller may be a standard controller, a hybrid of standard and custom controllers, or a pure custom controller.

    Four-tier describes the model salesforce.com uses most accurately; each tier can be individually tweaked or even replaced without necessarily needing to alter the other tiers, which is a requirement to be classified as a four-tier system. The model can have fields added, for example, without altering the other three layers. Similarly, a new database trigger can be added to the business logic layer without necessarily having to change the model, page controllers, or pages.

    The four-tier model is important to note because it is possible to interact with just certain layers. For example, you can truncate the model's data, or mass update a picklist value, without interacting directly with the business logic layer. By using the API, you can bypass the controller logic and view without bypassing the business logic or model. And, of course, you can build an application that treats salesforce.com as one layer of its own two or three-layer architecture.

    So, when you're asked if salesforce.com is a two-tier or three-tier application, you can say, "Well, actually, it uses four tiers." ... Or just stick with three-tier, since more people understand that than a four-tier system; just remember that MVC doesn't exactly describe the system 100%. It's more complex than that.

    • This reply was modified 5 years, 3 months ago by  Achintya.
  • Creating a managed package is just as easy as creating an unmanaged package. The only requirement to create a managed package is that you’re using a Developer Edition organization.

    Before creating a managed package:

    Review the information about managed packages in the ISVforce Guide to determine if this is the right type of package for your app.
    Optionally, install the License Management Application (LMA) from http://sites.force.com/appexchange. Search for License Management App to locate it. The License Management Application (LMA) tracks information about each user who installs your app. It allows you to track what users have which version, giving you a means of distributing information about upgrades. The License Management Application (LMA) can be installed in any Salesforce organization except a Personal, Group, or Professional Edition organization and does not need to be the same Salesforce organization that you use to create or upload the package, although it can be. You can also use the same License Management Application (LMA) to manage an unlimited number of your managed packages in different Developer Edition organizations.
    Configure your developer settings. Your developer settings specify your namespace prefix, the Salesforce organization where you install the License Management Application (LMA), and the unmanaged package you want to convert into a managed package.

  • Achintya

    Member
    September 4, 2019 at 12:15 pm in reply to: Can we used multiple controllers on a single visualforce page ?

    You can't directly reference the other classes (extensions) in the same page, but you can make variables static, assuming they participate in the form; this requirement exists because static variables are transient (do not serialize into the view state). A simple example follows:

    Page:

    <apex:page standardController="Account" extensions="ext1,ext2">
    <apex:form >
        <apex:inputText value="{!message}"/>
        <apex:outputText value="{!ext1message}"/>
    </apex:form>
    </apex:page>

    Ext1:

    public with sharing class ext1 {
        public static string message { get; set; }
    
        public ext1(ApexPages.StandardController controller) {
    
        }
    }

    Ext2:

    public with sharing class ext2 {
    
    public ext2(ApexPages.StandardController controller) {
    
    }
    
    public string getext1message() {
        return ext1.message;
    }
    }

    When you type a message and press Enter, it will be echoed back from ext2's getExt1Message() function. As you can see, you can use static variables. The caveat is that message is bound to a form element and will be submitted each time the page posts. Without the apex:inputText element, this code wouldn't work.

    Since your comments specify that it is a boolean value that is calculated, you should probably store the results of the value into an apex:inputHidden element so that the form will correctly pass the value between extensions.

  • Achintya

    Member
    September 4, 2019 at 10:12 am in reply to: how to upload files using Apex code in Salesforce?

    The easiest way to do this is by using inputFile and assign it to the ContentVersion instance. Like this:

    <apex:page controller="ContentController">
    <apex:form>
        <apex:inputFile value="{!file}" />
        <apex:commandbutton action="{!upload}" value="Upload" />
    </apex:form>
    </apex:page>

    Class:

    public class ContentController {
        public blob file { get; set; }
    
        public PageReference upload() {
            ContentVersion v = new ContentVersion();
            v.versionData = file;
            v.title = 'testing upload';
            v.pathOnClient ='/somepath.txt';
            insert v;
            return new PageReference('/' + v.id);
        }
    }

    If you want to share the ContentVersion file then after inserting DML query the ContentDocumentId from inserted ContentVersion and use ContentDocumentLink to create an association between Record and ContentVersion uploaded a file.

  • Lightning:treeGrid component displays hierarchical data in a table. Its appearance resembles lightning: data table, with the exception that each row can be expanded to reveal a nested group of items. Rows that contain nested data display a chevron icon to denote that they can be expanded or collapsed. Each column can be displayed based on the data type. Here is an example of lightning:datatable.

    Apex Controller:

    public class SampleAuraController {
         
        @AuraEnabled
        public static List <Account> getAccountList() {
            List<Account> accList = new List<Account>();
            accList = [SELECT Id, Name, NumberOfEmployees, Phone,
                       (SELECT FirstName, LastName, Email FROM Contacts)
                       FROM Account LIMIT 10];
            return accList;
        }
    }

    Lightning Component:

    <aura:component controller="SampleAuraController" implements="flexipage:availableForAllPageTypes" access="global">
        <aura:attribute type="Account[]" name="acctList"/>
        <aura:attribute name="gridColumns" type="List" />
        <aura:attribute name="gridData" type="Object" />
        <aura:attribute name="gridExpandedRows" type="Object" />
        <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
        <div class="slds-m-around_xx-large">
            <lightning:treeGrid aura:id="accTree" columns="{!v.gridColumns}" data="{!v.gridData}" keyField="Id"/>
        </div>
    </aura:component>

    Lightning Component JS Controller:

    ({
        doInit : function(component, event, helper) {
            var columns = [
                {
                    type: 'text',
                    fieldName: 'Name',
                    label: 'Account Name'
                },
                {
                    type: 'number',
                    fieldName: 'NumberOfEmployees',
                    label: 'Employees'
                },
                {
                    type: 'phone',
                    fieldName: 'Phone',
                    label: 'Phone Number'
                },
                {
                    type: 'text',
                    fieldName: 'FirstName',
                    label: 'First Name'
                },
                {
                    type: 'text',
                    fieldName: 'LastName',
                    label: 'Last Name'
                },
                {
                    type: 'email',
                    fieldName: 'Email',
                    label: 'Email'
                }
            ];
            component.set('v.gridColumns', columns);
            var action = component.get("c.getAccountList");
            action.setCallback(this, function(response){
                var state = response.getState();
                if (state === "SUCCESS" ) {
                    var resultData = response.getReturnValue();
                    for (var i=0; i<resultData.length; i++ ) {
                        resultData[i]._children = resultData[i]['Contacts'];
                        delete resultData[i].Contacts; 
                    }
                    component.set('v.gridData', resultData);
                }
            });
            $A.enqueueAction(action);
        }
    })
  • Achintya

    Member
    September 3, 2019 at 1:04 pm in reply to: What is ActionStatus ?

    ActionStatus visualforce component displays the status of an AJAX update request. An AJAX request can either be in progress or complete. It can be done using apex:actionStatus

    Depending upon the AJAX request status (whether AJAX request is in progress or complete), this component will display a different message to the user. In many scenarios, the AJAX request takes some time. So we should display some message to the user that your request is in progress. Once request is complete, we can display some different message to the user.

    Using actionstatus, we can also display some gif (Graphics Interchange Format), which shows to the user that their request is in progress. It gives a very good presentation to end-user.

  • There is an Email log that you could use. It's available in the setup menu under Monitoring.

    It's only for the past 30 days and you would have to manually check it.

    From the email log page: "Email logs describe all emails sent through salesforce.com and can be used to help identify the status of email delivery. Email logs are CSV files that provide information such as the email address of each email sender and its recipient, the date and time each email was sent, and any error code associated with each email. Logs are only available for the past 30 days."

  • Achintya

    Member
    September 3, 2019 at 12:16 pm in reply to: What is the use of actionfunction ?

    A component that provides support for invoking controller action methods directly from JavaScript code using an AJAX request. An <apex:actionFunction> component must be a child of an <apex:form> component.

    <apex:page controller="exampleCon">
      <apex:outputPanel onclick="methodOneInJavascript('Yes!')" styleClass="btn">
        </apex:outputPanel>
        <apex:form>
        <apex:actionFunction action="{!methodOne}" name="methodOneInJavascript" rerender="showstate">
            <apex:param name="firstParam" assignTo="{!state}" value="" />
        </apex:actionFunction>
        </apex:form>
    </apex:page>

    In the above visualforce page javascript method in the on-click event will call the apex controller method with the help of actionfunction.
    Apex controller. With the help of actionfunction we can able to make a call to the apex controller class.

    public class exampleCon
    {
        String uname;
        public String getUsername()
    {
            return uname;
        }
        public PageReference sayHello()
    {
            uname = UserInfo.getName();
            return null;
        }
        public void setState(String n){
            state = n;
        }     
        public String getState()
    {
            return state;
        }
       public PageReference methodOne()
    {
            return null;
        }
        private String state = 'no';
    }

     

  • Achintya

    Member
    August 30, 2019 at 10:09 am in reply to: Why Keyword “without Sharing” Is Introduced In Salesforce Apex?

    When we invoke some controller within another controller, If called or calling controller (only one) is attached with "with sharing " keyword then sharing rule will be enforced in both the class. to avoid that you need to use "without sharing" keyword in the controller in which sharing rules should not be enforced.

  • Achintya

    Member
    August 30, 2019 at 7:49 am in reply to: What is remote action in Salesforce?

    Remote action function in salesforce allows the user to access any method from any class through javascript methods, and get the result as a javascript object for further manipulation.

    While implementing remote action function remember:

    Remote action method should have @RemoteAction annotation. The method should also be Global and Static
    Implementation
    Let’s start with the controller code:

    global with sharing class ContactJs {  
    
        public ContactJs() { }  
        @RemoteAction
        global static list<Contact> getcon() {
            list<Contact> con1 = [SELECT id,name FROM contact limit 5];
            if(con1!=null && !con1.isEmpty()){        
                return con1;        
            }else{        
                return  new list<contact>();        
            }
        }
    }

    Now the Visualforce Page:

    <apex:page controller="ContactJs">
        <script type = "text/javascript">
        function getRemoteContact() {
            var a;
            Visualforce.remoting.Manager.invokeAction(
                '{!$RemoteAction.ContactJs.getcon}',
                function(result, event){
                   if(event.status){
                        document.getElementById('remoteContactId').innerHTML = 'Contact Name: <br/><br/>';
                        for(a=0;a<result.length;a++){                        
                            document.getElementById('remoteContactId').innerHTML +=  result[a].Name +'<br/>';                    
                        }                                       
                   }               
                },
                {escape: true}
            );
        }
        </script>
        <button onclick="getRemoteContact()">Get Contact</button>
        <div id="responseErrors"></div>
        <apex:pageBlock id="block">        
            <apex:pageBlockSection id="blockSection" columns="2">
                    <span id="remoteContactId"></span>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:page>

     

  • Salesforce is a customer relationship management solution that brings companies and customers together. It's one integrated CRM platform that gives all your departments — including marketing, sales, commerce, and service — a single, shared view of every customer. Salesforce is a cloud computing service as a software (SaaS) company that specializes in customer relationship management (CRM). Salesforce's services allow businesses to use cloud technology to better connect with customers, partners, and potential customers.

  • Achintya

    Member
    August 29, 2019 at 7:52 am in reply to: What is corn expression in Salesforce?

    A CRON expression is a string of five to six fields which are separated by white spaces that represents a set of times, normally as a schedule to execute some routine. Use schedule with an Apex class that implements the Schedulable interface to schedule the class to run at the time specified by a Cron expression.

  • Achintya

    Member
    August 29, 2019 at 5:35 am in reply to: Why we use try and catch block in test classes in Salesforce ?

    You can use try-catch inside a test class, and this is how you can test a class which you have written and that will throw an exception.

    Like if your class includes something like this

    if (aSomeTestCondition == true) {
    } else {
    Exception e = new myClassException();
    e.setMessage('Incorrect aSomeTestCondition');
    throw e;
    }

    Then your test class would include code to cause this error, and would include a try catch like this

    try {
    Test.startTest();
    //Call your class in a way that causes the exception
    Test.stopTest();
    } catch (myClass.myClassException e) {
    System.assertEquals('Incorrect bSomeTestCondition', e.getMessage());
    }

  • 1. Download the .zip file of Ant Migration Tool.

    2. Save the .zip file locally, and extract the contents to the directory of your choice.

    After Extracting, a list of following files appear

    *A Readme.html file that explains how to use the tools
    *A Jar file containing the ant task: ant-salesforce.jar
    *A sample folder containing:A codepkgclasses folder that contains SampleDeployClass.cls and   SampleFailingTestClass.cls
    *A codepkgtriggers folder that contains SampleAccountTrigger.trigger
    *A mypkgobjects folder that contains the custom objects used in the examples
    *A removecodepkg folder that contains XML files for removing the examples from your organization
    *A sample build.properties file that you must edit, specifying your credentials, in order to run the sample ant tasks in build.xml
    *A sample build.xml file, that exercises the deploy and retrieve API calls

    Then follow below listed steps

    1. Enter credentials and connection information for source Salesforce organization in build.properties.
    2. Create retrieve targets in build.xml.
    3. Construct a project manifest in package.xml.
    4. Run the Ant Migration Tool to retrieve metadata files from Salesforce.
    5. Enter credentials and connection information for destination Salesforce organization in build.properties.
    6. Run the Ant Migration Tool to deploy metadata files or deletions to Salesforce.

Page 1 of 3