• Jen Bennett
  • NEWBIE
  • 335 Points
  • Member since 2013
  • Developer
  • Liturgical Publications Inc.


  • Chatter
    Feed
  • 9
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 1
    Questions
  • 69
    Replies
I'm seeing the following error message when checking the challenge:

--- snip ---

Challenge Not yet complete... here's what's wrong: 
The Apex class 'ParkLocator' does not appear to be calling the SOAP endpoint.

--- snip ---

However, if I run ParkLocator country method from execute anonymous I get the list of parks back as expected, so the code is definitely using the SOAP service.  Also, if I remove the remote site setting for the endpoint then the challenge check fails as the SOAP endpoint is not authorized. I've also tried changing the name of the method to check that the challenge is definitely executing my code, and it fails if the name is other than 'country.

I can't see what I am missing here, but obviously I don't know what is being checked to determine if the SOAP endpoint is called. I've been seeing this for a couple of hours now and I've tried re-implementing in a different org with no success.
While doing Trailhead I was working on the Using the Report Builder section and I accidentally chose Accounts instead of Opportunities when creating a new report.  I named the report High Value Opportunities.  Issue is I now cannot complete the Module because High Value Opportunities has a name that has been used.  Any suggestions?

User-added image
Trigger_Test__c is successfully updating, however the  Account Owner Alias String is not - any idea what is the reason?

================================
//Class Logic

