• Reshmi Smiju
  • NEWBIE
  • 150 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 29
    Questions
  • 35
    Replies
Hi,
I just came across a below scenario question. Please help me to find a better answer for this.

Assume I have emailed the Excel list of 800 Accounts to the Sales team. They have added a column for Website (URL), entered a value for each Account and sent the Excel file back to you.  Describe the process you would use to most efficiently get those Website values into Salesforce.

Please let me know.
Regards.
Hi all,
How to createpie chart of Expected Revenue for each Forecast Category for Opportunities with a Close Date in 2016. 

Many thanks in advance.
Reshmi
 
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
Hi,

While doing the challenge for the Set up single sign-on for your Developer Edition Chapter, I have got this message after try to login.

User-added image

MY SFDC settings screen

User-added image

Herokku screen

User-added image

Please let me know, what could be the error.
Thanks much in advance
 
Hi,

While installing Mavensmate, I am facing the issues. While creating the new project, after entering the crdentials, I am geting ""Access Denied "Error.
User-added image
But thses project got created under "Projects" in Mavensmate tab. But while clicking those file name, I am getting the follwoing error. And ofCouse the Workspace not created though

User-added image

Pls let me know what could the issue . Response highly apprecaited. Thank alot for your time.
Regards
 
Hi
Being a new comer in Integration, I tried to update a Custom field in Salesforce called Order Number , that would receive from Heroku.  Following is my REST Call out class.

public class EXT_HEROKU_Fetch_Order{

    public class ExternalOrder{
        public String Id{get;set;}
        public Integer Order_Number{get;set;}
    }
    
    public static void addOrder(List<Id> InvoiceIds){
        JSONGenerator gen = JSON.createGenerator(true);
            gen.writeStartArray();
            for(ID InvoiceID :InvoiceIds){
                gen.writeStartObject();
                gen.writeStringField('Id',InvoiceID);
                gen.WriteEndObject();
            }
            gen.writeEndArray();
        String jsonOrders = gen.getAsString();
        HttpRequest req = new HttpRequest();
            req.setMethod('POST');
            req.setEndPoint('http://enigmatic-cove-9866.herokuapp.com/order');
            req.setHeader('content-type', 'application/json');
            req.setBody(jsonOrders);
        Http http = new Http();
        HttpResponse res = http.send(req);
                // query the invoicceids
            List<Invoice__c> invoices = [select Id from Invoice__c where Id IN :InvoiceIds];
                // Deserialize the JSON string into List of ExternalOrder Wrapper.
            List<ExternalOrder> orders = (List<ExternalOrder>)JSON.deserialize(res.getBody(),List<ExternalOrder>.class);
                //  Cast the values in the Invoice Id List as a Key-Value Pair
            Map<ID,Invoice__c> invoiceMap = new Map<ID, Invoice__c> (invoices);
            
            for(ExternalOrder order : orders){
                Invoice__c invoice = invoiceMap.get(order.Id);
                Invoice.Order_Number__c = String.valueOf(order.Order_Number);
            }
            update invoices;
     }
I created an Invoice in SFDC. I tried to run in Developer console, before writing a trigger. and getting the following error User-added image

User-added image

It would be great, if you could pls let me know, what is the issue with my code.
Thank you
Regards
Reshmi
Hi,
I am trying to insert accounts with data coming from an external site. Being a beginner in Integration, I was trying to do this. But  got an error from VF page while inserting the account like "Error is in expression '{!makecall}' in component <apex:commandButton> in page ext_rest_callout_page: Class.EXT_REST_Callout_AccCreation.makecall: line 21, column 1"

Below is my code : CONTROLLER

public class EXT_REST_Callout_AccCreation{

    public String output{get;set;}
    public List<Wrapper> wrap_data {get;set;}
    public void makecall(){
        HttpRequest req = new HttpRequest();
        req.setEndPoint('http://jsonplaceholder.typicode.com/posts');
        req.setMethod('GET');
        Http h = new Http();
        HttpResponse res = h.send(req);
        output = res.getbody();
        wrap_data = (List<Wrapper>)JSON.deserialize(output,List<Wrapper>.class);
        Account acc = new Account();
        List<Account> accs = new List <Account>();
        for (Wrapper w: wrap_data ){
            acc.Name = w.Title;
            acc.Description =  w.Body;
            accs.add(acc);
            }
          insert accs;
        }
    
    public class Wrapper{
        public Account acc {get;set;}
        public Integer UserId{get;set;}
        public Integer Id{get;set;}
        public String Title{get;set;}
        public String Body{get;set;}
        
