Forum Replies Created

Page 14 of 53
  • Parul

    Member
    September 23, 2018 at 3:40 am in reply to: How to display error messages in Salesforce Visualforce Page?

    Insert the below tag inside the visualforce page within page block

    <apex:pageMessages ></apex:pageMessages>

    Hope it helps.

  • Controller extension is very useful and important concept introduced by the salesforce recently. It gives the power to programmer to extend the functionality of existing custom controller or standard controller.
    A Visualforce can have a single Custom controller or standard controller but many controller extensions.
    we can say that the custom extension is the supporter of custom or standard controller.

    If you want to use completely custom functionality and don't really need most of the standard object behaviors, custom controller is a good option, but bear in mind, any standard actions you want to use will have to be implemented in your custom class. A page with a custom controller would use the following attribute:

    <apex:page controller="MyApexClass"...> ... </apex:page>

    Consider one example : If there is one controller written and used by the multiple visualforce pages and one of them needs some extra logic. Then instead of writing that logic to controller class (Which is used by many visualforce pages) we can create a controller extension and apply to that page only.

  • Parul

    Member
    September 23, 2018 at 3:37 am in reply to: What is Salesforce Dynamic Apex?

    Map<String,Schema.SobjectType> gd = Schema.getGlobalDescribe();

    We can also use schemaDescribe()  to create tree structure of all the objects and fields in the schema browser, to do this we need to use the codemap

    Map<String,Schema.SobjectType> gd = Schema.getGlobalDescribe();

    Returns map of all Sobjects names or Keys to sObject tokens or values for the standard and custom objects defined in the organization.

  • Parul

    Member
    September 23, 2018 at 3:34 am in reply to: What is the controller extension in Salesforce?

    Controller Extension is very useful and important concept introduced by the salesforce recently. It gives the power to the programmer to extend the functionality of existing custom controller or standard controller.

    A Visualforce can have a single Custom controller or standard controller but many controller extensions.
    we can say that the custom extension is the supporter of custom or standard controller.

    Consider one example: If there is one controller written and used by the multiple Visualforce pages and one of them needs some extra logic. Then instead of writing that logic to controller class (Which is used by many Visualforce pages) we can create a controller extension and apply to that page only.

  • Parul

    Member
    September 23, 2018 at 3:33 am in reply to: In Which Sequence Trigger and Automation Rules run in Salesforce.com?

    Adding some points:

    Assignment rules run when:

    An API client inserts a Lead and specifies an AssignmentRuleHeader. This is typical for Marketing Automation Systems like HubSpot or Marketo.
    A DML statement is executed that includes DmlOptions with property AssignmentRuleHeader set.
    The user clicks ‘assign using active assignment rules’ on the OOTB Lead edit page.
    These three rules tell SFDC to execute assignment rules. Just doing a DML insert without any AssignmentRuleHeader set explicitly or implicitly does not run the assignment rules.

     

    Thanks

  • Triggers can fire twice, once before workflows and once after workflows, so must follow the best practice and order of execution of trigger.

  • By using public sites using “Customer Portal” we can provide the User Login (Authentication)

  • Parul

    Member
    September 23, 2018 at 3:22 am in reply to: How to create and host S Control in Salesforce?

    Hi

    S-Controls allow Salesforce developers to leverage HTML and Javascript to create custom pages and UI components.  These customizations are used when an admin needs to work with a small set of records or fields, or if he or she needs to link to an external server.

    S-Controls enable developers to add their own functionality to a Salesforce org.  Among some of the possibilities, you can integrate hosted apps, or extend the Salesforce UI.

  • Parul

    Member
    September 22, 2018 at 6:22 pm in reply to: How can we load millions of records in Salesforce within an hour ?

    Use Data Loader when:
    You need to load 50,000 to 5,000,000 records. Data Loader is supported for loads of up to 5 million records. If you need to load more than 5 million records, we recommend you work with a Salesforce partner or visit the App Exchange for a suitable partner product.
    You need to load into an object that is not yet supported by the import wizards.
    You want to schedule regular data loads, such as nightly imports.
    You want to export your data for backup purposes.

    Use the import wizards when:
    You are loading less than 50,000 records.
    The object you need to import is supported by import wizards. To see what import wizards are available and thus what objects they support, from Setup, enter Data Management in the Quick Find box, then select Data Management.
    You want to prevent duplicates by uploading records according to account name and site, contact email address, or lead email address.

    For this Scenario you need to use Third Party tool

    Thanks

  • Parul

    Member
    September 22, 2018 at 6:16 pm in reply to: Explain Skinny table in Salesforce?

    Salesforce can create skinny tables to contain frequently used fields and to avoid joins. Doing so keeps the skinny tables in sync with their source tables when the source tables are modified. ... A skinny table contains both kinds of fields and does not include soft-deleted records.

  • Parul

    Member
    September 22, 2018 at 6:15 pm in reply to: When records are created in Salesforce, How it is queued for Indexing?

    For data to be searched, it must first be indexed. The indexes are created using the search indexing servers, which also generate and asynchronously process queue entries of newly created or modified data. After a searchable object’s record is created or updated, it could take about 15 minutes or more for the updated text to become searchable.

    Salesforce performs indexed searches by first searching the indexes for appropriate records, then narrowing down the results based on access permissions, search limits, and other filters. This process creates a result set, which typically contains the most relevant results. After the result set reaches a predetermined size, the remaining records are discarded. The result set is then used to query the records from the database to retrieve the fields that a user sees.

  • Parul

    Member
    September 22, 2018 at 6:13 pm in reply to: What are the considerations for Skinny Table in Salesforce?

    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.

  • Created Date: <apex:inputText id="dah" value="{!created}" size="50"
    onclick="javascript:go('{!$Component.dah}')"></apex:inputText>

    <script>
    function go(field) {
    var huh = document.getElementById(field).value;
    alert(huh); //returns the string u put inside of input text field
    }
    </script>

  • Parul

    Member
    September 22, 2018 at 6:10 pm in reply to: How to use standard Salesforce REST API from Salesforce Visualforce Page?

     

    I was able to call a REST API from the javascript on a VF page.

    function CallRestAPI()

    {

    var weblink = "http://URL";
    $.ajax(

    {

    url : weblink,

    type : 'GET',

    dataType: 'json',
    beforeSend: function (request)

    {

    request.setRequestHeader("HeaderName", "HeaderValue");

    },

    crossDomain: true,

    success : function(result)

    {

    //process the result

    },

    error : function(jqXHR, textStatus, errorThrown) {

    alert('Error: '+jqXHR.status);

    alert('ErrorThrown: '+errorThrown)

    }
    });
    }

  • Parul

    Member
    September 22, 2018 at 6:09 pm in reply to: How to refer static resources in Salesforce Visualforce?

    Suppose there is a single file like any single image or standalone css file, that you need to refer in your VF page, then you can directly use the “$Resource.resourceName” to refer the static resource where ‘$Resource‘ is a global variable to use any static resource within visualforce page. You need not to hard code the path of the static resource in VF page code. Below are some examples of the same.

    <apex:stylesheet value=”{!URLFOR($Resource.style_resources, ‘styles.css’)}”/>

  • You should automatically populate however there is known issue for same here, click here if it impacts you:

    Training__c tr= (Training__c) Training__c.sObjectType.newSObject(null, true);

    //Check if Value in field "Trainer__c" is default value
    System.assertEquals('Jitendra', tr.Trainer__c);

     

    Thanks

  • Parul

    Member
    September 22, 2018 at 6:07 pm in reply to: How to create Chatter post from Salesforce Apex?

    public class chatterpost {
    public string body { get; set;}
    public string userID { get; set;}

    public void postFeed(){
    FeedItem post = new FeedItem();
    post.ParentId = userID;
    post.Body = body;
    insert post;
    }
    }

  • As per the documenation that is only available in Salesforce1

    Here is the link for details

    https://developer.salesforce.com/page/Lightning_FAQ (Visualforce and Lightning section)

    Q: A tab with a Lightning Component only displays in the Salesforce1 UI. Can I make a Lightning Component that shows up in both the mobile and the desktop UIs?

    A: Currently you can only use Lightning Components in the Salesforce1 Mobile App or a standalone app.

  • Parul

    Member
    September 22, 2018 at 6:06 pm in reply to: What are Salesforce Lightning Extensions?

    Salesforce Lightning Inspector Chrome Extension
    The Salesforce Lightning Inspector is a Google Chrome DevTools extension that enables you to navigate the component tree, inspect component attributes, and profile component performance. The extension also helps you to understand the sequence of event firing and handling.
    The extension helps you to:

    Navigate the component tree in your app, inspect components and their associated DOM elements.
    Identify performance bottlenecks by looking at a graph of component creation time.
    Debug server interactions faster by monitoring and modifying responses.
    Test the fault tolerance of your app by simulating error conditions or dropped action responses.
    Track the sequence of event firing and handling for one or more actions.

  • Parul

    Member
    September 22, 2018 at 6:05 pm in reply to: How to report on User License field in Salesforce?

    1. Click Setup.
    2. Access Report Types:
    Salesforce Classic: Under "Build," click Create | select Report Type.
    Salesforce Lightning: Go to Feature Settings | Analytics | Reports & Dashboards | Select Report Types.

    3. Click New Custom Report Type.
    4. In the "Primary Object" field, select Users.
    5. Enter a name, label, description, and category for your new report.
    6. Select a deployment status.
    7. Click Next, then click Save.
    8. Click Edit Layout.
    9. Under "View," click Add fields related via lookup.
    10. Click Profile.
    11. Select User License, then click View related fields.
    12. Select Name, Status, and Total Licenses, then click OK.
    13. Click Save.
    14. Click the Reports tab.
    15. Click New Report.
    16. Click the folder (category) you saved your report to, then select your new User Licenses Report.
    17. Click Create.
    18. Under "Fields," drag and drop Profile: User License: Name to the report preview.
    19. Click Run Report.

  • Hello,

    This happens on person accounts where the custom fields ends with “__pc” and custom relationship ends with “__pr”.

    Thanks!

  • Parul

    Member
    September 22, 2018 at 6:03 pm in reply to: Difference between Chatter API and Connect API in Salesforce?

    When to Use Chatter REST API
    Is Chatter REST API the right API for you?
    Use Chatter REST API to:Build a mobile app.
    Integrate a third-party web application with Salesforce so it can notify groups of users about events.
    Display a feed on an external system, such as an intranet site, after users are authenticated.
    Make feeds actionable and integrated with third-party sites. For example, an app that posts a Chatter item to Twitter whenever the post includes #tweet hashtag.
    Create simple games that interact with the feed for notifications.
    Creating a custom, branded skin for Chatter for your organization.
    How Is Chatter REST API Different from Other Salesforce APIs?
    The following are some of the differences between Chatter REST API and REST API:

    Data is structured for rendering on websites and mobile devices.
    Returned information is localized to the user's time zone and language.
    Changed values that are tracked in a feed are returned as value-pair representations.
    Rate limiting for Chatter REST API is per user, per application, per hour. The rate limiting for SOAP API and REST API is by organization.
    If needed, extract an ID from the REST API and use it in requests to Chatter REST API.
    Chatter in Apex
    Many Chatter REST API resource actions are exposed as static methods on Apex classes in the ConnectApi namespace. This namespace is also referred to as Chatter in Apex. Use Chatter in Apex to develop Chatter applications on the Lightning Platform without using HTTP callouts from Apex.

  • Parul

    Member
    September 22, 2018 at 6:02 pm in reply to: How to capture errors after using Database DML methods in Salesforce?

    Returned Database Errors
    While DML statements always return exceptions when an operation fails for one of the records being processed and the operation is rolled back for all records, Database class methods can either do so or allow partial success for record processing. In the latter case of partial processing, Database class methods don’t throw exceptions. Instead, they return a list of errors for any errors that occurred on failed records.

    The errors provide details about the failures and are contained in the result of the Database class method. For example, a SaveResult object is returned for insert and update operations. Like all returned results, SaveResult contains a method called getErrors that returns a list of Database.Error objects, representing the errors encountered, if any.

    Example
    This example shows how to get the errors returned by a Database.insert operation. It inserts two accounts, one of which doesn’t have the required Name field, and sets the second parameter to false: Database.insert(accts, false);. This sets the partial processing option. Next, the example checks if the call had any failures through if (!sr.isSuccess()) and then iterates through the errors, writing error information to the debug log.

     

    // Create two accounts, one of which is missing a required field
    Account[] accts = new List<Account>{
    new Account(Name='Account1'),
    new Account()};
    Database.SaveResult[] srList = Database.insert(accts, false);

    // Iterate through each returned result
    for (Database.SaveResult sr : srList) {
    if (!sr.isSuccess()) {
    // Operation failed, so get all errors
    for(Database.Error err : sr.getErrors()) {
    System.debug('The following error has occurred.');
    System.debug(err.getStatusCode() + ': ' + err.getMessage());
    System.debug('Fields that affected this error: ' + err.getFields());
    }
    }
    }

  • Parul

    Member
    September 22, 2018 at 6:01 pm in reply to: How to get Salesforce Visualforce page output as JSON?

    <apex:page controller="JSONGenerator" contentType="application/json; charset=utf-8" showHeader="false" standardStylesheets="false" sidebar="false">
    {!jsonStr}
    </apex:page>

  • Parul

    Member
    September 22, 2018 at 5:59 pm in reply to: What is custom metadata type in Salesforce?

    Custom Metadata Types (CustomObject)
    Represents the metadata associated with a custom metadata type.
    For more information, see the Custom Metadata Types Implementation Guide.
    File Suffix and Directory Location
    A custom metadata type is defined as a custom object and is stored in the objects folder. Custom metadata types have a suffix of __mdt (instead of __c for custom objects). Custom metadata type field names have a suffix of __c, like other custom fields. Custom metadata type field names must be dot-qualified with the name of the custom metadata type to which they belong.

    Names of custom metadata types must be unique within their namespace. All custom metadata types belong to the CustomMetadata namespace and can optionally belong to a second namespace. In your organization, you can use custom metadata types with your namespace and also other organizations’ namespaces.

Page 14 of 53