Forum Replies Created

Page 12 of 57
  • Yes. In profile, there is setting for “Transfer Record”

  • shariq

    Member
    September 22, 2018 at 10:10 PM in reply to: What is features of “Manage Members” in campaign records in Salesforce?

    Campaign members are created from lead, contact, or person account records. Salesforce provides a variety of ways in which you can manage your campaign members. You can add and update up to 50,000 campaign members at a time through lead, contact, and person account reports; you can search for and add or edit multiple leads and contacts from the Manage Members page; you can add an unlimited number of leads and contacts using a CSV import file; or you can add members to a campaign one at a time from contact or lead detail pages.

  • shariq

    Member
    September 22, 2018 at 10:09 PM in reply to: What is difference between Mobile Lite and Salesforce Mobile?

  • shariq

    Member
    September 22, 2018 at 10:07 PM in reply to: What is Analytic Snapshot in Salesforce?

    Analytic snapshot capture and store the data at pre decided intervals. It captures data from report and saves in custom object as per schedule. It only supports tabular and summary report as a source report. It does not support matrix report. The field type in target object must be same as source report object field.

  • shariq

    Member
    September 22, 2018 at 10:07 PM in reply to: How to show loading image while Ajax call in Salesforce Visualforce?

    <div style="position:absolute;top:20px;left: 50%;">
    <apex:actionStatus id="refreshContent" >
    <apex:facet name="start" >
    <apex:image url="{!$Resource.LoadingImage}" />
    </apex:facet>
    </apex:actionStatus>
    </div>

  • On load event, write the javascript code to autofocus any other field or any other non-visible component.
    Example :

    <span id="focusDistraction"></span>
    <script type="text/javascript">
    /* prevent autopup of the date inputfield by the default focus behavoir */
    window.onload=function() {
    document.getElementById('focusDistraction').focus();
    }
    </script>

  • We cannot use the “Where” clause with GroupBy for aggregate functions like SUM() instead we will need to use the “Having Clause“.
    Example : Get all the opportunity where more than one record exists with same name and name contains “ABC”.

    SELECT COUNT(Id) , Name FROM Opportunity GROUP BY Name  Having COUNT(Id) > 1 AND Name like '%ABC%'

  • COUNT()

    COUNT() must be the only element in the SELECT list.
    You can use COUNT() with a LIMIT clause.
    You can’t use COUNT() with an ORDER BY clause. Use COUNT(fieldName) instead.
    You can’t use COUNT() with a GROUP BY clause for API version 19.0 and later. Use COUNT(fieldName) instead.

    COUNT(fieldName)

    You can use COUNT(fieldName) with an ORDER BY clause.
    You can use COUNT(fieldName) with a GROUP BY clause for API version 19.0 and later

  • Above query will throw an error.
    Explanation : In Group by clause the columns selected must be either used in Group by clause or in aggregate functions. The Name field is neither used in aggregate methods and in group by clause and hence will result in error “Malformed Query”.

  • Encrypted custom fields that are embedded in the <apex:outputText> component display in clear text. The <apex:outputText> component doesn’t respect the View Encrypted Data permission for users. To prevent showing sensitive information to unauthorized users, use the <apex:outputField> tag instead

  • Use component “<apex:outputText>”.
    Example: Format the number into currency.

    <apex:outputtext value="{0, number, 000,000.00}">
    <apex:param value="{!valFromController}" />
    </apex:outputtext>

    OR

    <apex:outputtext value="{0, number, ###,###.00}">
    <apex:param value="{!valFromController}" />
    </apex:outputtext>

  • shariq

    Member
    September 22, 2018 at 9:57 PM in reply to: How to achieve the below given command line using Salesforce Apex?

    Add below line of code in Apex (Constructor)

    Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');

    • This reply was modified 7 years, 6 months ago by  shariq.
  • shariq

    Member
    September 22, 2018 at 9:53 PM in reply to: How to add the Document Header in Salesforce Visualforce page?

    Directly there is no way to add the document type in visualforce. However in most of the cases IE9 does not work with Visualforce pleasantly. And then we need to add the Document type in header. So following workaround will work.

    <apex:outputText
    escape="false"
    value="{!'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'}"/>
    <html>
    <head>
    <title>test</title>
    </head>
    <body>test</body>
    </html>
    </apex:page>

    • This reply was modified 7 years, 6 months ago by  shariq.
  • When the field is used either in Apex class or trigger.

  • 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 an 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.”

  • shariq

    Member
    September 22, 2018 at 9:50 PM in reply to: How to convert lead using Salesforce Apex?

    Lead myLead = new Lead(LastName = 'Foo', Company='Foo Bar');
    insert myLead;

    Database.LeadConvert lc = new database.LeadConvert();
    lc.setLeadId(myLead.id);

    LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
    lc.setConvertedStatus(convertStatus.MasterLabel);

    Database.LeadConvertResult lcr = Database.convertLead(lc);
    System.assert(lcr.isSuccess());

  • shariq

    Member
    September 22, 2018 at 9:50 PM in reply to: What is Dynamic Binding in Salesforce?

    Dynamic Visualforce bindings are a way of writing generic Visualforce pages that display information about records without necessarily knowing which fields to show. In other words, fields on the page are determined at run time, rather than compile time. This allows a developer to design a single page that renders differently for various audiences, based on their permissions or preferences. Dynamic bindings are useful for Visualforce pages included in managed packages since they allow for the presentation of data specific to each subscriber with very little coding.

    Example 1:

    Access the Account name from Contact.
    {!myContact['Account'][fieldname]}

    Example 2:

    Consider Data type in Apex

    public Map<String, List<Account>> accountsMap {get; set;}
    Visualforce page:

    <apex:variable value="A" var="selectedKey" />
    <apex:pageBlockTable value="{!accountsMap[selectedKey]}" var="acc">
    <apex:column value="{!acc.name}"/>
    <apex:column value="{!acc.BillingStreet}"/>
    <apex:column value="{!acc.BillingCity}"/>
    <apex:column value="{!acc.BillingPostalCode}"/>
    </apex:pageBlockTable>

  • Integer len = 10;
    Blob blobKey = crypto.generateAesKey(128);
    String key = EncodingUtil.convertToHex(blobKey);
    String pwd = key.substring(0,len);

  • shariq

    Member
    September 22, 2018 at 9:48 PM in reply to: Access Custom Controller-Defined Enum in Salesforce Custom Component?

    We cannot reference the enum directly since the enum itself is not visible to the page and you can’t make it a property.

    Example:

    Apex class:

    global with sharing class My_Controller {
    public Case currCase {get; set; }
    public enum StatusValue {RED, YELLOW, GREEN}

    public StatusValues getColorStatus() {
    return StatusValue.RED; //demo code - just return red
    }
    }

    Visualforce page:

    <apex:image url='stopsign.png' rendered="{!colorStatus == StatusValue.RED}" />
    Above code snippet will throw error something like “Save Error: Unknown property ‘My_Controller.statusValue'”

    Resolution:
    Add below method in Apex Controller:

    public String currentStatusValue { get{ return getColorStatus().name(); }}
    and change Visualforce code to

    <apex:image url='stopsign.png' rendered="{!currentStatusValue == 'RED'}" />

  • In spring 12, Salesforce has come up with ability of SOQL to get records from position “X” instead of position “1” every time to help creating pagination feature.

    Select Id, Name from Lead LIMIT 5 OFFSET 2
    Above query will return 5 Lead records starting from record number 10 (5×2).

  • shariq

    Member
    September 22, 2018 at 9:45 PM in reply to: Can you use Group by clause inside inner query in Salesforce SOQL?

    No. only root queries support aggregate expressions. Return type is List<AggregateResult> for above query However the root result expects List<Account> and there is no syntax or provision available in Salesforce to specify that child results are of type “AggregateResult“.

  • In Constructor of the Controller extension, only Id of Custom Object is supplied. We need to query all the required field explicitly in order to use in remaining part of the code.

  • Whenever an object has greater than 100K records any query on that object must be “selective”. For a query to be selective it must have enough indexed filters (where clauses) so that less than 10% of the records (in our example 10K) are returned before applying the limit statement.

  • // Test to see if person accounts are enabled.
    public Boolean personAccountsEnabled()
    {
    try
    {
    // Try to use the isPersonAccount field.
    sObject testObject = new Account();
    testObject.get( 'isPersonAccount' );
    // If we got here without an exception, return true.
    return true;
    }
    catch( Exception ex )
    {
    // An exception was generated trying to access the isPersonAccount field
    // so person accounts aren't enabled; return false.
    return false;
    }
    }

  • When you create the Link using URLFOR() in Email Template, it creates link in “http” format instead of “https” and thus causes end user to logged into salesforce again.

    So instead of

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

    We can use something like :

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

Page 12 of 57