• Parikhit Sarkar
  • NEWBIE
  • 31 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 18
    Replies
I think the answer should be Quotes (not sure), can someone please explain me what should be the right answer to this? Thanks. 
A. When a record is created
B. When a record is created or updated
C. When a record is created/updated and didn't previously meet the trigger criteria
D. None of the above

Can someone please explain me the answer? Thanks. 
class myClass {
    class CustomException extends QueryException {}
    public static Account aQuery() {
        Account theAccount;
        try {
            system.debug(‘Querying Accounts.’);
            theAccount = [SELECT Id FROM Account WHERE CreatedDate > TODAY];
        } catch(CustomException eX) {
            system.debug(‘Custom Exception.’);
        } catch(QueryException eX) {
            system.debug(‘Query Exception.’);
        } Finally {
            system.debug(‘Done.’);
        }
        Return theAccount;
    }
}

A. Querying Accounts. Query Exception.
B. Querying Accounts. Custom Exception.
C. Querying Accounts. Custom Exception. Done.
D. Querying Accounts. Query Exception. Done.


I thought the answer would be D but the correct answer is C. Can anyone please explain why? Thanks in adv.
An org has a data model with a Buyer__c object that has a lookup relationship to Region__c and a Supplier__c object has a lookup relationship to Region___c.
How can a developer display data from the related Supplier__c records on a Visualforce page that has a standard controller for the Buyer__c object?



A. Use rollup formula fields on the Buyer__c object to reference the related Supplier__c records through the Region__c.
B. Use SOQL in a controller extension to query for related Supplier__c records.
C. Use a second standard controller for the Region__c object on a page to display the related Supplier__c records.
D. Use merge field syntax to retrieve the Supplier__c records related to the Buyer__c record through the Region__c.


I believe the answer should be D but everywhere else it says the answer is A - I do not understand why though. Can anyone help affirming my belief? Thanks in adv.
 A developer has the controller class below

Public with sharing class myFooController {
                public integer prop {get; private set;}
}

Which code block will run successfully in an execute anonymous window?

a. myFooController m = new myFooController();
System.assert(m.prop != null);
b. myFooController m = new myFooController();
System.assert(m.prop == 1);
c. myFooController m = new myFooController();
System.assert(m.prop == null);
d. myFooController m = new myFooController();
System.assert(m.prop == 0);

Can someone please help me solve this question? I found out that the correct answer is option (C) but I don't understand the reason behind it.
class myClass {
    class CustomException extends QueryException {}
    public static Account aQuery() {
        Account theAccount;
        try {
            system.debug(‘Querying Accounts.’);
            theAccount = [SELECT Id FROM Account WHERE CreatedDate > TODAY];
        } catch(CustomException eX) {
            system.debug(‘Custom Exception.’);
        } catch(QueryException eX) {
            system.debug(‘Query Exception.’);
        } Finally {
            system.debug(‘Done.’);
        }
        Return theAccount;
    }
}

A. Querying Accounts. Query Exception.
B. Querying Accounts. Custom Exception.
C. Querying Accounts. Custom Exception. Done.
D. Querying Accounts. Query Exception. Done.


I thought the answer would be D but the correct answer is C. Can anyone please explain why? Thanks in adv.
An org has a data model with a Buyer__c object that has a lookup relationship to Region__c and a Supplier__c object has a lookup relationship to Region___c.
How can a developer display data from the related Supplier__c records on a Visualforce page that has a standard controller for the Buyer__c object?



A. Use rollup formula fields on the Buyer__c object to reference the related Supplier__c records through the Region__c.
B. Use SOQL in a controller extension to query for related Supplier__c records.
C. Use a second standard controller for the Region__c object on a page to display the related Supplier__c records.
D. Use merge field syntax to retrieve the Supplier__c records related to the Buyer__c record through the Region__c.