        public Wrapper(Integer u, Integer i, String t, String b){
            
                UserId = u;
                Id = i;
                Title = t;
                Body = b;
        }
    }
}

The I tried to display the Data  "wrap_data " in a VF Page, and it was coming fine. But after adding the code to insert the account with the JSON data, i got the error. Pls let me know the correct approach to do the same.

My VF Code

<apex:page controller="EXT_REST_Callout_AccCreation">
<apex:form >
    <apex:pageBlock title="REST Callout Response Data">
        <apex:commandButton action="{!makecall}" value="Show Response Data"/>

        <apex:pageBlockTable value="{!wrap_data}" var="w">
            <apex:column value="{!w.UserId}" headerValue="User ID"/>
            <apex:column value="{!w.Id}" headerValue="ID"/>
            <apex:column value="{!w.Title}" headerValue="Title"/>
            <apex:column value="{!w.Body}" headerValue="Body"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>
</apex:page>
             
Thank you,
Regards
Hi,
Below is my Rest Resource code to search  Opportunities based on particlar Stage Name. But, when I tried to search in Workbench, I am getting the below error. Actually for any url, the error is same.  Pls let me know, what is the issue with my code.

User-added image
User-added image

Below is my code :
@RestResource(urlMapping = '/Opp/Search/*')
global with sharing class SearchOppty{
    @HttpGet
    global static opp_Wrap searchopp(){
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        opp_Wrap response = new opp_Wrap();
        String text = req.requestURI.Substring(req.requestURI.lastIndexof('/')+1);
        if(doSearch(text))
        SearchOppByStageName(req,res,response);
        return response;
}
public static Boolean doSearch(String text){
    if(text == 'StageName')
        return true;
    else
        return false;
}
public static void SearchOppByStageName(RestRequest req, RestResponse res, Opp_Wrap response){
    String finaltxt = req.params.get('StageName');
    if(finaltxt == null && finaltxt == ''){
        response.Status = 'Error';
        response.Message ='Enter in correct format';
    }
    else{
        List<Opportunity> opps = [select Name, CloseDate, Amount, StageName from Opportunity
                    where StageName =:finaltxt];
        if(opps!= null && opps.size()>0){
            response.opp = opps;
            response.Status = 'Success';
            response.Message = opps.size() + ' Opportunity';
        }
        else{
            response.opp = null;
            response.Status = 'Error';
            response.Message = opps.size() + ' Opportunity';    
        }
    }
}
global class opp_Wrap{
   public List<Opportunity>opp;
    public String Status;
    public String Message;
  public opp_Wrap(){}
}   
}
Hi,

Pls let me know, the error with the following code. In the VF page , the headers are not displaying.

<apex:page controller="BulkDeleteSobject2_Controller" showHeader="true" sidebar="true">
    <apex:sectionHeader title="BulkDelete" subtitle="SObject"/>
    <apex:form >
        <apex:pageBlock id="theBlock">
            <apex:pageBlockButtons location="both">
                <apex:commandButton value="Delete Selected" action="{!DeleteSelected}" onclick="if(!confirm('Are you sure?')) return false;"/>
            </apex:pageBlockButtons>
        <apex:pageMessages />
            <apex:pageBlockSection columns="1">    
                <apex:selectList size="1" value="{!SelectedObject}" id="objects">
                    <apex:selectOptions value="{!sObjectList}" />
                    <apex:actionSupport event="onchange" action="{!executeSelect}" reRender="theBlock"/>
                    </apex:selectList>
                    <apex:pageBlockTable value="{!WrapperList}" var="item" id="records">
                        <apex:column style="width:100px;">
                            <apex:facet name="Header">
                                <apex:outputText value="Delete"/>
                            </apex:facet>
                            <apex:inputCheckbox value="{!item.DeleteThis}"/>
                        </apex:column>
                        <apex:column >
                            <apex:facet name="Header">
                                <apex:outputText value="Name/Id"/>
                            </apex:facet>
                            <apex:outputText value="{!item.Name}" rendered="{!HasName == true}"/>
                            <apex:outputText value="{!item.sObj.Id}" rendered="{!HasName == false}"/>
                        </apex:column>
                    </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Hi,

This is regarding to one of the module in Trailhead : Apex REST Callout. In this, author is menioning about the JASON2Apex. I  didnt understand to how to use that. Pls help me on this. Thanks in Advance.

Regards
Reshmi
Hi,

I would like to display a Text Field when clicking Command Link ( Title:Add Filter Logic ).After the clicking of commandlink, the link title should be renamed to Clear Filter Logic. It would be great, if anyone let me know, how to do this.
User-added image
HI,
I have to implement a serach funactionality IN VF page, that looks like as follows

User-added image

Pls let me know, how to implement this, Any sample code would be great help..
Thanks In Advance
Reshmi

 
Hi,

I am having an Issue. I want to allign two pageblocks in the Top Part of panel Grid. One a Pageblock contains some Search Parameters, and another is a page block contains Google Map.  Now, Serach Paramerts Page block coming in the Center Position of the Panel Grid .

User-added image

How to make it in the Top side , along the Google Map .
This is my Panel Grid Code
<apex:panelGrid columns="2" id="theGrid" width="100%" columnClasses="colstyle" style="vertical-align:top;" >
</apex: panelGrid>
Thanks in Advance
Reshmi
Hi,

I have a client requirment  of buidling Google Map along with List view IN SFDC as shown below. I just created a google Map along with Marking Latitude&longitude of the contact . Along with how to incoporate the LIst view. Pls let me know, how to achieve this. Thank In advance.

User-added image
Hi ,

I have come across some trouble with my code. I need to pass some list of values to VF page from My Class. My code is below.
In this, I am marking some latitude + longitude  on the google Map.  locations is coming from the Apex Class.
Along with location ,  I need to pull contacts details +mailing Address to show them in the small window in map. I know, the expression  !contacts.Name , is wrong. How to correct my code. Pls advise.

PAGE CODE
<apex:pageBlockSection rendered="{!resultsAvailable}" title="Locations">
            <apex:map width="600px" height="400px">
                <apex:repeat value="{!locations}" var="pos">
                    <apex:mapMarker position="{!pos}">
                        <!-- Add info window with contact details -->
                        <apex:mapInfoWindow >
                        <apex:outputPanel layout="block" style="font-weight: bold;">
                            <apex:outputText>{!contacts.Name }</apex:outputText>
                        </apex:outputPanel>
                      </apex:mapInfoWindow>
                    </apex:mapMarker>
                </apex:repeat>

