Forum Replies Created

Page 9 of 10
  • Piyush

    Member
    August 29, 2019 at 3:23 am in reply to: Why does Salesforce impose governor limit?

    Hi Achintya,

    Salesforce runs on a multi-tenancy environment and in order to have the same performance to the database, it has imposed some runtime limits called governor limits.

    Governor limits are Salesforce's way of forcing you to write efficient, scalable code. The good: Governor limits prevent other orgs from writing bad code and taking up all the cloud CPU.

  • Hi Nikita,

    1. Actions:-User interaction with an element on a component or app. User actions trigger events, but events aren’t always explicitly triggered by user actions. This type of action is not the same as a client-side JavaScript controller, which is sometimes known as a controller action. The following button is wired up to a browser onclick event in response to a button click.
    2. Events:-A notification by the browser regarding an action. Browser events are handled by client-side JavaScript controllers, as shown in the previous example. A browser event is not the same as a framework component event or application event, which you can create and fire in a JavaScript controller to communicate data between components. For example, you can wire up the click event of a checkbox to a client-side controller, which fires a component event to communicate relevant data to a parent component.
  • Piyush

    Member
    August 27, 2019 at 5:45 am in reply to: What is the best way to manage leads in Sales Cloud in Salesforce?

    Hi Achintya,

    Best way to manage leads in salesforce:-

    There are 7 Steps  to manage leads in Sales Cloud in Salesforce:-

    1. Capture more leads
    2. Check whether you have duplicate lead records
    3. Follow lead qualification requirements
    4. Consider how to prioritize leads and distribute them among sales reps
    5. Keep your leads moving towards the conversion point
    6. Nurture your leads
    7. Track your lead management effectiveness
  • Piyush

    Member
    August 26, 2019 at 7:46 am in reply to: How to explain exception handling in Salesforce?

    Hi Sirichandan,

    An exception denotes an error that disrupts the normal flow of code execution. You can use Apex built-in exceptions or create custom exceptions. All exceptions have common methods.

    1. AsyncException:- Any problem with an asynchronous operation, such as failing to enqueue an asynchronous call.
    2. JSONException:- Any problem with JSON serialization and deserialization operations. For more information, see the methods of System.JSON, System.JSONParser, andSystem.JSONGenerator.
    3. XmlException:- Any problem with the XmlStream classes, such as failing to read or write XML.
    4. EmailException:- Any problem with email, such as failure to deliver. For more information, see Outbound Email.
    5. InvalidParameterValueException:- An invalid parameter was supplied for a method or any problem with a URL used with Visualforce pages. For more information on Visualforce, see the Visualforce Developer's Guide.
    6. BigObjectException:- Any problem with big object records, such as connection timeouts during attempts to access or insert big object records.
  • Piyush

    Member
    August 26, 2019 at 4:35 am in reply to: Is it possible to schedule an apex class?

    Hi Deepak,

    Yes, it possible to schedule an apex class. You have to choose weekly radio button from the frequency and select all the checkboxes(Sunday to Saturday):-

    1.  Navigate to Setup, search for Apex in the Quick Find box, then select Apex Classes.
    2.  Click Schedule Apex.
    3. Enter the job name, Example – Daily Account Update.
    4. Click the lookup button to search Apex class and select the class.
    5.  Select Weekly  for the frequency and select all the checkboxes.
    6.  Select the start and end dates, and also the preferred start time.
    7.  Click Save.
  • Hi Deepak,

    Future Method :-

    1. For avoiding Mixed_DML_Operations exception, we will be going for future method where it will be running in asynchronous mode when the system resource becomes available.
    2. If you want to perform complex DML operations and want to make external webservice @future(callout=true) means you can go for future method.
    3. Future method should be static and return type is void, parameters must be primitive types, sObjects are not accepted as future method parameters.

    Queueable Apex :-

    1. It comes in handy , when you need to have both the operations of Batch and future method and it should implement Queueable Interface.
    2. If one job is dependent on other job means here we can chain the dependent job in execute method by system.enqueuejob(new secondJob());
    3. You can also able to chain upto 50 jobs and in developer edition you can able to chain upto 5 jobs only.
    4. It will accept non-primitive types like sObjects and it also runs in asynchronous mode.
    5. In this Queueable apex you can get Job Id to monitor the job progress.
  • Piyush

    Member
    August 23, 2019 at 3:59 am in reply to: How to execute Apex from Custom button or Javascript in salesforce ?

    HI Prachi,

    We can call any apex method through JavaScript by following function:
    sforce.apex.execute(“class_Name”,”Method_Name”,{Parameter_Name:Parameter_Value});

     

  • Hi Prachi,

    Simply use the ALL ROWS clause.

    SELECT Id, isDeleted FROM <Oblectname> WHERE isDeleted = true All ROWS – This will only return the deleted rows.
    SELECT Id, isDeleted FROM <Oblectname> WHERE isArchived = true All ROWS – This will only return the archived rows.
    SELECT Id, isDeleted FROM <Oblectname> All ROWS – This will return the deleted records, archived records and records that are neither deleted nor archived (data set identical to the one returned by a SOQL not using ALL ROWS) as well.

    You can-not use ALL ROWS and FOR UPDATE together.

    Thanks.

  • Piyush

    Member
    August 23, 2019 at 3:29 am in reply to: How can you update Salesforce record using Apex?

    Hi Prachi,

    Using Dynamic Apex we can achieve this :

    //Lets assume this is record Id
    Id recId = ‘a0P9000000ESXcV’;
    Schema.SObjectType token = recId.getSObjectType();
    Sobject s = token.newSobject();
    s.put(‘Id’,recId );
    s.put(‘Name’, ‘om’);
    update s;

  • Hi Prachi,

    We cannot use Datetime as condition in Where Clause in between single Quotes.

    You can do something like this ,

    WHERE CreatedDate > 2005-10-08T00:00:00Z

    Or, you can also use Date Literals like

    WHERE CreatedDate > YESTERDAY

  • Piyush

    Member
    August 22, 2019 at 3:44 am in reply to: When records are created in Salesforce?

    Hi prachi,

    If newly created records are equal to or less than 9000, then it will be indexed in 1 to 3 minutes. However if records are more than 9000, then servers perform bulk indexing at a lower priority, so processing might take longer.

  • Hi Prachi,

    apex:pageBlockTable

    1) uses salesforce styling
    2) No need to specify the headers
    3) mandatory attribute "value".

    apex:dataTable

    1) Need to specify the headers
    2) we can specify custom style classes.
    3) No mandatory attribute "value" unlike in pageblockTable

  • Piyush

    Member
    August 22, 2019 at 3:33 am in reply to: How to get the Recordtype Id using Dynamic Apex in salesforce?

    Hi Prachi,

    Normally to get the RecordtypeId for any sObject we use SOQL and it will count against your limit. So below method will bypass the need of SOQL Query.

    Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe() ;
    Schema.SObjectType s = m.get(‘API_Name_Of_SObject’) ;
    Schema.DescribeSObjectResult cfrSchema = s.getDescribe() ;
    Map<String,Schema.RecordTypeInfo> RecordTypeInfo = cfrSchema.getRecordTypeInfosByName();
    Id rtId = RecordTypeInfo.get(‘Record Type Name’).getRecordTypeId();

  • Piyush

    Member
    August 22, 2019 at 3:30 am in reply to: How to get “https” link for Visualforce page in Salesforce?

    Hi Prachi,

    Use this to get “https” link instead of “http” for Visualforce page using URLFOR() in Email Template:-

    <a href='{!SUBSTITUTE(URLFOR('/apex/SomePage', null, [id=Some_Object__c.Id,retURL="/apex/SomeOtherPage"]),'http:','https:')}'>Go to SomePage here!</a>

  • Hi Prachi,

    You can check it with the following API call:-

    SELECT Id, InstanceName, IsSandbox, Name, OrganizationType FROM Organization

  • Hi Deepak,

    Looks like you're just missing some closing parenthesis on your second to last line

    NOT((OR(RecordType.Name != "Customer",RecordType.Name != "Customer 2"),

    should be

    NOT((OR(RecordType.Name != "Customer",RecordType.Name != "Customer 2"))),

    to be syntactically correct.

  • Piyush

    Member
    August 21, 2019 at 3:43 am in reply to: What is the use of Global PickList in SFDC?

    A global picklist is a restricted picklist by nature. Only a Salesforce admin can add to or modify its values. Users can’t add unapproved values, even through the API.

    From Setup, enter Picklist in the Quick Find box, then select Picklist Value Sets.
    Next to Global Value Sets, click New.
    Enter a label for the global value set. This name appears in Setup, and when users create a picklist based on this global value set.
    To tell users what these values are for, enter a specific description of the global value set. This text appears on the Picklist Value Sets list page in Setup.
    Enter the values, one per line.
    Optionally choose to sort the values alphabetically or to use the first value in the list as the default value, or both. You can’t change these settings later.
    If you select both options, Salesforce alphabetizes the entries and then sets the first alphabetized value as the default.
    Click Save.

    Your global value set is ready to be used in custom picklist fields. You can reorder the values by clicking Reorder.

  • Hi Deepak,

    if you are want to query the same object type but with multiple different WHERE selection clauses, and you then want to just apply the same logic to them, this is a simple matter of appropriately parenthesizing and combining the clauses into a single WHERE.

    For example, if your first query is looking for instances matching:

    A__c = '123' AND B__c = 'xyz'

    while your second query is looking for instance matching:

    A__c = '987' AND (B__c = 'abc' OR C__c = 999)
    then you can construct your query as:

    SELECT Id, ... FROM MyObject__c WHERE
    (A__c = '123' AND B__c = 'xyz') OR
    (A__c = '987' AND (B__c = 'abc' OR C__c = 999))

  • While creating report type you found 'Store in Category' picklist Option, in that you specified some folder..check that folder then you can get all the reports..

  • Piyush

    Member
    August 20, 2019 at 3:45 am in reply to: What is the sequence of event propagation in Salesforce?

    The event propagation mode determines in which order the elements receive theevent. With bubbling, the event is first captured and handled by the innermost element and then propagated to outer elements. With capturing, the event is first captured by the outermost element and propagated to the inner elements.

    Sequence of event propagation is:-

    1. Event capturing
    2. Event bubbling
  • Piyush

    Member
    August 20, 2019 at 3:40 am in reply to: What is force:hasRecordId in Salesforce Lightning Components?

    Hi Nikita,

    force:hasRecordId interface is a Lightning component which enable the component to be assigned the ID of the current record. The current record ID is useful if the component is used on a Lightning record page, as an object-specific custom action or action override in Lightning Experience or the Salesforce app, and so on.

    If your component implements force:hasRecordId, you don’t need to add a recordId attribute to the component yourself. If you do add it, don’t change the access level or type of the attribute or the component will cause a runtime error.

    The recordId attribute is set only when you place or invoke the component in an explicit record context. For example, when you place the component directly on a record page layout, or invoke it as an object-specific action from a record page or object home. In all other cases, such as when you invoke the component as a global action, or create the component programmatically inside another component, recordId isn’t set, and your component shouldn’t depend on it.

  • Insert:

    • A partial insert is not supported.
    • Rollback is not supported.
    • If we use the DML statement (Insert) in bulk operation, then if an error occurs the execution will stop. In that case, Apex code throws an error and none of the records will insert to the database.

    Database.Insert:

    • Database methods are static methods available in Database class.
    • A partial insert is supported.
    • Rollback is supported.
    • Includes the optional all-or-none parameters that default true.
    • If we use DML database methods (Database.Insert) in bulk operation, then if an error occurs the remaining records will be inserted/updated means partial DML operation will be done. The only record throwing an error will not be inserted/updated.
  • Piyush

    Member
    August 19, 2019 at 6:00 am in reply to: What is the use of setAbortable() in lightning Component?

    A component is automatically destroyed and marked invalid by the framework when it is unrendered. Mark a server-side action as abortable by using the setAbortable() method on the Action object in JavaScript.

    An abortable action is sent to the server and executed normally unless the component that created the action is invalid before the action is sent to the server.

    example:-

    var action = cmp.get("c.serverEcho");
    action.setAbortable();

  • Piyush

    Member
    August 19, 2019 at 5:53 am in reply to: What is the use of Salesforce lightning dualbox in sfdc?

    A lightning:dualListbox component represents two side-by-side listboxes. Select one or more options in the list on the left. Move selected options to the list on the right. The order of the selected options is maintained and you can reorder options.

    I am sharing an example of lightning dualbox :-

    <aura:application extends=”force:slds”>
        <!– search term –>
        <aura:attribute name=”term” type=”String” />
        <!– currently displayed items –>
        <aura:attribute name=”options” type=”List” default=”[]” />
        <!– all items –>
        <aura:attribute name=”allOptions” type=”List” default=”[]” />
        <!– selected values –>
        <aura:attribute name=”selected” type=”List” default=”[]” />
    
        <!– load data from somewhere –>
        <aura:handler name=”init” value=”{!this}” action=”{!c.init}” />
        <!– update list when term changes –>
        <aura:handler name=”change” value=”{!v.term}” action=”{!c.search}” />
    
        <lightning:input type=”text” value=”{!v.term}” label=”Filter” />
        <lightning:dualListbox value=”{!v.selected}” options=”{!v.options}” label=”Items”
    sourceLabel=”Available” selectedLabel=”Selected” />
    </aura:application>
    ({
        init: function(component, event, helper) {
        // Load data
        helper.init(component);
    },
    search: function(component, event, helper) {
        // Filter list
        helper.search(component);
        }
    })
    ({
        init: function(component) {
            // Load some default values.
            component.set(“v.allOptions”, [
            { value: “Hello”, label: “Hello” },
            { value: “World”, label: “World” },
            { value: “Test”, label: “Test” }
        ]);
        // Initialize the options list
        this.search(component);
    },
    search: function(component) {
        // Search term
        var term = component.get(“v.term”);
        // Show all when no filter, or when filter matches label or value
        component.set(“v.options”,
        component.get(“v.allOptions”)
        .filter(
        item => !term ||
        item.value.match(term) ||
        item.label.match(term)));
    }
    })

     

  • Hi Deepak,

    You need to include the Lightning CSS, which is not provided by apex:includeLightning (this provides only the JavaScript file). Instead, you need to also use apex:slds, which will bring in the SLDS CSS. By having these two elements separated, it allows you to use Lightning components without being forced into SLDS, and you can use SLDS without needing to write a component (e.g. if you wanted SLDS-looking Visualforce, or Angular, or something else).

Page 9 of 10