public with sharing class LeadTriggerHandler {
    public LeadTriggerHandler() {
       
    }

    public void OnBeforeInsert(Lead[] Leads){

        String companyName;
        for (Lead newLead : Leads){
            companyName = newLead.Company;
            break;
        }

        for ( Account existingAccount : [select Id, Name from Account where Name =: companyName limit 1  ]){
            //Leads[0].Company.addError('[Warning] Account exists.');
Leads[0].Trigger_Test__c=companyName;
Leads[0].Existing_Account_Owner__c= existingAccount.Account_Owner_Alias_string__c;
Hi,

I appreciate lots of similar questions have been asked but I can not workout where the issue is in this code, I have picked this up from a previous employee and am learning.  I have noted the error below as well as bold and underline the line.

I am trying to have a new Accounts Receiveable object create when Work Injury is chosen in a picklist on the Treatment Plan.

Error: Compile Error: Try block must have at least one catch or finally at line 2 column 1

trigger OnceARc on Treatment_Plan__c (after update, after insert) {
try{
if(Test.isRunningTest()||!OnceARc.hasAlreadyRound()){

    list<Accounts_Receivable__c> lst = new list<Accounts_Receivable__c>();
  for(Treatment_Plan__c p:trigger.new){
    boolean nst = false;
    if(trigger.isInsert){
      if(p.Division__c=='Work Injury'){
        nst=true;
      }
    }else if(trigger.isUpdate){
      string ott=trigger.oldmap.get(p.id).Division__c;
      string ntt = p.Division__c;
      if(ott!=ntt&&ntt=='Work Injury'){
        nst=true;
      }
      system.debug('!!!!!!!!!!!!ott'+ott);
      system.debug('!!!!!!!!!!!!ntt'+ntt);
      system.debug('!!!!!!!!!!!!nst'+nst);
    
    }

  if(lst.size()>0){insert lst;lst.clear();}    
    if(nst){
      OnceARc.setAlreadyRound();
      Accounts_Receivable__c st = new Accounts_Receivable__c(
      Treatment_Plan_Object__c =p.Id
      );
      lst.add(st);
      if(lst.size()>95){insert lst;lst.clear();}    
    }
  }
  if(lst.size()>0){insert lst;lst.clear();}    
}

}catch(Exception exall){}
}
Hi,

I am constantly getting this error in a test class no matter how many changes I make or how many times I try to get the current page Id. Guess am having trouble writing the correct syntax or order. Any help will be greatly appreciated. My visualforce page is creating a record and then creating or updating child records for the record created using csv upload.
This is my controller code 
public with sharing class FileUploader1
{
  
    private final Sobject parent;
    public string nameFile{get; set;}
    public Blob contentFile{get;set;}
    //public String theId;
    public List<gii__InventoryAdjustment__c> adj;
    public List<gii__ProductSerial__c> accstoupload;
    String[] filelines = new String[]{};
    private ApexPages.standardController standardController;
   
    public String theId = ApexPages.currentPage().getParameters().get('id');
   
    public FileUploader1(ApexPages.StandardController stdcontroller) {
          }
   
  //public FileUploader1(string n, blob c) {
    //this.namefile = n;
    //this.contentfile = c;
    //}
       
    public Pagereference ReadFile()
    {           
        nameFile=contentFile.toString();
        filelines = nameFile.split('\n');
       
       
       
        accstoupload = new List<gii__ProductSerial__c>();
        Integer size = filelines.size()-1;
       
        gii__InventoryAdjustment__c []adj = [SELECT gii__Warehouse__c,gii__Product__c,gii__ProductInventory__c FROM gii__InventoryAdjustment__c WHERE Id = :TheId];
      

       
        for (Integer i=1;i<filelines.size();i++)
        {
           
            String[] inputvalues = filelines[i].split(',');
            String name = inputvalues[0].trim();
            String Carton = inputvalues[1].trim();
            String Pallet = inputvalues[2].trim();
            String MBSerial = inputvalues[3].trim();
            string Mydate = inputvalues[4].trim();
            string Model = inputvalues[5].trim();
            String Refurbished = inputvalues[6].trim();
            //string school = inputvalues[7].trim();
            string price = inputvalues[7].trim();
           
                     
           
           
                       
            gii__ProductSerial__c a = new gii__ProductSerial__c();
            a.Name = name;
            a.CARTON_NO__c = Carton;
            a.PALLET_NO__c= Pallet;
            a.MBSERIAL_Number__c = MBSerial;
            a.Manufacturer_Date__c = date.parse(Mydate);
            a.Model__c = model;
            a.Refurbished__c = Refurbished;
            a.Price__c = price;
            a.gii__InventoryAdjustment__c = adj[0].Id;
            a.gii__Product__c = adj[0].gii__Product__c;
            a.gii__ProductInventory__c = adj[0].gii__ProductInventory__c;
            a.gii__Warehouse__c = adj[0].gii__Warehouse__c;
            a.gii__TransactionType__c = 'Inventory Adjustment';
          //  a.School_Registered_At__c = school;
           
            accstoupload.add(a);
           
        }
        try{
        upsert accstoupload MBSERIAL_Number__c ;
        }
         catch (Exception e)
        {
            ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured. Please check the template or try again later');
            ApexPages.addMessage(errormsg);
        }
     
       
       
    return null;
    }
  
}

And my test class is as follows
@isTest(SeeAllData = true)
private class FileUploader1Test {

    public static testmethod void constructorTest() {
   
    gii__InventoryAdjustment__c adj = new gii__InventoryAdjustment__c();
    adj.gii__AdjustmentQuantity__c = 20;
      adj.gii__AdjustmentDate__c = System.today();
      adj.gii__ProductInventory__c = 'a1c11000000AJM7';
      adj.gii__Reason__c = 'Inventory Adjustment';
      insert adj;

      PageReference pgRef = Page.Inventory_Adjustment_Another;
      //use the page reference Apex Class to instantiate a page named Inventory_Adjustment_Another
    
      Test.setCurrentPage(pgRef);
      //set the filled values for adj
     
      ApexPages.StandardController thecontroller = new ApexPages.StandardController(adj);
      //Initiation of the controller
     
      FileUploader1 controller = new FileUploader1(thecontroller);
      //the controller
    
      system.assert(thecontroller != null);
     
      thecontroller.save();
      String TheId = ApexPages.currentPage().getParameters().put('ID',adj.id);
       //blob forcontent = blob.valueof(blobcreator);
               
       String blobCreator =  '90JV1300002H42100650,G642109162,P452805539,EG451507895,6/15/2014,CD3,No,199' + '\r\n' +
                                '90JV1300002H42100651,G642109193,P452805539,EG451507643,6/15/2014,CD3,No,199'+ '\r\n' +
                                '90JV1300002H42100652,G642109162,P452805539,EG451507672,6/15/2014,CD3,No,199' + '\r\n' +
                                '90JV1300002H42100653,G642109161,P452805539,EG451507677,6/15/2014,CD3,No,199';
        
        blob forcontent = blob.valueof(blobcreator);
        controller.contentFile = forcontent;
        controller.nameFile = blobCreator;
        ApexPages.currentPage().getParameters().put('id', adj.id);
       
        Controller.ReadFile();
              
      
      }
}

this is the error that I am recieving" List index out of bounds: 0". Greatly appreciate any help possible.


Hello All,

Could someone explain the differnece of using the Get and Set methods in Apex/Visualforce page developement? 

I am always confused on how to use these methods. It would be great if someone can give an example to me!

Thanks a lot in advance!

Regards,
Raghu
Hi,

I have configured WFR Email Alerts on Opportunity Line Items (Opportunity Products) that sends email notifications when certain criteria are met.
The WFR works fine, but the criteria also includes conditions for the Opportunity, so, the WFR on Opportunity Product doesn't work when the parent Opportunity is being updated.

That's why I would like to add a trigger on the Opportunity that updates all related Opportunity Products (OLI's). It is only necessary for one specific record type (called "EU Opportunity") and it should not update any specific information on the OLI, I only want the "last modified date" to update and then WFR Email Alerts will work if the conditions are met.

1) Would this be a good solution for my situation?
2) I have tried to right a trigger and test class, but was not able to do it. Could someone please help me?