            </apex:map>
        </apex:pageBlockSection>

APEX CLASS CODE

 String queryString =            'SELECT Id, Name, MailingStreet, MailingCity, MailingState, Phone, Location__longitude__s, Location__latitude__s ' +            'FROM Contact ' +            'WHERE DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'mi\') < 20 ' +            'ORDER BY DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'mi\') ' +            'LIMIT 10';         System.Debug('>>>> the value of queryString is ' + queryString);
        // Run the query         
List <Contact> contacts = database.query(queryString);         
if(contacts.size() > 0 ) {             
// Convert to locations that can be mapped             
locations = new List<Map<String,Double>>();       
      for (Contact con : contacts) {                 
locations.add( new Map<String,Double>{                         
'latitude' => con.Location__latitude__s,                          
'longitude' => con.Location__longitude__s                     
}                 
);             
}         
}         
else {             
System.debug('No results. Query: ' + queryString);         
}

Thanks much in Advance.
Reshmi
Hi,

I am having trouble with the following statement , which finds the nearest  latitude and longitude of the current user place. . But I am getting the error as  unexpected token: (.    What could be the trouble with my code. Pls help me

// SOQL query to get the nearest Contacts        
 String queryString = 'SELECT Id, Name, Location__longitude__s, Location__latitude__s ' +
                             'FROM Contact'+    
                          'WHERE DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'mi\') < 20 ' +                              'ORDER BY DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'mi\')' +   
                           'LIMIT 10';      
   // Run the query         
List <Contact> contacts = database.query(queryString);

This is my Debug log , for reference.

User-added image
HI.
I need a small help with my VF page . Its a page that is integrating with Google map. Basically, its a post by Dan Stone on success.salesform community.

But, i am getting a blank page. I have tried with the https &http as well.

<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">

I am getting error == > Oops, Address could not be found. What could be the issue. Much appreciated a positive response, as its bit urgent.
 
Full Code is as follows

<apex:page standardController="Account">
<apex:pageBlock >
<head>
 
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 
<script type="text/javascript"> 
 
$(document).ready(function() {
  
  var myOptions = {
    zoom: 20,
    mapTypeId: google.maps.MapTypeId.HYBRID,
    mapTypeControl: true
  }
  
  var map;
  var marker;
  
  var geocoder = new google.maps.Geocoder();
  var address = "{!Account.Project_Street_Address__c}, " + "{!Account.Project_City__c}, " + "{!Account.Project_Zipcode__c}";
  
  var infowindow = new google.maps.InfoWindow({
    content: "<b>{!Account.Name}</b>"
  });
 
  geocoder.geocode( { address: address}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK && results.length) {
      if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
      
        //create map
        map = new google.maps.Map(document.getElementById("map"), myOptions);
      
        //center map
        map.setCenter(results[0].geometry.location);
        
        //create marker
        marker = new google.maps.Marker({
            position: results[0].geometry.location,
            map: map,
            title: "{!Account.Name}"
        });
        
        //add listeners
        google.maps.event.addListener(marker, 'click', function() {
          infowindow.open(map,marker);
        });
        google.maps.event.addListener(infowindow, 'closeclick', function() {
          map.setCenter(marker.getPosition()); 
        });
        
      }
      
    } else {
      $('#map').css({'height' : '15px'});
      $('#map').html("Oops! {!Account.Name}'s address could not be found, please make sure the address is correct.");
      resizeIframe();
    }
  });
  
