Forum Replies Created

Page 52 of 57
  • shariq

    Member
    September 12, 2018 at 2:07 pm in reply to: When should an extension be used instead of a custom controller?

    Hi,

    Custom controllers are used to implement the logic and functionality without using a standard controller and controller extensions are used to extend the logic and functionality of a standard controller or a custom controller. Custom controllers and Controller extension are written using Apex.

    The following are the instances where you might want to use use a extension to a standard controller:

    1. Implementing a  functionality which rely on the standard controller's behavior.
    2. To use existing functionality.
    3. To use existing actions of an object.
    4. To Run your page with applying permissions.

    Hope this helps!

     

  • shariq

    Member
    September 12, 2018 at 1:56 pm in reply to: What is the use of pagination in Visualforce?

    Hi,

    Pagination is the process of separating print or digital content into discrete pages.

    Thanks

  • Hi,

    The maximum response size when creating a PDF file must be less than 15 MBbefore being rendered as a PDF file.

    When designing Visualforce pages intended to be rendered to PDF, take the following considerations into account. Always verify the formatting and appearance of the PDF version of your page before putting it into production.
    Limitations of the Visualforce PDF rendering service include the following.PDF is the only supported rendering service.
    The PDF rendering service renders PDF version 1.4.

    Rendering a Visualforce page as a PDF file is intended for pages designed and optimized for print.

    A Visualforce page rendered as a PDF file displays either in the browser or is downloaded, depending on the browser’s settings. Specific behavior depends on the browser, version, and user settings, and is outside the control of Visualforce.
    The PDF rendering service renders the markup and data on your page, but it might not render formatting contained within the contents of rich text area fields added to the page.
    Long lines of text that don’t have break points, such as a space or dash, can’t be wrapped by the PDF rendering service. This most commonly happens with very long URLs, registry entries, and so on. When these lines are wider than the page, they increase the width of the page’s content beyond the edge of the PDF page. This causes content to “flow” off the side of the page, cutting it off.
    Don’t use standard components that aren’t easily formatted for print, or form elements such as inputs or buttons, or any component that requires JavaScript to be formatted.
    PDF rendering doesn’t support JavaScript-rendered content.
    PDF rendering isn’t supported for pages in the Salesforce app.
    The font used on the page must be available on the Visualforce PDF rendering service. Web fonts aren’t supported.
    If the PDF file fails to display all the page’s text, particularly multibyte characters such as Japanese or accented international characters, adjust your CSS to use a font that supports them.

    Hope this helps!

  • shariq

    Member
    September 12, 2018 at 1:49 pm in reply to: What is Lightning Data Services?

    Hi,

    Use Lightning Data Service to load, create, edit, or delete a record in your component without requiring Apex code. Lightning Data Service handles sharing rules and field-level security for you. In addition to not needing Apex, Lightning Data Service improves performance and user interface consistency.
    At the simplest level, you can think of Lightning Data Service as the Lightning Components version of the Visualforce standard controller. While this statement is an over-simplification, it serves to illustrate a point. Whenever possible, use Lightning Data Service to read and modify Salesforce data in your components.

    Data access with Lightning Data Service is simpler than the equivalent using a server-side Apex controller. Read-only access can be entirely declarative in your component’s markup. For code that modifies data, your component’s JavaScript controller is roughly the same amount of code, and you eliminate the Apex entirely. All your data access code is consolidated into your component, which significantly reduces complexity.

    Lightning Data Service provides other benefits aside from the code. It’s built on highly efficient local storage that’s shared across all components that use it. Records loaded in Lightning Data Service are cached and shared across components. Components accessing the same record see significant performance improvements, because a record is loaded only once, no matter how many components are using it. Shared records also improve user interface consistency. When one component updates a record, the other components using it are notified, and in most cases, refresh automatically.
    Loading a Record
    Loading a record is the simplest operation in Lightning Data Service. You can accomplish it entirely in markup.
    Saving a Record
    To save a record using Lightning Data Service, call saveRecord on the force:recordData component, and pass in a callback function to be invoked after the save operation completes.
    Creating a Record
    To create a record using Lightning Data Service, declare force:recordData without assigning a recordId. Next, load a record template by calling the getNewRecord function on force:recordData. Finally, apply values to the new record, and save the record by calling the saveRecord function on force:recordData.
    Deleting a Record
    To delete a record using Lightning Data Service, call deleteRecord on the force:recordData component, and pass in a callback function to be invoked after the delete operation completes.
    Record Changes
    To perform tasks beyond rerendering the record when the record changes, handle the recordUpdated event. You can handle record loaded, updated, and deleted changes, applying different actions to each change type.
    Errors
    To act when an error occurs, handle the recordUpdated event and handle the case where the changeType is “ERROR”.
    Considerations
    Lightning Data Service is powerful and simple to use. However, it’s not a complete replacement for writing your own data access code. Here are some considerations to keep in mind when using it.
    Lightning Data Service Example
    Here’s a longer, more detailed example of using Lightning Data Service to create a Quick Contact action panel.
    SaveRecordResult
    Represents the result of a Lightning Data Service operation that makes a persistent change to record data.

    Hope this helps!

  • shariq

    Member
    September 12, 2018 at 1:45 pm in reply to: What is the scope of static variable in Apex?

    Hi,

    A static variable is static only within the scope of the Apex transaction. It's not static across the server or the entire organization. The value of a static variable persists within the context of a single transaction and is reset across transaction boundaries.

    Hope this helps!

  • shariq

    Member
    September 12, 2018 at 1:44 pm in reply to: how Lightning Data Service can improve Lightning Component performance

    Hi,

    Use Lightning Data Service to load, create, edit, or delete a record in your component without requiring Apex code. Lightning Data Service handles sharing rules and field-level security for you. In addition to not needing Apex, Lightning Data Service improves performance and user interface consistency.

    Since Lightning Data Service do not require the use of apex, we don't make server calls and hence it improves the performance.

    Hope this helps!

  • shariq

    Member
    September 12, 2018 at 1:39 pm in reply to: Difference between 'null' and 'undefined' In Apex

    Hi,

    There is nothing like undefined in apex. we have undefined in case of JavaScript. Instead of asking Difference between 'null' and 'undefined' In Apex, you can ask what is difference between 'null' and 'undefined'.

    JavaScript assigns 'undefined' to any object that has been declared but not initialized or defined.

    Apex assigns 'null' to any object that has been declared but not initialized or defined

    Thanks

     

  • Hi,

    The Trigger will fire.The Document mentions that the Parent record record goes through save procedure meaning the trigger will fire on parent record if there is a modification on the field of child record that feeds to the parent as roll up.

    Hope this helps!

  • Hi,

    Avoid recursive trigger in salesforce using static variable

    Recursion occurs when same code is executed again and again. It can lead to infinite loop and which can result to governor limit sometime. Sometime it can also result in unexpected output.

    It is very common to have recursion in trigger which can result to unexpected output or some error. So we should write code in such a way that it does not result to recursion. But sometime we are left with no choice.

    For example, we may come across a situation where in a trigger we update a field which in result invoke a workflow. Workflow contains one field update on same object. So trigger will be executed two times. It can lead us to unexpected output.

    Another example is our trigger fires on after update and it updates some related object and there is one more trigger on related object which updates child object. So it can result too infinite loop.

    To avoid these kind of situation we can use public class static variable.

    In RecursiveTriggerHandler class, we have a static variable which is set to true by default.

    public class RecursiveTriggerHandler{
    public static Boolean isFirstTime = true;
    }

    trigger SampleTrigger on Contact (after update){

    Set<String> accIdSet = new Set<String>();

    if(RecursiveTriggerHandler.isFirstTime){
    RecursiveTriggerHandler.isFirstTime = false;

    for(Contact conObj : Trigger.New){
    if(conObj.name != 'SFDC'){
    accIdSet.add(conObj.accountId);
    }
    }

    // Use accIdSet in some way
    }
    }

    Once this trigger fired the static variable value will set to false and trigger will not fire again.

    Hope this helps!

  • shariq

    Member
    September 12, 2018 at 12:07 pm in reply to: What is Salesforce analytics cloud?

    Hi,

    Salesforce Wave analytics or Analytics Cloud is Business Intelligence (BI) of Salesforce. It's a cloud-based platform for connecting data from multiple sources, creating interactive views of that data, and sharing those views to users as dashboards. It's a better way to distribute insight to business users, so they can understand and take action on changing information. It is simple and user-friendly in measuring, filtering, grouping, drill down, viewing and sharing data. It's optimized for mobile device and data visualization.

    Hope this helps!

  • shariq

    Member
    September 12, 2018 at 12:34 am in reply to: What is manual sharing (User Managed Sharing)?

    Hi Avinish,

    User managed sharing allows the record owner, or any user with Full Access to a record, to share the record with another user/group of users. This is generally done by an end-user, for a single record. User managed sharing is removed when the record owner changes or when the access granted in the sharing does not grant additional access beyond the object's organization-wide sharing default access level.

    Hope this helps.

  • Hi Avinish,

    If extensions have same method name, then the extension written on the left or first will have higher rank over the next one.

    Hope this helps.

  • Hi Avinish,

    Lets get it simple, Master Detail is required relationship so that means every record created will have some value in its master detail field. For changing lookup into master detail, the records must have values in its lookup field.

    Hope this helps.

  • shariq

    Member
    September 12, 2018 at 12:08 am in reply to: Why can we not query fields of type long text in Salesforce?

    Hi Shraddha and Avinish,

    You can query records for long text type field but you can't put these fields in WHERE clause.

    For more understanding the scenario, lets get deep into it, what is stopping those fields to be used in a where clause, answer is field's length. Salesforce don't allow the fields to be used in where clause if their length is greater than 255.

    Hope this helps.

  • shariq

    Member
    September 11, 2018 at 4:11 pm in reply to: Why Are Properties Helpful In Controllers?

    Hi,

    An Apex property is similar to a variable; however, you can do additional things in your code to a property value before it is accessed or returned. Properties can be used to validate data before a change is made, to prompt an action when data is changed (such as altering the value of other member variables), or to expose data that is retrieved from some other source (such as another class).

    Property definitions include one or two code blocks, representing a get accessor and a set accessor:The code in a get accessor executes when the property is read.
    The code in a set accessor executes when the property is assigned a new value.
    If a property has only a get accessor, it is considered read only. If a property has only a set accessor, it is considered write only. A property with both accessors is considered read-write.

    Hope this helps!

  • shariq

    Member
    September 11, 2018 at 3:10 pm in reply to: What are the wave analytics benefits and features?

    Hi,

    Below are the benefits and features of wave analytics :

    • Connect any external data source. NoSQL database.
    • It's fully Integrated with all salesforce.com clouds like Sales Cloud, Service Cloud, Marketing Cloud and Community Cloud.
    • A wave cloud is fully supported for all devices, like desktop browsers, android and ios mobiles, and smartwatches.
    • No data limits, you can analyze millions of business data in minutes.
    • It's secure cloud-based platform for your data.
    • Continuously monitor the key business metrics on your latest data.
    • Intuitive Point and click visual dashboard designer tools.

    Hope this helps!

  • shariq

    Member
    September 11, 2018 at 3:06 pm in reply to: What are the different types of external data source supports wave cloud?

    Hi,

    Salesforce provides 4 different ways to connect and load data to wave analytics :

    1. Salesforce Org
    2. Uploading CSV files to wave.
    3. Connect different sources through Wave data API.
    4. Predefine ETL Partner connectors.

    Hope this helps!

  • shariq

    Member
    September 11, 2018 at 3:03 pm in reply to: Can We Mass Delete Reports Using Apex (anonymous Apex)?

    Hi,

    Salesforce has not exposed any API for Reports. So best way is :

    • Move all reports needs to delete in new folder.
    • Inform everyone that reports will be deleted after some time may be 30 days.
    • Import your reports folder in Eclipse including all reports to be deleted and then delete the the reports folder in eclipse. It will delete all the reports at once.

    Hope this helps!

  • shariq

    Member
    September 11, 2018 at 2:30 pm in reply to: implement quick action

    Hi,

    Quick Action/Lightning Actions is an Object-specific action. Object-specific actions let users create records that have automatic relationships to other records, make updates to specific records, and interact with records in ways that you define.

    Lightning actions are built on the existing salesforce Lightning Component Framework that you may already have adopted. So you can easily convert your existing Lightning components to actions and use them in Lightning Experience and Salesforce1 Application.

    To display a lighting component as a Quick action to an object, It must be implemented withforce:lightningQuickAction OR force:lightningQuickActionWithoutHeader.

    Thanks

  • Hi,

    Because Apex runs in a multitenant environment, the Apex runtime engine strictly enforces limits to ensure that runaway Apex code or processes don’t monopolize shared resources. If some Apex code exceeds a limit, the associated governor issues a runtime exception that cannot be handled. These limits count for each Apex transaction. For Batch Apex, these limits are reset for each execution of a batch of records in the execute method.

    In a SOQL query with parent-child relationship subqueries, each parent-child relationship counts as an extra query. These types of queries have a limit of three times the number for top-level queries. The limit for subqueries corresponds to the value that Limits.getLimitAggregateQueries() returns.The row counts from these relationship queries contribute to the row counts of the overall code execution. This limit doesn’t apply to custom metadata types. In a single Apex transaction, custom metadata records can have unlimited SOQL queries. In addition to static SOQL statements, calls to the following methods count against the number of SOQL statements issued in a request.Database.countQuery
    Database.getQueryLocator
    Database.query

    Hope this helps!

  • shariq

    Member
    September 11, 2018 at 2:09 pm in reply to: What is MIXED-DML-OPERATION error and how to avoid?

    Hi,

    To avoid this error, we should perform DML operation on standard/custom object records in a different transaction.

    In general all the apex classes and apex triggers execute synchronously (execute immediately).

    if we perform DML operation on standard/custom object records asynchronously (execute in future context), we can avoid MIXED-DML-OPERATION error.

    To execute logic asynchronously keep the logic in an apex method (in a separate apex class, not in same apex trigger) which is decorated with @future annotation.

    Thanks

  • shariq

    Member
    September 11, 2018 at 1:42 pm in reply to: Name some of the API testing tools.

    Hi,

    Here are some of the top API testing tools that can be used for Rest and Soap Web Service Testing.
    Postman.
    Karate DSL.
    SoapUI.
    HttpMaster Express.
    Rest- Assured.
    Rest Console.
    RoboHydra Server.
    Hippie-Swagger.

    Thanks

  • shariq

    Member
    September 10, 2018 at 2:53 pm in reply to: What is a Time Trigger in Salesforce?

    Hi,

    A setting that defines when time-dependent workflow actions should fire. When creating time-dependent actions and time triggers for workflow rules, consider the following :

    • When defining a time trigger, use standard and custom date and date/time fields defined for the object. Specify time using days and hours. The valid range is 0 to 999 days or hours
    • You can modify existing time triggers by adding or removing actions.

    Time Trigger Processing :

    • Time-dependent actions aren’t executed independently. They’re grouped into a single batch that starts executing within one hour after the first action enters the batch.
    • Apex triggers that fire as a result of time-dependent actions may get executed in a single batch or independently. Follow these best practices:
      • In case they fire independently–Ensure that your Apex logic is scoped for a single scheduled action. For example, don't use Apex static variables to communicate state across Apex code triggered by different scheduled actions.
      • In case they fire in a single batch–Be aware of how the combination of your time-dependent actions and Apex triggers impact your Apex governor limits.
    • Salesforce evaluates time-based workflow on the organization’s time zone, not the user’s. Users in different time zones might see differences in behavior.
    • Salesforce doesn’t necessarily execute time triggers in the order they appear on the workflow rule detail page. Workflow rules list time triggers that use the Before field first, followed by time triggers that use the After field.
    • Salesforce doesn't display time-dependent action controls on the workflow rule edit page if you set the workflow rule evaluation criteria to Evaluate the rule when a record is: created, and any time it’s edited to subsequently meet criteria.

    Limitations:

    • Time triggers don’t support minutes or seconds.
    • Time triggers can’t reference the following:
      • DATE or DATETIME fields containing automatically derived functions, such as TODAY or NOW.
      • Formula fields that include related-object merge fields.
    • You can't archive a product or price book that has pending actions.
    • You also can’t add or remove time triggers if:
      • The workflow rule is active.
      • The workflow rule is deactivated, but has pending actions in the queue.
      • The workflow rule evaluation criteria is set to Evaluate the rule when a record is: created, and every time it’s edited.
      • The workflow rule is included in a package.

    Hope this helps!

  • shariq

    Member
    September 10, 2018 at 2:43 pm in reply to: System.Query Exception: List has no rows for assignment to s-object?

    Hi,

    The exception is because of you are not getting any record in your SOQL query which meet the where criteria so it's give error. When attempting to fetch a single record from the database it is easy to run into the above exception. To avoid such exception use try-catch box like below :

    MyObject__c obj;

    try{

    obj = [SELECT id FROM MyObject__c WHERE name=:previouslyDefinedVar];

    } catch(System.QueryException e){

    // Perform logic here

    }

    Hope this helps!

     

  • shariq

    Member
    September 10, 2018 at 2:32 pm in reply to: more than one server side controller in lightning

    Hi,

    Salesforce doesn't support this feature as of now. I think we can write enough auraenabled method in the same controller and doesn't require two different controllers for the same component.  can you please give me a situation where you need this ?

    Thanks

Page 52 of 57