Please let me know if you'd require further information.

Many thanks in advance,
Benny
Hi,

This seems like a simple question, but I can't seem to find the answer.  Can someone please tell me how can I find out exactly when a custom field was created on an object?  I can see the last modified by/date column when looking at the object definition, but how can I find out when a given field was originally created in salesforce?

Thanks....
Hi,
I am using a flow to allow a user to edit a record.
I can display the current value of all the fields in the record except for picklists - is there any way to do this?

Also all my picklists in the flow are mandatory - do they have to be?

I asked this question out on the salesforce stackexchange but wanted to post it here as well as suggested by SalesForce support:

I have a relatively simple visualforce page that just uses the apex:detail to show the cases detail on the page. With that comes the out of the box change owner and change record type links and related record links. None of the links work due to the following security error: "Uncaught SecurityError: Blocked a frame with origin "https://c.myinstance.visual.force.com" from accessing a frame with origin "https://myinstance.salesforce.com". Protocols, domains, and ports must match. I have scoured the internet for a solution to this problem and have tried the suggestions for using the salesforce console integration toolkit. However, even the very first example in the SCIT guide does not work. When in the console and using the links on the example page I get the following error: "Uncaught TypeError: Cannot read property 'Listener' of undefined iframeinterface.js:1 Sfdc.xdomain.IframeInterface.handleOnload iframeinterface.js:1 window.onload" When not in the console I get the security error like the initial issue with a basic visualforce page with standard links in the console. Any help on this would be greatly appreciated! On a side note, I have been able to get simple functions to work, like testIsInConsole.
Hi, 

I am trying to complete the Cat Rescue module in Trailhead and I get the following error at the set up apex wrappers phase: 

User-added image

When trying to access Einstien Vision from the Lightning App I get the following which references the EinsteinVision_Admin class:

User-added image
Any help would be greatly appreciated! This error displays even when setting up a new Trailhead Playground. 
I'm seeing the following error message when checking the challenge:

--- snip ---

Challenge Not yet complete... here's what's wrong: 
The Apex class 'ParkLocator' does not appear to be calling the SOAP endpoint.

--- snip ---

However, if I run ParkLocator country method from execute anonymous I get the list of parks back as expected, so the code is definitely using the SOAP service.  Also, if I remove the remote site setting for the endpoint then the challenge check fails as the SOAP endpoint is not authorized. I've also tried changing the name of the method to check that the challenge is definitely executing my code, and it fails if the name is other than 'country.

I can't see what I am missing here, but obviously I don't know what is being checked to determine if the SOAP endpoint is called. I've been seeing this for a couple of hours now and I've tried re-implementing in a different org with no success.
I followed the instructions for this module but when I open my phone to Salesforce1, click on Top Accounts and Opportunities, I get a flashing red error "Unfortunately there was a problem.  Please try again......"  Any ideas?
While doing Trailhead I was working on the Using the Report Builder section and I accidentally chose Accounts instead of Opportunities when creating a new report.  I named the report High Value Opportunities.  Issue is I now cannot complete the Module because High Value Opportunities has a name that has been used.  Any suggestions?

User-added image
I have a custom field Sales Request that has 2 look up fields to Quote and Opportunity objects.

I'm trying to write a trigger that populates the Opportunity field when a Sales Request is created, but haven't been successful.