  function resizeIframe() {
    var me = window.name;
    if (me) {
      var iframes = parent.document.getElementsByName(me);
      if (iframes && iframes.length == 1) {
        height = document.body.offsetHeight;
        iframes[0].style.height = height + "px";
      }
    }
  }
  
});
</script>
 
<style>
#map {
  font-family: Arial;
  font-size:12px;
  line-height:normal !important;
  height:500px;
  background:transparent;
}
</style>
 
</head>
 
<body>
<div id="map"></div> 
</body> 
</apex:pageBlock>
</apex:page>
 
HI,
I was just executing a flow- creating a case record from a lead Record. . Ending up with the error "An unhandled fault has occurred in this flow". My flow will look like below.
User-added image
User-added image

User-added image
User-added image

The field LeadID is the input text field. All rest are private text fields.
Pls let me know, what is teh issue with flow.
HI,
I am facing issue with the below  VF script. the error  Incorrect parameter type for function 'not()'. Expected Boolean, received Text

<apex:page sidebar="false" standardController="Account">
  <apex:form>
    <apex:pageBlock title="Account Detail">
        <apex:pageBlockSection columns="1">
            <apex:outputField value="{!Account.Name}"/>
            <apex:outputField value="{!Account.Phone}"/>
            <apex:outputField value="{!Account.Industry}"/>
            <apex:outputField value="{!Account.AnnualRevenue}"/>
        </apex:pageBlockSection>
   </apex:pageBlock>
    <apex:pageBlock title="Contact">
        <apex:pageBlockTable value="{!Account.contacts}" var="con">
            <apex:column>
                <apex:outputLink value="{!URLFOR(!$Action.Contact.Edit, contact.Id)}">
                    Edit
                </apex:outputLink>
                 &nbsp;
                <apex:outputLink value="{!URLFOR(!$Action.Contact.Delete, contact.Id)}">
                    Del
                </apex:outputLink>
            </apex:column>
            <apex:column value="{!con.Name}"/>
            <apex:column value="{!con.Title}"/>
            <apex:column value="{!con.Phone}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
  </apex:form>
</apex:page>

Pls let me know, where the code went wrong. Thanks
Hi,
I have an account.We will update its Billing Postal Code while insertion /updation of account. Each Billing postal code( Territory) is associated with the object called territory__c and its a master object for Territory_Member__c object(child), which contains users for that particular Territory.

Its trigger is working fine. In Its the test class, the Negative test part is not going through. When I am updating the bIlling Postal code with null value, the AssertEqauls method gives me error . Expected value is 0. actual value is 8 while querying the Account along with AccountShare object.. The trigger and test class as follows.

Trigger:
trigger TerritoryShare on Account (after insert, before update) {

    Set<String>zips = new Set<String>();
    if(Trigger.isInsert){
        for (Account a: Trigger.new){
            zips.add(a.BillingPostalCode);
        }
    }else if(Trigger.isUpdate){
        Set<Id>chngedAccs = new Set<Id>();
            for(Account a:Trigger.new){
                String oldzip = Trigger.oldMap.get(a.Id).BillingPostalCode;
                String newzip =a.BillingPostalCode;
                if(oldzip!= newzip){
                    zips.add(newzip);
                    chngedAccs.add(a.Id);
                }
            }    
        //delete old teritory
        List<AccountShare> shares =[SELECT Id FROM AccountShare WHERE Id IN:chngedAccs AND RowCause = 'Manual'];
        delete shares;
    }
        Map<String,Territory__c> termap = new Map<String,Territory__c>();
        List<Territory__c> terrs = [SELECT Id,Zip_Code__c,(SELECT Id,User__c FROM Territory_Members__r)
                                   FROM Territory__c WHERE Zip_Code__c IN:zips];
        for(Territory__c ter:terrs){
            termap.put(ter.Zip_Code__c,ter);
        }
        List<AccountShare> ashares = new List<AccountShare>();
        for(Account a:Trigger.new){
            Territory__c terr = termap.get(a.BillingPostalCode);
            if(terr!= null){
                for(Territory_Member__c tm : terr.Territory_Members__r){
                    if(tm.User__c !=a.OwnerId){
                       AccountShare ashare = new AccountShare();
                        ashare.AccountId = a.Id;
                        ashare.UserOrGroupId =tm.User__c;
                        ashare.AccountAccessLevel='Edit';
                        ashare.OpportunityAccessLevel ='Edit';
                        ashares.add(ashare);
                    }
              }
                
            }
        }
      
    insert ashares;
    }

TestClass

