• Prince Pranav
  • NEWBIE
  • 30 Points
  • Member since 2018
  • Developer
  • Cognizant


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 5
    Replies
Can we insert multiple object records via static resources? 

Like for Account , Contact and a custom object, i want to insert TXT/CSV files ? Please post ur ideas on this?
I have a picklist field ProgressType__c on Student object. And it has values None, Manual, Pending.
I have to display the COMPLETE button on my lightning component page if ProgressType__c==Manual.

If (ProgressType__c==Manual)
{ it will display a pop up with two buttons Confirm and cancel. }

If Confirm button clicked
{ there is one Complete Checkbox Field on student record lightning page that will be marked as checked. && manual progress picklist field value will be shown as completed. }

Please help me out to do this in lightning component.
Thanks, Prince Pranav
VisualForce Page Code:

<apex:page standardController="Contact" extensions="contactExtension" standardStylesheets="true" sidebar="false">
<apex:sectionHeader title="Insert Realted Contact Deatil in Account" subtitle="{!Contact.Name}" help="/help/doc/user_ed.jsp?loc=help" /> 

<script>
function myFunction() {
  var txt;
  if (confirm("Press a button!")) {
    txt = "You pressed OK!";
  } else {
    txt = "You pressed Cancel!";
  }
  document.getElementById("demo").innerHTML = txt;
}
</script>

<apex:form >

<apex:pageBlock title="Select Account for Inserting Realted Contact Record" mode="edit">

<apex:pageBlockButtons >
<apex:commandButton action="{!save}" onclick="myFunction()" value="Save"/> 
<apex:commandButton action="{!cancel}" value="Cancel"/> 
</apex:pageBlockButtons>

<apex:pageBlockSection title="Account Detail" columns="1" >

<apex:pageBlockSectionItem >
<apex:outputLabel value="Account Name" for="accts" />  <!-- for - The ID of the component with which the label should be associated.  -->
<apex:selectList id="accts" value="{!Contact.AccountId}" size="1" title="Account">
<apex:selectOptions value="{!accts}" />
</apex:selectList>
</apex:pageBlockSectionItem>

</apex:pageBlockSection>

<apex:pageBlockSection title="Contact Deatil" columns="2">
<apex:inputField value="{!Contact.FirstName}" />
<apex:inputField value="{!Contact.LastName}" />
<apex:inputField value="{!Contact.Department}" />
<apex:inputField value="{!Contact.Phone}" />
<apex:inputField value="{!Contact.Email}" />
<apex:inputField value="{!Contact.Birthdate}" />
</apex:pageBlockSection>

</apex:pageBlock>

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


Controller Code:

public class contactExtension {

//Use a StandardController when defining an extension for a standard controller.

private final Contact c; 

// The extension constructor initializes the private member
// variable c by using the getRecord method from the standard
// controller.

public contactExtension(ApexPages.StandardController stdController) {
this.c = (Contact)stdController.getRecord();
}


public List<selectOption> getaccts() {
List<selectOption> options = new List<selectOption>(); 

options.add(new selectOption('', '- None -')); 

for (Account account : [SELECT Id, Name FROM Account]) { 

options.add(new selectOption(account.id, account.Name)); 

}
return options; 
}
}
Hi all,
Need help in trigger,

Whenever a Contact is updated and only if any of the values for the below fields changed(Oldmap and NewMap values.)

Member Id
Preferred language
Phone

For all the contacts verified against Opportunity Contact roles with IsPrimary = true. Then fetch all the Opportunities and update the values for corresponding 3 fields in Opportunity record.

Costco Member Id
Preferred language
Phone
ContactListTile
Hi All,
i am new in lightning. I am designing a Contact component. But i want like this what i uploaded in pic.
I created the crad tile with the help of slds documentation. But not geting like this format.
Create a Batch Apex Class on Account object… Fetch all the Accounts… If Account Type = ‘
Customer - Direct’ then Update the all the child contacts Status field = ‘Signed Off’. Send an email after all the processing. This email should contain the statistics like Processed records count.
Hi All,
Help me in this problem..

Create a list custom settings.. Store Country Code and currency values in that. For ex :- Country code US -> USD…. IN -> IND. 

