• Rahul Garg SFD
  • NEWBIE
  • 5 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 4
    Likes Given
  • 1
    Questions
  • 10
    Replies
An Apex transaction insert 100 Account records and 2000 Contact records  before encountering a DML exception when attempting to insert 500 Opportunity records. The Account record are inserted by calling the database.insert() method with the allOrNone argument set to false. The Contact and Opportunity record are inserted using the stand-alone insert statement.
How many total records will be committed to the database in this transaction?
A. 100
B. 2,100
C. 2,000
D. 0

Considering the salesforce documentation of Database.insert() when allOrNone is false, the answer should be A i.e 100. But, when I checked this on Anonymous window in developer console I get answer as D i.e 0.

Please help me with this solution.
An Apex transaction insert 100 Account records and 2000 Contact records  before encountering a DML exception when attempting to insert 500 Opportunity records. The Account record are inserted by calling the database.insert() method with the allOrNone argument set to false. The Contact and Opportunity record are inserted using the stand-alone insert statement.
How many total records will be committed to the database in this transaction?
A. 100
B. 2,100
C. 2,000
D. 0

Considering the salesforce documentation of Database.insert() when allOrNone is false, the answer should be A i.e 100. But, when I checked this on Anonymous window in developer console I get answer as D i.e 0.

Please help me with this solution.
1. I have a custom Object
2. I have created a detail page button in that
3. Behavior: Display in existing window without sidebar or header
4. Display Type: Detail Page Button
5. Content Source: URL

This button works properly in lightning(Redirects to specified url in the same existing window)

But In Community, It Opens a new tab and redirects to specified URL. I want to redirect to URL in the same existing window in Community.

Can anyone please suggest a solution for this
This is one of the exam qns I have seen around that I don't agree with the answers I have seen:
A developer needs to create a visualforce page that displays case data. The page will be used by both support reps and support managers. The support rep profile does not allow visibility of the customer_Satisfaction_c Field, but the support manager profile does. How can the developer create the page to enforce field level security and keep future maintenance to a minimum?

A. Create one visualforce page for use by both profiles

B. Use a custom controller that has the with sharing keywords

C. Use a new support manager permission sets

D. Create a separate visualforce page for each profile

Now everywhere the answer suggested is B. But I am wondering why it is not A? By deafault the standard controller will impose user level sharing (rather than custom's system level sharing). This would also need less maintenance because there is no need to create an extension (with the 'sharing' keyword).

Can someone explain why it can't be A? or confirm it is A? (ofcourse B will also work but it is extra development that, IMHO, is not needed)
Hi,

Can someone explain this question to me? The web site where I found this question states the answer as 0 orders will be successfully loaded, but I didn't understand why.   Is it because the governor limit on the number of SELECTs is 100?

Thank you.
Priya

List<Account> customers = new List<Account>();
For (Order__c o: trigger.new)
{
Account a = [SELECT Id, Is_Customer__c FROM Account WHERE Id = :o.Customer__c];
a.Is_Customer__c = true;
customers.add(a);
}
Database.update(customers, false);
The developer tests the code using Apex Data Loader and successfully loads 10 Orders. Then, the developer loads 150 Orders.
How many Orders are successfully loaded when the developer attempts to load the 150 Orders?
 Users report multiple intermittent errors and unexpected results when saving a record. Upon investigation, the developer finds that trigger are executing more than one. What is a potential solution to solve this situation?
a)    Use a one trigger per object approach
b)    Use a static variable to check if the trigger has already run.
c)    Disable all triggers and use workflow rule…..
d)    Use private
Please help me with the correct answer.

A developer creates an Apex helper class to handle complex trigger logic. How can the helper class warn users when the trigger exceeds DML governor limits?
A. By using ApexMessage.Message() to display an error message after the number of DML statements is exceeded.
B. By using Messaging.SendEmail() to conthtinue the transaction and send an alert to the user after the number DML statements is exceeded.
C. By using PageReference.setRedirect() to redirect the user to a custom Visualforce page before the number DML statements is exceeded.
D. By using Limits.getDMLRows() and then displaying an error message before the number of DML statements exceeded.

Hi frndz ! 

                      How to upload a content document file in any object through only developer console.

 

                      Please help me that code.

A.String qryName = ‘%’ + String.escapeSingleQuotes(name) + ‘%’;
String qryString = ‘SELECT ID FROM contact WHERE name LIKE \ ' % ' + qryName + ' % \ ' ';
List<contact> queryResult =Database.query(queryString);