@isTest
public class TestTerritoryShare{
    static testMethod void  TestTerritorymethod(){
        //Insert 200 users
        List<User> users = new List<User>();
        for(Integer i=0;i<200;i++){
            User u= new User();
              u.FirstName         = 'piku';
              u.LastName          = 'thepanicker';
              u.Email             = 'piku@gmail.com';
              u.Alias             = 'mula' + i;
            u.Username          = 'mula' + i + '@gmail.com';
              u.LocaleSidKey      = 'en_US';
              u.TimeZoneSidKey    = 'GMT';
              u.ProfileID        = '00e90000001b52F';
              u.LanguageLocaleKey = 'en_US';
              u.EmailEncodingKey  = 'UTF-8';
              users.add(u);
        }
        insert users;
        List<Territory__c> terrs = new List<Territory__c>();
        for (Integer i=0; i<200;i++){
            Territory__c ter = new Territory__c();
            ter.Zip_Code__c = String.ValueOf(300 + i);
            terrs.add(ter);
        }
        insert terrs;
        
        //Insert terr Members
        List<Territory_Member__c> tms= new List<Territory_Member__c>();
        for(Integer i=0;i<200;i++) {
            Integer count = Integer.valueOf(Math.random()*20);
            for(Integer j=0; j<count;j++){
                Territory_Member__c tm = new Territory_Member__c();
                tm.Territory__c = terrs[i].Id;
                tm.User__c = users[j].Id;
                tms.add(tm);
            }
        }
        insert tms;
           Test.startTest();
        //insert accs
        List<Account>accs = new List<Account>();
        for(Integer i=0;i<200;i++){
            Account acc = new Account();
            acc.Name = 'Testvest';
            acc.BillingPostalCode =String.valueOf(300+i);
            accs.add(acc);
        }
        insert accs;
        //get accs with zipcode along with accountshare records
           accs=[SELECT Id,BillingPostalCode,(SELECT Id,AccountId,
                                           AccountAccessLEvel, OpportunityAccessLevel,UserorGroupId
                                           FROM Shares WHERE RowCause ='Manual') FROM Account];
        //Map to match zipcode with territories
        Map<String, Territory__c> terrmap = new Map<String,Territory__c>();
        terrs = [SELECT Id, Zip_Code__c,(SELECT Id,User__c FROM Territory_Members__r)FROM Territory__c];
        for(Territory__c ter:terrs){
            terrmap.put(ter.Zip_Code__c,ter);
        }
        //Assert each acc has ryt no of share records
        for(Account a:accs){
            Territory__c t= terrmap.get(a.BillingPostalCode);
            Integer ShareCount =a.shares.size();
            Integer membercount = t.Territory_Members__r.size();
            System.assertEquals(ShareCount,memberCount);
        }
            // Thing should not work
        List<Account> falsaccs = new List<Account>();
        for(Account a:accs){
            a.BillingPostalCode = null;
            falsaccs.add(a);
            }
        update falsaccs;
        // assert No account share
        falsaccs=[SELECT Id,BillingPostalCode,(SELECT Id,AccountId,
                                           AccountAccessLEvel, OpportunityAccessLevel,UserorGroupId
                                           FROM Shares WHERE RowCause ='Manual') FROM Account];
        for(Account a:falsaccs){
            Integer shareCount = a.Shares.size();
            System.assertEquals(0,shareCount); /// This gives me error.  Assertion Failed: Expected: 0, Actual: 8
            }
        //Update acc back with zipcode
        for(Integer i=0;i<200;i++){
            falsaccs[i].BillingPostalCode =String.valueOf(300+i);
            }
        update falsaccs;
        // assert again with ryt no share records.
        falsaccs =[SELECT Id,BillingPostalCode,(SELECT Id,AccountId,AccountAccessLevel,OpportunityAccessLevel,UserOrGroupId
                                            FROM Shares WHERE RowCause ='Manual')
                       FROM Account];
        For(Account a:falsaccs){
            Territory__c t= terrmap.get(a.BillingPostalCode);
             Integer ShareCount =a.shares.size();
            Integer membercount = t.Territory_Members__r.size();
            System.assertEquals(ShareCount,memberCount);
        }

            Test.stopTest();
     }    
  }

Please let me know, your valuable thought. Thanks in Advance.
Regards
Reshmi
 
Hi,
I just came across a below scenario question. Please help me to find a better answer for this.

Assume I have emailed the Excel list of 800 Accounts to the Sales team. They have added a column for Website (URL), entered a value for each Account and sent the Excel file back to you.  Describe the process you would use to most efficiently get those Website values into Salesforce.

Please let me know.
Regards.
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
Hi,