Any ideas on how to tweak my trigger below? Thanks!
trigger SalesRequestPopulateOpp on Sales_Request__c(Before Insert,Before Update) { 
    
    List<Id> qIds = new List<Id>();
    
      for(Sales_Request__c sr:trigger.new){

        if(sr.Quote__r.Id!=null){

            qIds.add(sr.Quote__r.Id);
           }
       }
    
  Map<Id,Quote> qMap = new Map<Id,Quote>([select id,Opportunity.Name
                                                     from Quote where id in:qIds]);
        
     for(Sales_Request__c srq :Trigger.new){
        
         if(!qMap.IsEmpty()){
    
                srq.Opportunity__c=qMap.get(srq.Quote__r.Id).Opportunity.Name;
      }            
    }
}


<apex:page standardController="Contact"  >
<apex:detail relatedList="false">

<apex:form >
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlockSection >
<apex:inputField value="{! contact.accountid}"/>
<apex:inputField value="{! contact.phone}"/>
<apex:inputField value="{! contact.FirstName}"/>
<apex:inputField value="{! contact.LastName}"/>
<apex:inputField value="{! contact.Fax}"/>
<apex:inputField value="{! contact.Email}"/>
<apex:inputField value="{! contact.title}"/>
<apex:inputField value="{! contact.phone}"/>

<apex:inputField value="{! contact.HomePhone}"/>
<apex:inputField value="{! contact.Department}"/>
<apex:inputField value="{! contact.Birthdate}"/>
<apex:inputField value="{! contact.MobilePhone}"/>



<apex:commandButton action="{! save }" value="save"/>

</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

when i save the contact it shows related list like cases, opportunity etcc..
i dont want the related list to come i hv put the tag for it but its still showing related list
I want to create a pick list of record types (account record types)  on a visual force page, and then which record type I choose that record type I want to show in that visual foce page. How do I do it please need the solution. Thank you.
I have 2 objects   Policy , Interview. On interview record policy lookup is there.  If interview fields Contact name  matches with policy field contact name and Interview field Insured name matches with any policy record's Annuity name Then it should pull the policy on to the Interview record on  policy look up field.

I have writtened below code. But it was not works properly. There is no immediate update for the Policy look up field. Can any one correct below code ?


trigger Interview_PolicyUpdate on Interviews__c

(before insert,before update) {

set<id> cset = new set<id>();
set<string> Aset = new set<string>();

for(Interviews__c Intr : Trigger.new){

If(Intr.Contact__c != Null){
cset.add(Intr.Contact__c);
}

}
List<policy__c> po = [select Id,name,Contact__c,Type__c,Annuitiant_Name__c from
Policy__c where Contact__c in:cset ];
try{
for(Interviews__c Inr : Trigger.new){
for(Policy__c p : po){
//If(Inr.Annuitant_Name__c !=null){
if(p.Contact__c == Inr.Contact__c && Inr.Insured_Name__c == p.Annuitiant_Name__c){
Inr.Policy1__c = p.Id;
}
}
}
}
catch(Exception e){
System.Debug(e.getMessage());
}
}
  • July 25, 2014
  • Like
  • 0
I am using Eclipse Kepler Service Release 2 Build id: 20140224-0627 with Force.com IDE 31.0.0.201406301722 com.salesforce.ide.feature.feature.group salesforce.com and it keeps telling me that I have a syntax error when I create a controller extension.

Here is a segment of the code:
public with sharing class CaseExtensions {

    private Case myCase;

    public CaseExtensions(ApexPages.StandardController caseCtrl ) {
        myCase = (Case)caseCtrl.getRecord();
    }

}

The IDE gives me an error on the line "myCase = (Case)caseCtrl.getRecord();" that reads:

Syntax(error = UnexpectedSyntaxError(loc = RealLoc(startIndex = 110, endIndex = 118, line = 6, column = 24), message = missing SEMICOLON at 'caseCtrl'))

If I copy and paste the exactly same code directly into SalesForce, it saves and runs fine. I think there is a bug in the syntax engine... the error message makes no sense since there is a semicolon at the end of the line.... thoughts?
Hi All,

I want to display number of contacts associated with an account using triggers.

for this I had created a lookup field like noofcontacts__c in account  object. and Wrote code as