I believe the answer should be D but everywhere else it says the answer is A - I do not understand why though. Can anyone help affirming my belief? Thanks in adv.
 A developer has the controller class below

Public with sharing class myFooController {
                public integer prop {get; private set;}
}

Which code block will run successfully in an execute anonymous window?

a. myFooController m = new myFooController();
System.assert(m.prop != null);
b. myFooController m = new myFooController();
System.assert(m.prop == 1);
c. myFooController m = new myFooController();
System.assert(m.prop == null);
d. myFooController m = new myFooController();
System.assert(m.prop == 0);

Can someone please help me solve this question? I found out that the correct answer is option (C) but I don't understand the reason behind it.
A. Use a custom controller.
B. Use a custom controller with extensions.
C. Use a standard controller with extensions.
D. Do not specify a controller.
E. Use a standard controller.
I have been trying to deploy apex classes to a Trailhead Playgound as well as a developer org, but I receive the error "SFDX: Deploy Source to Org failed to run" in VS Code. 

Did I miss something when I set-up VS Code?
  • Salesforce CLI is up to date
  • All extensions are up to date
  • The orgs in question have been authorized successfully
  • The CLI appears to be installed correctly (when I run "sfdx" in the Terminal, I receive the Salesforce CLI menu)

This is the Salesforce CLI output:
Starting SFDX: Deploy Source to Org
11:35:46.868 sfdx force:source:deploy --sourcepath c:\Salesforce\VSCodeQuickStart\force-app --json --loglevel fatal
11:35:48.630 sfdx force:source:deploy --sourcepath c:\Salesforce\VSCodeQuickStart\force-app --json --loglevel fatal ended with exit code 1

Any help would be much appreciated!
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)

A developer created a Lightning Component to display a short text summary for an object and wants to use it with multiple Apex classes.
How should the developer design the Apex classes?


Extend each class from the same base class that has a method getTextSummary() that returns the summary.
Have each class define method getTextSummary() that returns the summary.
Have each class define method getObject() that returns the sObject that is controlled by the Apex class.
Have each class implement an interface that defines method getTextSummary() that returns the summary.

 

Please let me know which is correct answer form above.

On execution this in my Anonymous window --

List<List<sObject>> searchList = [FINd 'Mission Control' in ALL Field
                                   RETURNING Contact(FirstName,LastName,Email,Phone,Department)];

 Contact[] searchContacts = (Contact[])searchList[0];
    System.debug(searchContacts[0].LastName + ' ,' + searchContacts[0].FirstName);

a PopBox says that-
Unexpected Token at Line 1

 
Which API cannot be used to create the data model?
a. Ajax Toolkit for Force.com
b. Force.com API
c. Force.com single sign on API
d. Force.com MetaData API

Please let me know the answer with explanation .  Thanks in advance 
I'm using Workbench to test an Apex Rest POST API that I'm writing.  I want to pass paramters in the request object (not in the URL).  
So..., I don't understand what to put the in the request body field on the Workbench REST Explorer.

I was thinking that all I needed was...
{
"Parm1" : "Value1" , 
"Parm2" : "Value2"
}

But when I do that - I don't see those values in the body of the request, or in the params.