While installing Mavensmate, I am facing the issues. While creating the new project, after entering the crdentials, I am geting ""Access Denied "Error.
User-added image
But thses project got created under "Projects" in Mavensmate tab. But while clicking those file name, I am getting the follwoing error. And ofCouse the Workspace not created though

User-added image

Pls let me know what could the issue . Response highly apprecaited. Thank alot for your time.
Regards
 
Hi,
I am trying to insert accounts with data coming from an external site. Being a beginner in Integration, I was trying to do this. But  got an error from VF page while inserting the account like "Error is in expression '{!makecall}' in component <apex:commandButton> in page ext_rest_callout_page: Class.EXT_REST_Callout_AccCreation.makecall: line 21, column 1"

Below is my code : CONTROLLER

public class EXT_REST_Callout_AccCreation{

    public String output{get;set;}
    public List<Wrapper> wrap_data {get;set;}
    public void makecall(){
        HttpRequest req = new HttpRequest();
        req.setEndPoint('http://jsonplaceholder.typicode.com/posts');
        req.setMethod('GET');
        Http h = new Http();
        HttpResponse res = h.send(req);
        output = res.getbody();
        wrap_data = (List<Wrapper>)JSON.deserialize(output,List<Wrapper>.class);
        Account acc = new Account();
        List<Account> accs = new List <Account>();
        for (Wrapper w: wrap_data ){
            acc.Name = w.Title;
            acc.Description =  w.Body;
            accs.add(acc);
            }
          insert accs;
        }
    
    public class Wrapper{
        public Account acc {get;set;}
        public Integer UserId{get;set;}
        public Integer Id{get;set;}
        public String Title{get;set;}
        public String Body{get;set;}
        
        public Wrapper(Integer u, Integer i, String t, String b){
            
                UserId = u;
                Id = i;
                Title = t;
                Body = b;
        }
    }
}

The I tried to display the Data  "wrap_data " in a VF Page, and it was coming fine. But after adding the code to insert the account with the JSON data, i got the error. Pls let me know the correct approach to do the same.

My VF Code

<apex:page controller="EXT_REST_Callout_AccCreation">
<apex:form >
    <apex:pageBlock title="REST Callout Response Data">
        <apex:commandButton action="{!makecall}" value="Show Response Data"/>

        <apex:pageBlockTable value="{!wrap_data}" var="w">
            <apex:column value="{!w.UserId}" headerValue="User ID"/>
            <apex:column value="{!w.Id}" headerValue="ID"/>
            <apex:column value="{!w.Title}" headerValue="Title"/>
            <apex:column value="{!w.Body}" headerValue="Body"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>
</apex:page>
             
Thank you,
Regards
Hi,
Below is my Rest Resource code to search  Opportunities based on particlar Stage Name. But, when I tried to search in Workbench, I am getting the below error. Actually for any url, the error is same.  Pls let me know, what is the issue with my code.

User-added image
User-added image

Below is my code :
@RestResource(urlMapping = '/Opp/Search/*')
global with sharing class SearchOppty{
    @HttpGet
    global static opp_Wrap searchopp(){
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        opp_Wrap response = new opp_Wrap();
        String text = req.requestURI.Substring(req.requestURI.lastIndexof('/')+1);
        if(doSearch(text))
        SearchOppByStageName(req,res,response);
        return response;
}
public static Boolean doSearch(String text){
    if(text == 'StageName')
        return true;
    else
        return false;
}
public static void SearchOppByStageName(RestRequest req, RestResponse res, Opp_Wrap response){
    String finaltxt = req.params.get('StageName');
    if(finaltxt == null && finaltxt == ''){
        response.Status = 'Error';
        response.Message ='Enter in correct format';
    }
    else{
        List<Opportunity> opps = [select Name, CloseDate, Amount, StageName from Opportunity
                    where StageName =:finaltxt];
        if(opps!= null && opps.size()>0){
            response.opp = opps;
            response.Status = 'Success';
            response.Message = opps.size() + ' Opportunity';
        }
        else{
            response.opp = null;
            response.Status = 'Error';
            response.Message = opps.size() + ' Opportunity';    
        }
    }
}
global class opp_Wrap{
   public List<Opportunity>opp;
    public String Status;
    public String Message;
  public opp_Wrap(){}
}   
}
Hi,

Pls let me know, the error with the following code. In the VF page , the headers are not displaying.