trigger numberofcontacts on contact(after insert, after update, after delete) {
    Map<Id, List<Contact>> AcctContactList = new Map<Id, List<Contact>>();
    Set<Id> AcctIds = new Set<Id>();   
    List<schema.Account> AcctList = new List<schema.Account>();
    List<schema.Contact> ConList = new List<schema.Contact>();
   
    if(trigger.isInsert || trigger.isUPdate) {
        for(Contact Con : trigger.New) {
            if(String.isNotBlank(Con.AccountId)){
                AcctIds.add(Con.AccountId); 
            }  
        } 
    }
   
    if(trigger.isDelete) {
        for(Contact Con : trigger.Old) {
            AcctIds.add(Con.AccountId);    
        } 
    }          
   
    if(AcctIds.size() > 0){
        ConList = [SELECT Id, AccountId FROM Contact WHERE AccountId IN : AcctIds];
       
        for(Contact Con : ConList) {
            if(!AcctContactList.containsKey(Con.AccountId)){
                AcctContactList.put(Con.AccountId, new List<Contact>());
            }
            AcctContactList.get(Con.AccountId).add(Con);     
        }                          
      
           
        AcctList = [SELECT noofContacts__c FROM Account WHERE Id IN : AcctIds];
        for(Account Acc : AcctList) {
            List<schema.Contact> ContList = new List<schema.Contact>();
            ContList = AcctContactList.get(Acc.Id);
            Acc.Number_of_Contacts__c = ContList.size();
        }   
       
      
        update AcctList;   
    }

}
 I am   getting an error as "Variable doesnot exist:id".

Kindly support and suggest.

Thanks
Hello there,

I want to understand the use of these two fields on User object:

1. Start of day
2. End of day

Please advice.

Thanks in advance.
I'm working on a very old Salesforce instance that has been open until recently.

I have deleted every sharing rule in the enterprise wide sharing setting section.

I have adjusted every security profile in the system.

I have reworked every role in the heirarchy in the system.

But I am having huge issues eliminating the manually shared records to close the gap.

I need help using the dataloader or some other approach to eliminate the records that have been manually shared to groups like "All internal users" at the record level?

Please help me if you can I will give kudos to anyone that can get me across the finish line.

Thank you,
S
trigger master on parent__c (after delete)
{
  set<id> set1=new set<id>();
  list<child__C> chdellist=new list<child__C>();
  for(parent__c p:trigger.old)
  {
   set1.add(p.id);
  }
  list<child__c> chlist=[select id,name,ref_parent__c from child__c where ref_parent__c in:set1];
  system.debug(chlist);
  for(parent__c p:trigger.old)
  {
  for(child__C c:chlist)
  {
  if(p.id==c.ref_parent__c)
     system.debug(p.name+'  '+c.name);
  {
   chdellist.add(c);
  }
  }
  }
  delete chdellist;
  }

Hi All,

 

I am having really tough time dealing with Salesforce Test classes.

 

My first problem is when I write a test class, then the class I am testing does not show up in Overall Code Coverage.

 

Then when I click on test the class does show up in Class Code Coverage and show me the coverage % but when I click on it it opens without the colors telling me which line is covered and which is not.

 

 

Please let me know how to resolve this.

 

Thanks.

I'm seeing the following error message when checking the challenge:

--- snip ---

Challenge Not yet complete... here's what's wrong: 
The Apex class 'ParkLocator' does not appear to be calling the SOAP endpoint.

--- snip ---

However, if I run ParkLocator country method from execute anonymous I get the list of parks back as expected, so the code is definitely using the SOAP service.  Also, if I remove the remote site setting for the endpoint then the challenge check fails as the SOAP endpoint is not authorized. I've also tried changing the name of the method to check that the challenge is definitely executing my code, and it fails if the name is other than 'country.

I can't see what I am missing here, but obviously I don't know what is being checked to determine if the SOAP endpoint is called. I've been seeing this for a couple of hours now and I've tried re-implementing in a different org with no success.

Today we’re excited to announce the new Salesforce Developers Discussion Forums. We’ve listened to your feedback on how we can improve the forums.  With Chatter Answers, built on the Salesforce1 Platform, we were able to implement an entirely new experience, integrated with the rest of the Salesforce Developers site.  By the way, it’s also mobile-friendly.

We’ve migrated all the existing data, including user accounts. You can use the same Salesforce account you’ve always used to login right away.  You’ll also have a great new user profile page that will highlight your community activity.  Kudos have been replaced by “liking” a post instead and you’ll now be able to filter solved vs unsolved posts.

This is, of course, only the beginning  and because it’s built on the Salesforce1 Platform, we’re going to be able to bring you more features faster than ever before.  Be sure to share any feedback, ideas, or questions you have on this forum post.

Hats off to our development team who has been working tirelessly over the past few months to bring this new experience to our community. And thanks to each of you for helping to build one of the most vibrant and collaborative developer communities ever.