My apex code is:
@HttpPost
    global static string returnClientInfo() {
    	RestRequest		request 	= RestContext.request;
    	RestResponse	response	= RestContext.response;
    	
    	string	pParam1		= request.params.get(Param1');
    	string	pParam2		= request.params.get('Param2');
    	
    	response.addHeader('Content-Type','applicatin/json');
    	 	
    	return 'returnClientInfo finished.' + pParam1 + ' ' + pParam2 + ' request=' + request + ' request.params=' + request.params;
    }

I'm getting null for both params, and {} for the response.params.

Thanks
Hi ,
Please help me answering below questions.
1. What must the Controller for a Visualforce page utilize to override the Standard
Opportunity view button?
A. The StandardSetController to support related lists for pagination.
B. the Opportunity StandardController for pre -built functionality.
C. A callback constructor to reference the StandardController.
D.A constructor that intrializes a private Opportunity variable.
Confused between Answer B and C

2.what is a correct pattern to follow when programming in Apex on a Multi -tenant
platform?
A. Apex code is created in a separate environment from schema to reduce deployment
errors.
B.DML is performed on one record at a time to avoid possible data concurrency issues.
C. Queries select the fewest fields and records possible to avoid exceeding
governor limits.
D. Apex classes use the ''with sharing" keyword to prevent access from other server
tenants.
I think Answer is C

3.How can a developer refer to, or instantiate, a PageReference in Apex?
Choose 2 answers
A. By using a PageReference with a partial or full URL.
B. By using the Page object and a Visualforce page name.
C. By using the ApexPages.Page() method with a Visualforce page name.
D. By using the PageReference.Page() method with a partial or full URL.
I think Answer A,B

4.What can the developer do to successfully deploy the new Visualforce page and
extension?
A. Create test classes to exercise the Visualforce page markup.
B. Select "Disable Parallel Apex Testing" to run all the tests.
C. Add test methods to existing test classes from previous deployments.
D. Select "Fast Deployment'' to bypass running all the tests.
Answer D

5. When can a developer use a custom Visualforce page in a Force.com application?
Choose 2 answers
A. To create components for dashboards and layouts.
B. To deploy components between two organizations.
C. To generate a PDF document with application data.
D. To modify the page layout settings for a custom object.
Answer A, C

6. Which statement about the Lookup Relationship between a Custom Object and a
Standard Object is correct?
A. The Lookup Relationship on the Custom Object can prevent the deletion of the
Standard Object.
B. The Lookup Relationship cat:That be marked as required on the page layout for the
Custom Object.
C. The Custom Object will be deleted when the referenced Standard Object is
deleted.
D. The Custom Object inherits security from the referenced Standard Objects
Answer C

Please clarify these questions.
Hi all,

I have a problem with this challenge : 

Write an Apex trigger that fires before records are inserted and ensures that the ShippingState field has the same value as the BillingState field.
Create an Apex class named AccountTriggerHandler that contains a public static method called CreateAccounts to accept the List of Account objects.
For each Account record, before saving, ensure that the ShippingState field has the same value as the BillingState field.
Write an Apex trigger named AccountTrigger that fires before records are inserted.
The Apex trigger must call the AccountTriggerHandler.CreateAccounts() method with the collection of new records.
Create a test class named AccountTriggerTest that inserts 200 Account records with a BillingState of CA. After the insert, test to ensure that all 200 records have a ShippingState of CA.
Before verifying this challenge, run your test class at least once using the Developer Console Run All feature.

and this is my classes :
 
public class AccountTriggerHandler {
    
    public static void CreateAccounts(List<Account> acclist){
        
        
        for(Account a:acclist){
            
            if(a.ShippingState!=a.BillingState){
                a.BillingState=a.ShippingState;
              
            }
        }
    }

}
 
trigger AccountTrigger on Account (before insert) 
{
    if (Trigger.isBefore && Trigger.isInsert) {
			AccountTriggerHandler.CreateAccounts(Trigger.new);
		}	
	}
 
@isTest
public class AccountTriggerTest {
    
    @isTest static void TestCreate200Records(){
        
        // Test Setup data
        // Create 200 new Accounts
        List<Account> accts = new List<Account>();
        for(Integer i=0; i < 200; i++) {
            Account acct = new Account(Name='Test Account ' + i, BillingState = 'CA');
            accts.add(acct);
        
            Test.startTest();
            //insert acct;
        	Test.stopTest();
            
            for (Account a:accts){
                
                System.assertEquals('CA', a.ShippingState, 'ERROR');
            }
            
    }

        
}
}
And this error :
Challenge Not yet complete... here's what's wrong: 
The 'AccountTrigger' Trigger does not appear to be working correctly. Inserted records did not have matching BillingState and ShippingState values.

Anyone can help me please??
Thanks!
 
Hello,

I'm working on the "Reports & Dashboards" > "Sharing and Notifications" module of the admin beginner trail.  I'm stuck at this step because the hover menu they reference isn't available:  "Hover over a component to display the Hover menu icon for dashboard components menu."

I did go to Reports and Dashboard Settings and select the "Enable Dashboard Component Snapshots" checkbox, and clicked Save.

Any ideas?

Thanks,
Erik
hi
i am new to salesforce platform.
Install a simple Apex class, write unit tests that achieve 100% code coverage for the class, and run your Apex tests.The Apex class to test is called 'VerifyDate', and the code is available here. Copy and paste this class into your Developer Edition via the Developer Console.
'VerifyDate' is a class which tests if a date is within a proper range, and if not will return a date that occurs at the end of the month within the range.
The unit tests must be in a separate test class called 'TestVerifyDate'.
The unit tests must cover scenarios for all lines of code included in the Apex class, resulting in 100% code coverage.
Run your test class at least once (via the Developer Console) before attempting to verify this challenge.

In the above challege i am not able to write a 'TestVerifyDate' class. I dont unsertstand how to write it for a date.
plz help..
My Trigger is as following:-

trigger RestrictContactByName on Contact (before insert, before update)
{ //check contacts prior to insert or update for invalid data
For (Contact c : Trigger.New)
{
if(c.LastName == 'INVALIDNAME')
{ //invalidname is invalid
c.AddError('The Last Name "'+c.LastName+'" is not allowed for DML');
}
}
}

--------------------------------------------------
And my Test class as follows:-
@isTest
private class TestRestrictContactByName
{
    @isTest static void TestContact()
    {

        Contact con=new Contact(FirstName='Arjun', LastName='Mahi');
        if(con.LastName=='INVALIDNAME')
        {
             con.AddError('The Last Name "'+con.LastName+'" is not allowed for DML');
            
        }else{insert con;}  
 
        Contact conn=new Contact(FirstName='Arjun', LastName='Kapur');
         if(conn.LastName=='INVALIDNAME')
        {
             conn.AddError('The Last Name "'+conn.LastName+'" is not allowed for DML');
            
        }else {update conn;}  
       
        Contact com=new Contact(FirstName='Rama', LastName='INVALIDNAME');
        
        if(com.LastName=='INVALIDNAME')
        {
             com.AddError('The Last Name "'+com.LastName+'" is not allowed for DML');
            
        }else {insert conn;}
    }
}


plz help me complete this Challenge :)
Thanx in Advance :)
 

I am following the guidelines from the Chatter guide and somehow I can't get the OAuth to work. 

 

It's not working from Java or curl.   Here is what I am doing:

 

mike$ curl --form client_id=3MVG9yZ.WNe6bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxu5AjB4oT9kxi8SEhY --form client_secret=26542xxxxxxxxxxx78  --form grant_type=password --form username=xxxxxxxx@gmail.com --form password=xxxxxxx https://na11.salesforce.com/services/oauth2/token

 

What I am getting is:

{"error":"invalid_grant","error_description":"authentication failure - Invalid Password"}

 

I double checked and I am getting into na11 with the right password.  Is there anything else I need to do?

 

Here are the settings in my remote access:

 



Applicationchatter



Callback URLhttps://na11.salesforce.com/ConnectTest/oauth/_callback /// temp one



No user approval required for users in this organizationNot Checked

 


Hi ,

        Can ypu please send the sample code for http post in apex

WARNING Warning: The element type "br" should be terminated by the matching end-tag "
". at line 30

 

 

This message occasionally occurs as a warning on my VF pages (containing a <apex:pageMessages  /> tag). I have no idea where this warning is coming from...anyone knows (how to get rid of it)?