<apex:page controller="BulkDeleteSobject2_Controller" showHeader="true" sidebar="true">
    <apex:sectionHeader title="BulkDelete" subtitle="SObject"/>
    <apex:form >
        <apex:pageBlock id="theBlock">
            <apex:pageBlockButtons location="both">
                <apex:commandButton value="Delete Selected" action="{!DeleteSelected}" onclick="if(!confirm('Are you sure?')) return false;"/>
            </apex:pageBlockButtons>
        <apex:pageMessages />
            <apex:pageBlockSection columns="1">    
                <apex:selectList size="1" value="{!SelectedObject}" id="objects">
                    <apex:selectOptions value="{!sObjectList}" />
                    <apex:actionSupport event="onchange" action="{!executeSelect}" reRender="theBlock"/>
                    </apex:selectList>
                    <apex:pageBlockTable value="{!WrapperList}" var="item" id="records">
                        <apex:column style="width:100px;">
                            <apex:facet name="Header">
                                <apex:outputText value="Delete"/>
                            </apex:facet>
                            <apex:inputCheckbox value="{!item.DeleteThis}"/>
                        </apex:column>
                        <apex:column >
                            <apex:facet name="Header">
                                <apex:outputText value="Name/Id"/>
                            </apex:facet>
                            <apex:outputText value="{!item.Name}" rendered="{!HasName == true}"/>
                            <apex:outputText value="{!item.sObj.Id}" rendered="{!HasName == false}"/>
                        </apex:column>
                    </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Hi,

I would like to display a Text Field when clicking Command Link ( Title:Add Filter Logic ).After the clicking of commandlink, the link title should be renamed to Clear Filter Logic. It would be great, if anyone let me know, how to do this.
User-added image
HI,
I have to implement a serach funactionality IN VF page, that looks like as follows

User-added image

Pls let me know, how to implement this, Any sample code would be great help..
Thanks In Advance
Reshmi

 
Hi,

I am having an Issue. I want to allign two pageblocks in the Top Part of panel Grid. One a Pageblock contains some Search Parameters, and another is a page block contains Google Map.  Now, Serach Paramerts Page block coming in the Center Position of the Panel Grid .

User-added image

How to make it in the Top side , along the Google Map .
This is my Panel Grid Code
<apex:panelGrid columns="2" id="theGrid" width="100%" columnClasses="colstyle" style="vertical-align:top;" >
</apex: panelGrid>
Thanks in Advance
Reshmi
Hi ,

I have come across some trouble with my code. I need to pass some list of values to VF page from My Class. My code is below.
In this, I am marking some latitude + longitude  on the google Map.  locations is coming from the Apex Class.
Along with location ,  I need to pull contacts details +mailing Address to show them in the small window in map. I know, the expression  !contacts.Name , is wrong. How to correct my code. Pls advise.

PAGE CODE
<apex:pageBlockSection rendered="{!resultsAvailable}" title="Locations">
            <apex:map width="600px" height="400px">
                <apex:repeat value="{!locations}" var="pos">
                    <apex:mapMarker position="{!pos}">
                        <!-- Add info window with contact details -->
                        <apex:mapInfoWindow >
                        <apex:outputPanel layout="block" style="font-weight: bold;">
                            <apex:outputText>{!contacts.Name }</apex:outputText>
                        </apex:outputPanel>
                      </apex:mapInfoWindow>
                    </apex:mapMarker>
                </apex:repeat>

            </apex:map>
        </apex:pageBlockSection>

APEX CLASS CODE

 String queryString =            'SELECT Id, Name, MailingStreet, MailingCity, MailingState, Phone, Location__longitude__s, Location__latitude__s ' +            'FROM Contact ' +            'WHERE DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'mi\') < 20 ' +            'ORDER BY DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'mi\') ' +            'LIMIT 10';         System.Debug('>>>> the value of queryString is ' + queryString);
        // Run the query         
List <Contact> contacts = database.query(queryString);         
if(contacts.size() > 0 ) {             
// Convert to locations that can be mapped             
locations = new List<Map<String,Double>>();       
      for (Contact con : contacts) {                 
locations.add( new Map<String,Double>{                         
'latitude' => con.Location__latitude__s,                          
'longitude' => con.Location__longitude__s                     
}                 
);             
}         
}         
else {             
System.debug('No results. Query: ' + queryString);         
}

Thanks much in Advance.
Reshmi
Hi,