B. String qryName = ‘%’ + name + ‘%’;
String qryString = ‘SELECT ID FROM contact WHERE name LIKE :qryName' ;
List<contact> queryResult =Database.query(queryString);

C. String qryString = ‘SELECT ID FROM contact WHERE name LIKE \ ‘%’ + name + ‘%\ ’ ’;
List<contact> queryResult =Database.query(queryString);

D. String qryName = ‘%’ + String.enforceSecurityChecks(name) + ‘%’;
String qryString = ‘SELECT ID FROM contact WHERE name LIKE :qryName;
This is one of the exam qns I have seen around that I don't agree with the answers I have seen:
A developer needs to create a visualforce page that displays case data. The page will be used by both support reps and support managers. The support rep profile does not allow visibility of the customer_Satisfaction_c Field, but the support manager profile does. How can the developer create the page to enforce field level security and keep future maintenance to a minimum?

A. Create one visualforce page for use by both profiles

B. Use a custom controller that has the with sharing keywords

C. Use a new support manager permission sets

D. Create a separate visualforce page for each profile

Now everywhere the answer suggested is B. But I am wondering why it is not A? By deafault the standard controller will impose user level sharing (rather than custom's system level sharing). This would also need less maintenance because there is no need to create an extension (with the 'sharing' keyword).

Can someone explain why it can't be A? or confirm it is A? (ofcourse B will also work but it is extra development that, IMHO, is not needed)
How to dynamically get values of options we select from PICKLIST . For example I have an account picklist on my VF page which has all the account names as pick list option values. Whenever I select account name from pick list , respective account details like accountname, contact name, oppty name should populate dynamically on the same VF page.

Detailed Description of the requirement :
1. A drop down on Accounts
2. On selecting a particular Account need to get following details:
      A. Opportunities associated with that account
      B. Contact Person for that opportunity- Name if one contact person, number with embedded hyperlink in case of more than one( Hyperlink                should lead to all contact with following information  : Name, Account , Email id)
      C. Lead Name if opportunity has originated from Lead Conversion    
      ​D. Lead Owner of that particular lead.


I can able to dynamically get account values from controller class to Account picklist in VF page, but I don’t know how to display account details(each account we select in picklist) in the same VF page of other section.

Please check my below incomplete VF page and Controller class:
<---VF Page to To get Account PickList and to display each account details: --->

<apex:page controller="AccountDetails">

  <apex:form >
  <apex:pageblock title="AccountDetails" id="camps_list">
  <table style="width: 100%"><tr>
  <td>

          <apex:outputLabel value="Account Name:"/>
          <apex:selectList value="{!filterid}" size="1">
          <apex:actionSupport event="onchange" action="{!fetchRecords}"  rerender="cases_table"/>
          <apex:selectOptions value="{!AccountList}"></apex:selectOptions>
          </apex:selectList>
 </td>
 
 <td>
  No Of Records Displayed:
<apex:selectList value="{! PageSize }" size="1" id="sl">
    <apex:selectOption itemValue="5" itemLabel="5"/>
    <apex:selectOption itemValue="20" itemLabel="20"/>
    <apex:actionSupport event="onchange" reRender="contacts_list"/>
</apex:selectList>

 </td>
</tr>
</table>
</apex:pageBlock>

<apex:pageBlock >

<h1>AccountRelated List records</h1>

</apex:pageblock>
 
  </apex:form>
</apex:page>

<----Controller Class--->

public without sharing class AccountDetails 
{

    public String results { get; set; }

    public String filterid { get; set; }

    public String fetchRecords { get; set; }
    public String PageSize { get; set; }
    public List<Account> accts = new List<Account>();
    public List<Contact> listContacts {get;set;}
    public List<Case> listCases {get;set;}
    public List<Opportunity> listOpptys {get;set;}
    public String selectedAcctId {get;set;}

    public AccountDetails()
    {
    
    }
    
    public List<SelectOption> AccountList
    {
        get
        {
            accts = [Select u.name, u.Id From Account u];
            
            AccountList = new List<SelectOption>();
            
            for(Account tempacct: accts)
            {
                AccountList.add(new SelectOption(tempacct.Id, tempacct.Name));
            }
            return AccountList;
        }
        set;
    }
    
   public void fetchRecords() {
        
    }
    
}
Please can someone help me on it
 

Hi All,

This two VF tags I am really confusing

Can anyone give examples <apex:actionsupport> and <apex:actionfunction> tags and give some examples?

 

 

Thanks,

 

Vicky