Now create custom currency fields in Account and Contact. 

Now on Account Object.. 

After Insert/update trigger.. based on the country code on Account.. 

Populate the currency from the custom settings to Account currency field. Populate the same currency to child contact records.
Can we insert multiple object records via static resources? 

Like for Account , Contact and a custom object, i want to insert TXT/CSV files ? Please post ur ideas on this?
VisualForce Page Code:

<apex:page standardController="Contact" extensions="contactExtension" standardStylesheets="true" sidebar="false">
<apex:sectionHeader title="Insert Realted Contact Deatil in Account" subtitle="{!Contact.Name}" help="/help/doc/user_ed.jsp?loc=help" /> 

<script>
function myFunction() {
  var txt;
  if (confirm("Press a button!")) {
    txt = "You pressed OK!";
  } else {
    txt = "You pressed Cancel!";
  }
  document.getElementById("demo").innerHTML = txt;
}
</script>

<apex:form >

<apex:pageBlock title="Select Account for Inserting Realted Contact Record" mode="edit">

<apex:pageBlockButtons >
<apex:commandButton action="{!save}" onclick="myFunction()" value="Save"/> 
<apex:commandButton action="{!cancel}" value="Cancel"/> 
</apex:pageBlockButtons>

<apex:pageBlockSection title="Account Detail" columns="1" >

<apex:pageBlockSectionItem >
<apex:outputLabel value="Account Name" for="accts" />  <!-- for - The ID of the component with which the label should be associated.  -->
<apex:selectList id="accts" value="{!Contact.AccountId}" size="1" title="Account">
<apex:selectOptions value="{!accts}" />
</apex:selectList>
</apex:pageBlockSectionItem>

</apex:pageBlockSection>

<apex:pageBlockSection title="Contact Deatil" columns="2">
<apex:inputField value="{!Contact.FirstName}" />
<apex:inputField value="{!Contact.LastName}" />
<apex:inputField value="{!Contact.Department}" />
<apex:inputField value="{!Contact.Phone}" />
<apex:inputField value="{!Contact.Email}" />
<apex:inputField value="{!Contact.Birthdate}" />
</apex:pageBlockSection>

</apex:pageBlock>

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


Controller Code:

public class contactExtension {

//Use a StandardController when defining an extension for a standard controller.

private final Contact c; 

// The extension constructor initializes the private member
// variable c by using the getRecord method from the standard
// controller.

public contactExtension(ApexPages.StandardController stdController) {
this.c = (Contact)stdController.getRecord();
}


public List<selectOption> getaccts() {
List<selectOption> options = new List<selectOption>(); 

options.add(new selectOption('', '- None -')); 

for (Account account : [SELECT Id, Name FROM Account]) { 

options.add(new selectOption(account.id, account.Name)); 

}
return options; 
}
}
ContactListTile
Hi All,
i am new in lightning. I am designing a Contact component. But i want like this what i uploaded in pic.
I created the crad tile with the help of slds documentation. But not geting like this format.
I want to create a Visualforce page that displays a set of repeating tables (2 cells x 2 cells each).

How do you reference the Controller in the Apex Page to repeat so that each table shows one record?

Apex Class:
public class Repeat1 {
	public List<pba_Listing__c> ListingFields {get;set;}
	
	public GetData() {
        [Select Name, pba_Status__c From pba_Listing__c WHERE pba_Status__c = 'Active' or pba_Status__c = 'Hold Short Sale' or pba_Status__c = 'Hold Standard Sale'];
	}
    
}
Visualforce page:
 
<apex:page Controller="Repeat1" recordSetVar="a1">
    <apex:pageBlock title="Listing">
        <apex:repeat>
        	<apex:pageBlockTable value="{!a1}" var="a">
        		<table>
            		<tr>
            			<th>Name</th>
            			<th><apex:outputField value="{!a.Name}"/></th>
            		</tr>
            		<tr>
             			<td>Status</td>
                		<td><apex:outputField value="{!a.pba_Status__c}"/></td>
            		</tr>
		        </table>
        	</apex:pageBlockTable>
        </apex:repeat>
    </apex:pageBlock>
</apex:page>


 
Hi,
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
Regards,
Reshmi