I am having trouble with the following statement , which finds the nearest  latitude and longitude of the current user place. . But I am getting the error as  unexpected token: (.    What could be the trouble with my code. Pls help me

// SOQL query to get the nearest Contacts        
 String queryString = 'SELECT Id, Name, Location__longitude__s, Location__latitude__s ' +
                             'FROM Contact'+    
                          'WHERE DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'mi\') < 20 ' +                              'ORDER BY DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'mi\')' +   
                           'LIMIT 10';      
   // Run the query         
List <Contact> contacts = database.query(queryString);

This is my Debug log , for reference.

User-added image
HI,
I am facing issue with the below  VF script. the error  Incorrect parameter type for function 'not()'. Expected Boolean, received Text

<apex:page sidebar="false" standardController="Account">
  <apex:form>
    <apex:pageBlock title="Account Detail">
        <apex:pageBlockSection columns="1">
            <apex:outputField value="{!Account.Name}"/>
            <apex:outputField value="{!Account.Phone}"/>
            <apex:outputField value="{!Account.Industry}"/>
            <apex:outputField value="{!Account.AnnualRevenue}"/>
        </apex:pageBlockSection>
   </apex:pageBlock>
    <apex:pageBlock title="Contact">
        <apex:pageBlockTable value="{!Account.contacts}" var="con">
            <apex:column>
                <apex:outputLink value="{!URLFOR(!$Action.Contact.Edit, contact.Id)}">
                    Edit
                </apex:outputLink>
                 &nbsp;
                <apex:outputLink value="{!URLFOR(!$Action.Contact.Delete, contact.Id)}">
                    Del
                </apex:outputLink>
            </apex:column>
            <apex:column value="{!con.Name}"/>
            <apex:column value="{!con.Title}"/>
            <apex:column value="{!con.Phone}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
  </apex:form>
</apex:page>

Pls let me know, where the code went wrong. Thanks
Hi,

While executing the following class from the Trailhead : Creating Test Data for Apex Tests Chapter, I am facing the error. System.ListException: Missing id at index: 0  with  all the 4 Database.deleteResult statement (marked in the code).
Class :
@isTest
private class TestAccountDeletion {
    @isTest static void TestDeleteAccountWithOneOpportunity(){
        //Test data setup
        Account[] accts = TestDataFactory.createAccountsWithOpps(1,1);
        Test.startTest();
        Database.DeleteResult result= Database.delete(accts[0], false);
        Test.stopTest();
        System.assert(!result.isSuccess());
        System.assert(result.getErrors().size() > 0);
        System.assertEquals('Cannot delete account with related opportunities.',result.getErrors()[0].getMessage());
    }
     @isTest static void TestDeleteAccountWithNoOpportunities(){
        Account [] accts = TestDataFactory.createAccountsWithOpps(1, 0);
        Test.startTest();
        Database.deleteResult result = Database.delete(accts[0],false);
        Test.stopTest();
        System.assert(result.isSuccess());
    }
     @isTest static void TestDeleteBulkAccountsWithOneOpportunity(){
        Account[] accts = TestDataFactory.createAccountsWithOpps(200,1);
        Test.startTest();
        Database.deleteResult[] result = Database.delete(accts,false);
        Test.stopTest();
        for(Database.deleteResult dr:result){
            System.assert(!dr.isSuccess());
            System.assert(dr.getErrors().size() > 0);
            System.assertEquals('Cannot delete account with related opportunities.',
                                dr.getErrors()[0].getMessage());
        }
    }
     @isTest static void TestDeleteBulkAccountsWithNoOpportunity(){
        Account[] accts = TestDataFactory.createAccountsWIthOpps(200,0);
        Test.startTest();
        Database.deleteResult[] result = Database.delete(accts, false);
        Test.stopTest();
        for(Database.deleteResult dr:result){
            System.assert(dr.isSuccess());
    }
    }
}

Pls let me know, what could be the issue. Thanks in Advance
Regards
Reshmi
Hi,
While I am executing the class ‘LeadtoMember’, I am facing the the following issue.

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger LeadConversion caused an unexpected exception, contact your administrator: LeadConversion: execution of BeforeUpdate caused by: System.DmlException: Delete failed. First exception on row 0 with id 00Q9000000pNJH4EAO; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 00Q9000000pNJH4) is currently in trigger LeadConversion, therefore it cannot recursively delete itself: []: Class.LeadtoMemberConversn.conversion: line 18, column 1

============================

The class is as follows.
public class LeadtoMemberConversn {
List<Lead> leads;
List<Member__c> members;

public LeadtoMemberConversn(List<Lead> leadList){
leads=leadList;
members= new List <Member__c>();
}
public void conversion(){
for(Lead l: leads){
Member__c member = new member__c();
member.Name = l.FirstName +” +l.LastName;
member.Email__c = l.Email;
members.add(member);
}
insert members;
List<Lead> todel= leads.deepClone(true);
delete todel;
}

public List<Member__c> getMembers(){
return members;
}
}

And the trigger is
trigger LeadConversion on Lead (before update){
List<Lead> leads= new List<Lead>();
for(Lead l:Trigger.new){
if(l.Status== ‘Member’){
leads.add(l);
}
LeadtoMemberConversn lmc= new LeadtoMemberConversn(leads);
lmc.conversion();
System.debug(‘values’+ lmc.getMembers());
}
}

While saving the Lead record’s status to Members, I am getting the error.


Thanks in Advance.
Reshmi.
How to implement custom filter logic in a visualforce page?
My custom page should look like the standard one. For example it has to support logic like (1 AND 2) or (3 AND 4) etc..
Is there any way to build. My page should look like the following (Standard one) ;)

User-added image