• Ducky
  • 2 Points
  • Member since 2017

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 4
I know the rule of 75% test coverage. But this situation really weird. Could anyone please help me out of this hard situation. I am stuck at the last step whose flow is described as below:

1. At first, I created Apex classes / Apex pages at a Trial production Org (org A) which received from the client.
2. I also create few test classes and it ran well that time.
3. The client asked us to move to sandbox Org (org B) to continue developing. All the metadata was transferred without any problem.
4. then client upgrade org A to active production Org (that means I could not touch the apex class/page in this org anymore)
5. Then now I could not deploy apex code / pages from org B to org A at all because whenever I try to deploy, the system runs the test class in org A and always throw out a coverage error. The main point is, test classes in org A were created from step 2, their coverage is not enough or even they are not correct at all. So I'm trying to make it meet the constraint, but Salesforce refused??

I noticed that system always and only run the old test class in org A, it is so weird. Why does Salesforce run the old code which I want to override? If they want to check the correctness or test coverage of the current system, they should also check at step 4 and alert users to complete the constraint. Actually, I don't know how to handle this situation. Could anyone help me. 

Thanks in advance.
  • October 05, 2017
  • Like
  • 0
I want create a custom Login Page.
After login will go to a Force.com site.
This site using a PushTopic, so i must get Sesstion Id of User.
How can get Session Id from apex class by username & password?
I am preparing for Developer 1 exam. As I am confused with below questions, it would be much helpful to find out the correct answer for them. My Answers are menioned in the brackets.

1.  Which requirement needs to be implemented by using standard workflow instead of Process Builder? Choose 2 answers.
             A.Create activities at multiple intervals.   (ANS)
             B. Send an outbound message without Apex code. (ANS)
            C. Copy an account address to its contacts.
            D. Submit a contract for approval.

2.  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. (ANS)
           B. By using the Page object and a Visualforce page name. (ANS)
           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.

3.  A developer has a single custom controller class that works with a Visualforce Wizard to support creating and editing multiple sObjects. The wizard accepts data from user Inputs across multiple Visualforce pages and from a parameter on the initial URL. Which statement is unnecessary inside the unit test for the custom controller?
            A. public ExtendedController(ApexPages.StandardController cntri) { }  
            B. ApexPages.currentPage().getParameters() put('input', 'TestValue);
            C. Test.setCurrentPage(pageRef);
            D. String nextPage = controller.save().getUrl(); (ANS)

4. A developer wants to display all of the available record types for a Case object. The developer also wants to display the picklist values for the Case.Status field. The Case object and the Case Status field are on a custom visualforce page. Which action can the developer perform to get the record types and picklist values in the controller? Choose 2 answers

           A. Use Schema.PIcklistEntry returned by Case Status getDescribe().getPicklistValues(). (ANS)
           B. Use Schema.RecordTypelnfo returned by Case.SObjectType getDescribe().getRecordTypelnfos()
           C. Use SOQL to query Case records in the org to get all the RecordType values available for Case.  (ANS)
           D. Use SOQL to query Case records In the org to get all value for the Status pickiest field.

5. An sObject named Application _c has a lookup relationship to another sObject named Position_c. Both Application _c and Position c have a picklist field named Status_c. When the Status c field on Position __c is updated, the Status_c field on Application _c needs to be populated automatically with the same value, and execute a workflow rule on Application c. Flow can a developer accomplish this?

      A. By changing Application c.Status_c into a roll-up summary field.
      B. By changing Application c.Status_c into a formula field.  (ANS)
      C. By using an Apex trigger with a DML operation.
       D. By configuring a cross-object field update with a workflow.

6. )   Which type of code represents the Controller in MVC architecture on the Force.com platform? Choose 2 answers

        A.JavaScript that is used to make a menu item display itself.
        B. StandardController system methods that are referenced by Visualforce.(ANS)
        C. Custom Apex and JavaScript code that is used to manipulate data. (ANS)
        D. A static resource that contains CSS and images.

7. A developer needs to provide a Visualforce page that lets users enter Product-specific details during a Sales cycle. How can this be accomplished? Choose 2 answers

            A. Download a Managed Package from the AppExchange that provides a custom Visualforce page to modify.
            B. Create a new Visualforce page and an Apex controller to provide Product data entry.  (ANS)
            C. Copy the standard page and then make a new Visualforce page for Product data entry.
            D. Download an Unmanaged Package from the AppExchange that provides a custom Visualforce page to modify.  (ANS)

8.  The Review_c object has a lookup relationship up to the Job_Application_c object. The job_Application_c object has a master-detail relationship up to the Position_ object. The relationship field names are based on the auto-populated defaults What is the recommended way to display field data from the related Review_c records on a Visualforce for a single Position_c record?

          A. Utilize the Standard Controller for Position_c and cross-object Formula Fields on the Job_Application c object to display Review_c data.
          B. Utilize the Standard Controller for Position_c and a Controller Extension to query for Review _C data.
          C. Utilize the Standard Controller for Position_c and expression syntax in the Page to display related Review c data through the Job_Application_c object.
          D. Utilize the Standard Controller for Position_c and cross-object Formula Fields on the Review_c object to display Review_c data.   (ANS)

9.  On a Visualforce page with a custom controller, how should a developer retrieve a record by using an ID parameter that is passed on the URL?
             A. Use the constructor method for the controller.   (ANS)
             B. Use the $Action.View method in the Visualforce page.
             C. Create a new PageReference object with the Id.
             D. Use the <apex:detail> tag in the Visualforce page.

10. 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 excel
           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. (ANS)

Thanks Much for the help in Advance
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
A. Apex code is created in a separate environment from schema to reduce deployment
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
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
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
D. The Custom Object inherits security from the referenced Standard Objects
Answer C

Please clarify these questions.
I have received the Attachement.Body from REST API call as mentioned in https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_blob_retrieve.htm from client side. 
When I get the blob returned and try to create a js file object,as below: 
    var body = [blobData];
    this.file = new File(body , fileName , {type: contentType , lastModifiedDate: new Date(), name: fileName} );
Now btoa(blobData) throws error Uncaught DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range  for image/pdf. It works fine for text.
Please help to figure this out.