• MTBRider
  • NEWBIE
  • 494 Points
  • Member since 2008

  • Chatter
    Feed
  • 16
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 47
    Questions
  • 113
    Replies
This may be a basic question, but I need to manipulate a string. I have a string that is a phone number in this format: +18888888888. I need it to become 888-888-8888. How can I do so?
Thank you!
Can Any Idea about this both alpha numeric and values between 100-200 should work.
ex.zx12should work
ex.101should work
ex.201 should not work.
Any formula idea about this.
  • March 27, 2020
  • Like
  • 0

I have a trigger that runs after a PO Number record is created. It finds the record's related Opportunity and updates the PO Number lookup field on the Opportunity with the PO Number that fired the trigger. 

 

Everything works fine except that it's not bulkified. SOQL and DML in a for loop. I'm having difficulty understanding how to bulkify something like this. I know collections are needed but I'm not sure how to use them correctly.

 

Can anyone please help me understand a step by step process of how to bulkify something like this trigger? Any help is greatly appreciated.

 

trigger updateOppPoNumber on PO_Number__c (after insert) {
    for (PO_Number__c poNum : Trigger.new) {
        if (poNum.Id != null && poNum.Opportunity__c != null) {
            // Get related Opportunity
            List<Opportunity> opp = [
                SELECT Id, PO_Number__c
                  FROM Opportunity
                 WHERE Id = :poNum.Opportunity__c
                 LIMIT 1
            ];

            // Update related Opportunity with PO Number
            if (!opp.isEmpty()) {
                opp.get(0).PO_Number__c = poNum.Id;
                update opp;
            }
        }
    }
}
Hello,

I am building a "Site" for guest users to submit a Case for support.  I have the site built, the visualforce page, and a controller extension built to add an attchment.  When the case is submitted form the site, it creates a Case record in Salesforce, the attachment shows under the notes and attachments related list, but the subject and description fields that were filled out on the Site are not being populated on the case record.  

I am at a loss here as to why they are not working, and I am a new developer so I very well could have missed something very easy.  Please look over the following code for my VF Page, and the controller extension, and if available please help me figure out how to get the subject and description fields to populate on the case record with the information that was submitted via the site submission.  

Thank you in advance for your time and help!

VF Page

<apex:page standardcontroller="Case" extensions="caseattachment"
showHeader="false">
<img src="{!$resource.AVISPL_Logo2}"></img><b/><b/>
    <apex:form >
    <apex:pageBlock >
<apex:pageBlockSection title="Hello, Thank You For Reporting Your Incident!  A Salesforce Platform Engineer Will Be In Touch Shortly. " columns="1" showHeader="True" collapsible="False">
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageMessages />

        <apex:pageBlock >
        <apex:inputField value="{!Case.CaseNumber}"/>
            <apex:pageBlockSection title="Subject">
                <apex:inputText value="{!Case.subject}" />
            </apex:pageBlockSection>

            <apex:pageBlockSection title="Attachment Or ScreenShot">                                   
            <apex:inputFile id="fileToUpload" value="{!fileBody}" filename="{!fileName}" styleClass="input-file"/>                            
            
            </apex:pageBlockSection>

            <apex:pageBlockSection title="Tell Us About The Incident">
                <apex:inputTextarea value="{!Case.Description}" rows="8" cols="80" />
            </apex:pageBlockSection>

            <apex:commandButton value="Submit Incident" action="{!Save}" />
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller extension

public class caseattachment
{
public case objcase{get;set;}
public Attachment myAttachment{get;set;}
public string fileName{get;set;} 
public Blob fileBody{get;set;}

    public caseattachment(Apexpages.standardcontroller controller)
    {
        objcase = new case();
        myAttachment =new Attachment();
    }
    public pagereference save()
    {
        insert objcase;
        System.debug('@@@@@fileBody'+fileBody);     
        myAttachment  = new Attachment();
              Integer i=0;
              myAttachment .clear();
              myAttachment.Body = fileBody;
              myAttachment.Name = this.fileName; 
              myAttachment.ParentId = objcase.id;             
              insert myAttachment;                 
        pagereference pr = new pagereference('/'+objcase.id);                           
        return pr;
    }
}

Opened a case with SF support on this, but they changed their support policies for development and won't help me so I came to the next best place...the boards!

 

When using Visualforce and Apex text editors within the SF UI, the line where my cursor is placed is getting visually duplicated a few pixels down the page. It is very annoying and confusing, I've done some searching and can't determine if other users have experienced this issue. I have tried clearing my browser cache, but that doesn't appear to have any impact.

 

Image1

Image2

  • December 13, 2013
  • Like
  • 0

Hi All,

 

Our requirement is Displaying some standard object records along with some siebel table records in PDF and siebel tables data will be display in PDF after 5 seconds. but the problem is scripting is not working in VF page. i displayed standard object records and siebel table records in VF page not in PDF but i want to display in PDF but now how to proceed i don't know please give me any one suggest me. this is very urgent i want to complete.

 

 

 

  • September 26, 2013
  • Like
  • 0

I haven't dealt with writing code for Visualforce pages yet. We have a search function for contacts that allows you to search by Zipcode and City. We want to add the ability to search by State and by contact Owner. I have adjusted most of the code so far, but I'm getting a 

 

Line 84: "Method Does Not Exist or Incorrect Signature: getContactsByState(LIST<String>)" error.

 

Do I have to define this method in the visualforce page as well with a Script? If code is needed:

public with sharing class TerritorySearchController
{
    public String searchType { public get; public set; }  
    public String searchValue { public get; public set; }
    public String zipcode { public get; public set; }  
    public String contactType { public get; public set; }  //Contact_Type__c
    public String statusType { public get; public set; } //Producer_Status__c / Prospect_Status__c
    
    public String citySearch { public get; public set; }
    public String citySearchResults { public get; public set; }
    public String citySearchSelected { public get; public set; }
    
    public String stateSearch { public get; public set; }
    public String stateSearchResults { public get; public set; }
    public String stateSearchSelected { public get; public set; }
    
    public String ownerSearch { public get; public set; }
    public String ownerSearchResults { public get; public set; }
    public String ownerSearchSelected { public get; public set; }
    
    public List<Contact> reps { public get; private set; }
    public List<Contact> repl {public get; private set; }
    public List<Contact> repo {public get; private set; }
    public Boolean mapView { public get; private set; }
    
    public TerritorySearchController()
    {
        this.reps=new List<Contact>();
        this.searchType = getParam('searchType', 'zipcode');
        this.searchValue = getParam('searchValue', '');
        this.zipcode = getParam('zipcode', '');
        this.contactType = getParam('contactType', '');
        this.statusType = getParam('statusType', '');
        this.citySearch = getParam('citySearch', '');
        this.citySearchResults = '';
        this.citySearchSelected = '';
        this.stateSearch = getParam('stateSearch', '');
        this.stateSearchResults = '';
        this.stateSearchSelected = '';
        this.ownerSearch = getParam('ownerSearch', '');
        this.ownerSearchResults = '';
        this.ownerSearchSelected = '';
        this.mapView = getBooleanParam('mapView', false);
    }
    
    public String getParam(String name, String defaultValue) {
        String value = ApexPages.currentPage().getParameters().get(name);
        return value == null ? defaultValue : value;
    }
    
    public Boolean getBooleanParam(String name, Boolean defaultValue) {
        String value = ApexPages.currentPage().getParameters().get(name);
        return value == null ? defaultValue : 'true'.equalsIgnoreCase(value);
    }
    
    public PageReference processSearch()
    {
        PageReference p=null;
        
        if (this.searchType=='city')
            p=searchCities();
        else if(this.searchType=='state')
                p=searchStates();
        else if(this.searchType=='zipcode')
                p=searchZips();
        else if(this.searchType=='owner')
                p=searchOwners();
            
        return p;
    }
    
    public PageReference searchZips()
    {
        List<String > lZips=new List<String>();
        lZips.add(this.searchValue);
        this.reps=getContactsByZip(lZips);
        return null;
    }
    
    public PageReference searchStates()
    {
        List<String> lStates=new List<String>();
        lStates.add(this.searchValue);
        this.reps=getContactsByState(lStates);
        return null;
    }
    
    public PageReference searchOwners()
    {
        List<String > lOwners=new List<String>();
        lOwners.add(this.searchValue);
        this.reps=getContactsByOwner(lOwners);
        return null;
    }
    
        public PageReference searchForCities()
    {
        String str='';
        this.citySearchResults='[';
        String strCity=this.citySearch; //Apexpages.currentPage().getParameters().get('citySearch');
        String strSOQL='SELECT Id, Name, City__c, State__c FROM Zip_Codes__c WHERE City__c LIKE \''+strCity+'%\' ORDER BY State__c LIMIT 10';
        System.debug(strSOQL);
        List<Zip_Codes__c> lZ=Database.query(strSOQL);
        Set<String> sZ=new Set<String>();
        
        for(Zip_Codes__c z : lZ)
        {
            str=z.City__c+', '+z.State__c;
            
            if(!sZ.contains(str))
            {
                if(sZ.size()>0)
                  this.citySearchResults=this.citySearchResults+',';
                  
                this.citySearchResults=this.citySearchResults+' { value: \''+z.Id+'\', label: \''+str.replace('\'', '\\\'')+'\'} ';
                sZ.add(str);
            }
        }
                    
        this.citySearchResults=this.citySearchResults+']';
        return null;
    }
    
    public PageReference searchCities()
    {
        this.reps=getContactsByCity(this.searchValue);
        return null;
    }

    public PageReference searchForStates()
    {
        String str='';
        this.stateSearchResults='[';
        String strState=this.stateSearch; //Apexpages.currentPage().getParameters().get('stateSearch');
        String strSOQL='SELECT Id, Name, City__c, State__c FROM Zip_Codes__c WHERE State__c LIKE \''+strState+'%\' ORDER BY City__c LIMIT 10';
        System.debug(strSOQL);
        List<Zip_Codes__c> lS=Database.query(strSOQL);
        Set<String> sS=new Set<String>();
        
        for(Zip_Codes__c s : ls)
        {
            str=s.City__c+', '+s.State__c;
            
            if(!stS.contains(str))
            {
                if(stS.size()>0)
                  this.stateSearchResults=this.stateSearchResults+',';
                  
                this.stateSearchResults=this.stateSearchResults+' { value: \''+s.Id+'\', label: \''+str.replace('\'', '\\\'')+'\'} ';
                stS.add(str);
            }
        }
                    
        this.stateSearchResults=this.stateSearchResults+']';
        return null;
    }

        public PageReference searchForOwners()
    {
        String str='';
        this.ownerSearchResults='[';
        String strOwner=this.ownerSearch; //Apexpages.currentPage().getParameters().get('ownerSearch');
        String strSOQL='SELECT Id, Name, City__c, State__c FROM Zip_Codes__c WHERE Owner__c LIKE \''+strOwner+'%\' ORDER BY Owner__c LIMIT 10';
        System.debug(strSOQL);
        List<Zip_Codes__c> lO=Database.query(strSOQL);
        Set<String> sO=new Set<String>();
        
        for(Zip_Codes__c o : lO)
        {
            str=o.City__c+', '+o.State__c+', '+o.Owner__c;
            
            if(!sO.contains(str))
            {
                if(sO.size()>0)
                  this.ownerSearchResults=this.ownerSearchResults+',';
                  
                this.ownerSearchResults=this.ownerSearchResults+' { value: \''+o.Id+'\', label: \''+str.replace('\'', '\\\'')+'\'} ';
                sO.add(str);
            }
        }
                    
        this.ownerSearchResults=this.ownerSearchResults+']';
        return null;
    }

    public Integer getRepCount()
    {
        return this.reps.size();
    }
    
    private List<Contact> getContactsByZip(List<String> lZips)
    {   
        List<Contact> lContacts=new List<Contact>();
        
        if(contactType==null)
            contactType=''; 
        
        String strZipCodes=' \'0\'';
        String strSOQL='SELECT ID, Name, MailingStreet, MailingCity, MailingState, MailingPostalCode, MailingCountry, Phone, Email, Contact_Type__c, Prospect_Status__c, Producer_Status__c, Broker_Dealer_Name__c FROM Contact ';
        
        for(String s: lZips)
        {
            if(s.trim()!='')
            {
                strZipCodes=strZipCodes+' OR mailingpostalcode like \''+s+'%\' ';
                this.zipcode=s;
            }
        }
         
        strSOQL=strSOQL+' WHERE (MailingPostalCode like' + strZipCodes + ') ';
      //strSOQL=strSOQL+' AND SA_Status__c = \'NS REIT - Signed Selling Agreement\' ';
        strSOQL=strSOQL+' AND ( NS_Income_II_SA_Status__c = \'NS I2 - Signed Selling Agreement\' OR NS_HI_SA_Status__c = \'NS HI - Signed Selling Agreement\' )';
        strSOQL=strSOQL+' AND Contact_Type__c != \'POND List\' ';
        strSOQL=strSOQL+' AND Contact_Type__c != null ';
        strSOQL=strSOQL+' AND OWNER__c !=null ';
        
        //
        // Handle producer/prospect types.
        //
        
        if ('Un-Profiled'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Un-Profiled\' ';
        } else if ('All Producers'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Producer\'';
        } else if ('A Producers'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Producer\' AND Producer_Status__c like \'Producer A-%\'';
        } else if ('B Producers'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Producer\' AND Producer_Status__c like \'Producer B-%\'';
        } else if ('C Producers'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Producer\' AND Producer_Status__c like \'Producer C-%\'';
        } else if ('Sphere Of Influence Producers'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Producer\' AND Producer_Status__c like \'Sphere of Influence%\'';
        } else if ('All Prospects'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Prospect\'';
        } else if ('A Prospects'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Prospect\' AND Prospect_Status__c like \'Prospect A-%\'';
        } else if ('B Prospects'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Prospect\' AND Prospect_Status__c like \'Prospect B-%\'';
        } else if ('C Prospects'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Prospect\' AND Prospect_Status__c like \'Prospect C-%\'';
        } else if ('Sphere Of Influence Prospects'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Prospect\' AND Prospect_Status__c like \'Sphere of Influence%\'';
        }
        
        System.debug(strSOQL);
        lContacts=Database.query(strSOQL);
        return lContacts;
    }
    
    private List<Contact> getContactsByCity(String strCityState)
    {
        List<Contact> lContacts=new List<Contact>();
        Integer i=strCityState.lastIndexOf(',');
        
        if(i<1)
            return lContacts;
            
        String strCity=strCityState.substring(0, i).trim();
        String strState=strCityState.substring(i+1).trim().toUpperCase();
        
        System.debug('SELECT Id,Name FROM Zip_Codes__c WHERE City__c =\''+strCity+'\' AND State__c=\''+strState+'\' ORDER BY longitude__c');
        List<Zip_Codes__c> lZ=[SELECT Id,Name FROM Zip_Codes__c WHERE City__c=:strCity AND State__c=:strState ORDER BY longitude__c];
        List<String> lZips=new List<String>();  
        
        for(Zip_Codes__c z : lZ)
        {
            lZips.add(z.Name);    
        }
        
        lContacts=getContactsByZip(lZips);
        return lContacts;       
    }
    
    private List<Contact> getContactsByState(String strCityState)
    {
        list<Contact> llContacts=new List<Contact>();
        Integer i=strCityState.lastIndexOf(',');
        
        if(i<1)
            return llContacts;
            
        String strCity=strCityState.substring(0, i).trim();
        String strState=strCityState.substring(i+1).trim().toUpperCase();
        
        System.debug('SELECT Id,Name FROM Zip_Codes__c WHERE City__c =\''+strCity+'\' AND State__c=\''+strState+'\' ORDER BY longitude__c');
        List<Zip_Codes__c> lS=[SELECT Id, Name, City__c, State__c FROM Zip_Codes__c WHERE City__c=:strCity AND State__c=:strState ORDER BY City__c LIMIT 10];
        List<String> lStates=new List<String>();  
        
        for(Zip_Codes__c s : lS)
        {
            lStates.add(s.Name);    
        }
        
        llContacts=getContactsByState(lStates);
        return llContacts;       
    }
    
    private List<Contact> getContactsByOwner(String strOwner)
    {
        List<Contact> lllContacts=new List<Contact>();
        List<Zip_Codes__c> lO=[select Id, Name, longitude__c, latitude__c, Territory__c, Owner__c, City__c, State__c from Zip_Codes__c WHERE Owner__r.Name=:strOwner];
        List<String> lOwners=new List<String>();  
        
        for(Zip_Codes__c o : lO)
        {
            lOwners.add(o.Name);    
        }
        
        lllContacts=getContactsByOwner(lOwners);
        return lllContacts;   
    }
    
    public Boolean getIsDisabledDownloadCSV() {
        return reps == null || reps.size() == 0;
    }
    
    public PageReference redirectToCSV() {
        processSearch();
        
        String documentData = '';
        documentData += '"Name",';
        documentData += '"Broker_Dealer_Name__c",';
        documentData += '"MailingStreet",';
        documentData += '"MailingCity",';
        documentData += '"MailingState",';
        documentData += '"MailingPostalCode",';
        documentData += '"Phone",';
        documentData += '"Email",';
        documentData += '"Last Completed Event",';
        documentData += '"Contact_Type__c"\r\n';
        
        for(Contact contact : reps) {
            documentData += '"' + contact.Name + '",';
            documentData += '"' + contact.Broker_Dealer_Name__c + '",';
            documentData += '"' + contact.MailingStreet + '",';
            documentData += '"' + contact.MailingCity + '",';
            documentData += '"' + contact.MailingState + '",';
            documentData += '"' + contact.MailingPostalCode + '",';
            documentData += '"' + contact.Phone + '",';
            documentData += '"' + contact.Email + '",';
            documentData += '"' + contact.Last_Event_Date__c + '",';
            documentData += '"' + contact.Contact_Type__c + '"\r\n';
        }
        
        Document document = new Document();
        document.Body = Blob.valueOf(documentData);
        document.ContentType = 'text/csv';
        document.FolderId = UserInfo.getUserId();
        document.Name = 'Territory Search - CSV Export - ' + DateTime.now().format() + '.csv';
        insert document;
        
        PageReference pageReference = new PageReference('/servlet/servlet.FileDownload?file=' + document.Id);
        pageReference.setRedirect(true);
        return pageReference;
    }
    
    public String getMapViewUrl() {
        PageReference pageReference = System.Page.TerritorySearch;
        pageReference.getParameters().put('searchType', searchType);
        pageReference.getParameters().put('searchValue', searchValue);
        pageReference.getParameters().put('zipcode', zipcode);
        pageReference.getParameters().put('contactType', contactType);
        pageReference.getParameters().put('statusType', statusType);
        pageReference.getParameters().put('citySearch', citySearch);
        pageReference.getParameters().put('stateSearch', stateSearch);
        pageReference.getParameters().put('ownerSearch', ownerSearch);
        pageReference.getParameters().put('mapView', 'true');
        return pageReference.getUrl();
    }
}

 

I am looking for help with automatically adding a person to an opportunity team.  I have a user lookup on Product2 called Financial_Analyst__c.  This is the financial analyst assigned to the individual product.  What I am looking to do is to automatically add that person to the opportunity team when the opportunity is created.  Any help will be greatly appreciated.  Thanks.

I have a before insert and update trigger that updates two writeable fields in the account based on custom setting fields. When I test manually, the trigger works. However, my test code is failing. The account name is saving but the trigger to update continent and region doesn't seem to run. I added start test and stop test around inserting the accounts but that doesn't seem to help. How do I ensure the trigger runs and updates the account a3? 

 

@isTest
private class Test_AccountTrigger {

    static testMethod void test() {


       //create 2 accounts -  billing country not in list, billing country in list
        Account a2 = new Account();
        a2.Name = 'invalid country';
        a2.billingcountry='alsdkfjasd;if';
        a2.industry = 'Agency';
        a2.Annual_company_revenue__c = 'under $100M';

        Account a3 = new Account();
        a3.Name = 'valid country';
        a3.billingcountry='Germany';
        a3.industry = 'Agency';        
        a3.Annual_company_revenue__c = 'under $100M';

        
        Test.startTest();  
                insert a2;    
                insert a3;
        Test.stopTest();
                  
                
        // Query the newly inserted records
        Account aa2 = [Select Name, Continent__c, Region1__c FROM Account where Id = :a2.Id];
        Account aa3 = [Select Name, Continent__c, Region1__c FROM Account where Id = :a3.Id];
        System.debug('aa2 ' + aa2.Name + ' continent = ' + aa2.Continent__c);
        System.debug('aa3 ' + aa3.Name + ' continent = ' + aa3.Continent__c);

        // If the trigger works, then territory and region will only be set on last account
        System.assertEquals(null, aa2.Continent__c);
        System.assertEquals(null, aa2.Region1__c);
        System.assertEquals('Europe',aa3.Continent__c);
        System.assertEquals('EMEA', aa3.Region1__c);
       

    }
}

 

 

  • May 22, 2013
  • Like
  • 0

Hi,

 

How to add image in the background of the visualforce page?

 

Regards,

Mayur

  • March 14, 2013
  • Like
  • 0

Hi,

 

getDescribe() method is not working . 

 

code:

 Schema.Describefieldresult result = Quote.test__c.getDescribe();

 

It gives me error saying that : Method does not exist or incorrect signature: [String].getDescribe()

 

but the code snippet is working fine in developer console or execute Anonymous block.

 

Pls suggest... I have read in Some blog that there its a problem with version of the class,  I tried changing it but still the issue isnt resolved.

 

Thanks.

I have a client that I implemented nightly batch load process for years ago using the dataloader command line interface.  It has worked every night for 7 years without an issue.  They now need to upgrade the server it is running on and at the same time want to upgrade dataloader.  They installed dataloader 34.0 and I cannot get it to connect to salesforce and I am starting to think there is a bug in dataloader 34. 

Here is the error:
 
C:\Program Files (x86)\salesforce.com\Data Loader\bin>process "C:\Program Files (x86)\salesforce.com\Data Loader" tempCont
2015-06-23 11:19:54,373 INFO  [main] controller.Controller initLog (Controller.java:389) - Using built-in logging configuration
\salesforce.com\Data Loader\bin\log-conf.xml
2015-06-23 11:19:54,373 INFO  [main] controller.Controller initLog (Controller.java:391) - The log has been initialized
2015-06-23 11:19:54,373 INFO  [main] process.ProcessConfig getBeanFactory (ProcessConfig.java:103) - Loading process configurat
)\salesforce.com\Data Loader\process-conf.xml
2015-06-23 11:19:54,443 INFO  [main] support.AbstractApplicationContext prepareRefresh (AbstractApplicationContext.java:495) -
ort.FileSystemXmlApplicationContext@13bd574: startup date [Tue Jun 23 11:19:54 PDT 2015]; root of context hierarchy
2015-06-23 11:19:54,474 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinitions (XmlBeanDefinitionReader.java:315) - Loadi
/Program Files (x86)/salesforce.com/Data Loader/process-conf.xml]
2015-06-23 11:19:59,029 ERROR [main] process.ProcessConfig getProcessInstance (ProcessConfig.java:96) - Error loading process:
\Program Files (x86)\salesforce.com\Data Loader\process-conf.xml
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from URL [file://C:/Program Fi
s-conf.xml]; nested exception is java.net.UnknownHostException: C
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.
        at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableAppl
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.jav
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
        at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:140)
        at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:84)
        at com.salesforce.dataloader.process.ProcessConfig.getBeanFactory(ProcessConfig.java:105)
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(ProcessConfig.java:93)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRunner.java:287)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRunner.java:273)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:246)
Caused by: java.net.UnknownHostException: C
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at sun.net.NetworkClient.doConnect(Unknown Source)
        at sun.net.NetworkClient.openServer(Unknown Source)
        at sun.net.ftp.FtpClient.openServer(Unknown Source)
        at sun.net.ftp.FtpClient.openServer(Unknown Source)
        at sun.net.www.protocol.ftp.FtpURLConnection.connect(Unknown Source)
        at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(Unknown Source)
        at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:125)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
        ... 17 more
2015-06-23 11:19:59,045 FATAL [main] process.ProcessRunner topLevelError (ProcessRunner.java:238) - Failed to create process
com.salesforce.dataloader.exception.ProcessInitializationException: Error loading process: tempCont configuration from config f
Data Loader\process-conf.xml
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(ProcessConfig.java:97)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRunner.java:287)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRunner.java:273)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:246)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from URL [file://C:
ader/process-conf.xml]; nested exception is java.net.UnknownHostException: C
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.
        at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableAppl
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.jav
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
        at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:140)
        at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:84)
        at com.salesforce.dataloader.process.ProcessConfig.getBeanFactory(ProcessConfig.java:105)
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(ProcessConfig.java:93)
        ... 3 more
Caused by: java.net.UnknownHostException: C
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at sun.net.NetworkClient.doConnect(Unknown Source)
        at sun.net.NetworkClient.openServer(Unknown Source)
        at sun.net.ftp.FtpClient.openServer(Unknown Source)
        at sun.net.ftp.FtpClient.openServer(Unknown Source)
        at sun.net.www.protocol.ftp.FtpURLConnection.connect(Unknown Source)
        at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(Unknown Source)
        at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:125)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
        ... 17 more

The error is java.net.UnknownHostException: C

Here is the relevent bean in the process-conf.xml file:
 

        Test upsert
        
        
            
        
    

The reason that I think there is a bug in DL 34 is because I also have DL 30.0.0 installed on my machine and when I change this line in the process.bat file:
 
..\Java\bin\java.exe -cp ..\dataloader-34.0-uber.jar -Dsalesforce.config.dir=%1  com.salesforce.dataloader.process.ProcessRunner %PROCESS_OPTION%

to this:
 
..\Java\bin\java.exe -cp ..\dataloader-30.0.0-uber.jar -Dsalesforce.config.dir=%1  com.salesforce.dataloader.process.ProcessRunner %PROCESS_OPTION%

and keep everything else the same, I don't get the  java.net.UnknownHostException: C  error.  

Can anyone shed any light onto this?

Thanks
Does anyone have a solution for showing reference Ids as their corresponding more human readable string?  The scenario is I have a table of cases, I want to show user friendly referenced object values (ie. don't show AccountId but show Account.name, don't show parent case Id but show parent cae number, etc.) for all possible related data for cases.  This is easily done with a Apex outputfield, but I don't want the standard Salesforce mouseover pop up box.

I have a solution that rips out the standard mouseover SF pop up after a VF page is loaded that works, but I am concerned that it can break easily.

If anyone has done this let me know.

Thanks
@future methods are queued.  Are queues single threaded within the same org?

In otherwords, if you have an @future method that mutliple user have the possibility of executing at the same time, will they get into the queue one after another?

thanks
I am seeing an issue with Activities History since my client's org got upgraded to Winter 15 over this last weekend.  Look at the sample VF page below:
<apex:page standardcontroller="Account">
	<apex:pageBlock title="Testing Activities History" >
	 	<apex:pageBlockSection title="Activities History in pageBlockTable use to work before Winter 15">
			<apex:pageBlockTable value="{!account.ActivityHistories}" var="x">
				<apex:column value="{!x.Account.Name}"/>
				<apex:column value="{!x.subject}"/>	
				<apex:column value="{!x.status}"/>
				<apex:column value="{!x.owner.name}"/>
			</apex:pageBlockTable>
		</apex:pageBlockSection>
	 	<apex:pageBlockSection title="Activities History using relatedList tag">
			<apex:relatedList list="ActivityHistories" pageSize="10"/>
		</apex:pageBlockSection>
	</apex:pageBlock>
	
	<apex:pageBlock title="Testing Open Activities" >
		<apex:pageBlockSection title="Open Activities in pageBlockTable still works after Winter 15">
			<apex:pageBlockTable value="{!account.OpenActivities}" var="x">
				<apex:column value="{!x.Account.Name}"/>
				<apex:column value="{!x.subject}"/>	
				<apex:column value="{!x.status}"/>
				<apex:column value="{!x.owner.name}"/>
			</apex:pageBlockTable>
		</apex:pageBlockSection>
		<apex:pageBlockSection title="Open Activities using relatedList tag">
			<apex:relatedList list="OpenActivities" pageSize="10"/>
		</apex:pageBlockSection>
	</apex:pageBlock>
</apex:page>
There have always been restrictions on how you look up Activities History and Open Activities for non Admin users, but the two pageBlockTables worked for non Admin users before the Winter 15 upgrade.  After the upgrade, only the Open Activities pageBloackTable works for non Admin users.  The ActivityHistories pageBlockTable for a non Admin user will now return the error message:

Object type not accessible. Please check permissions and make sure the object is not in development mode: There is an implementation restriction on ActivityHistories. When you query this relationship, security evaluation is implemented for users who don't have administrator permissions, and you must use a specific sort order: ActivityDate DESC, LastModifiedDate DESC 

Since the pageBlockTable is just using the standard relationship lookup in this case, there is no opportunity to add the sort order to the query.  

I read through the Winter 15 release notes and cannot find anything about a change that might effect this.

Anyone else seeing this?

Salesforce, is this a bug?  

I need a resolution to this since my clients cannot use some functionality since this weekend due to this issue.  

Thanks
Sorry for re-posting this but I am stuck on this and will not be able to deploy unless I get t fixed...

I am getting a Collection Store Exception using WebServiceMock in my test.  Here is my original post...
 
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000AhHlIAK

Since the last post on the above discussion, I have tried upgrading all classes involved including the test classes to API ver 31.0, changing the response_x map label on one of the web services methods in the wsdl generated class to response_y so that the two web service method responses do not reference the same response map label.  

No matter what I change, I always get the same exception using WebServiceMock.  I must be missing something.   Anyone? 
I have a web service callout that is workign fine, but I cannot get the tests working for it.  The ws has two methods; init() and sync().  init() returns a String ans sync() returns List<String>

When I try to mock the response for the two WS methods in my test method, I get a an error:
Collection store exception putting myWS.syncResponse_element into MAP<String,myWS.initResponse_element>

So, it is trying to put one methods response into the response map of the other method.  

The WebServiceMock class looks like this:
@isTest
public class myWSMock implements WebServiceMock {

   public void doInvoke(Object stub, 
			Object request, 
			Map<String, Object> response,	
			String endpoint, 
			String soapAction,
			String requestName,	
			String responseNS, 
			String responseName,	
			String responseType) 				{
			
	myWS.initResponse_element r1 = new myWS.initResponse_element();
	myWS.syncResponse_element r2 = new myWS.syncResponse_element();
	r1.initReturn = 'response1';
	r2.syncReturn = new List<String>{'response2'};
	response.put('response_x', r1);
	response.put('response_x', r2);		
   }
}

I also tried structuring it with multiple mock response classes, one for each type of response, but I still get the Collection Store exception.

Thanks for your help.

I have a web service call out the is working fine.  The web service callout is triggered in an After Trigger which collects some changed field data for Contacts and then sends it to my @future method that performs the call out. 

In my testmethod for this, I start by setting up some test data as usual.  The test data includes some Custom Settings data that is used by the @future method, a test account record, and a bunch of test contacts.  After I insert all of the test data, I set up my mock callout responses, do a Test.setMock(), and then call my web service callout class.  

I get no errors when I run the test, but I am not getting the required code coverage because within one of the @future's try statements, the "You have uncommitted work pending..." exception is thrown and processed by the try's catch statement, thus by-passing most of the lines of code in the class that is doing the callout.

I am trying to write one test class for the Trigger code and the callout code,  and I know that inserts performed in test methods are not committed, so am I going to have to break the testing up into multiple test methods because of this?  

Thanks
I have a VF page, Page1, that contains a Datatable that has it's rows populated through a wrapper class like it is described here: http://wiki.developerforce.com/page/Wrapper_Class.  Page1 functions just like the example, including the checkboxes for the user to select rows in the table.

I also have a second VF page, page2, that pops up when the user clicks a link on one of the Datatable rows in Page1.  Page2 uses the same controller as Page1 and is suppose to process the rows that have their checkbox selected.  The problem is that the object collection that was built to populate the Datatable for page1 is null when I get to Page2.  Should I be able to see the members of the collection in Page2?  If so, how can I access them?  Thanks

I am using the CreatedDate column to determine the age of a Case.  Each case is displayed in a pageblock table row.  The pageblocktable is being generateing using apex:dynamicComponent.  The Apex code to generate the column in question looks like this:

....

Component.Apex.column col = new Component.Apex.column();
col.width = '125';
col.headerValue = 'Case Age';

Component.Apex.OutputText ot = new Component.Apex.OutputText();
ot.expressions.value = '{!TEXT(ROUND((NOW() - qc.CreatedDate) * 24, 0))&\'hrs \'&TEXT(ROUND(MOD(ROUND((NOW() - qc.CreatedDate) * 24,3),1)*60,0))&\'mins\'}';

col.childComponents.add(ot);

...

 When I attempt to bring up the VF page, I get this message:

 

Incorrect parameter type for operator '-'. Expected Number, Date, DateTime, received Object

Error is in expression '{!TEXT(ROUND((NOW() - qc.CreatedDate) * 24, 0))&'hrs '&TEXT(ROUND(MOD(ROUND((NOW() - qc.CreatedDate) * 24, 3),1)*60,0))&'mins'}' in component <apex:outputText> in page 
 
However, when I use essentially the same expression in non-dynamically generated visual force:  
 
....

<apex:column headerValue="Case Age">
   <apex:outputText value="{!TEXT(ROUND((NOW() - qc.CreatedDate) * 24, 0))&'hrs'&TEXT(ROUND(MOD(ROUND((NOW() - qc.CreatedDate) * 24, 3),1)*60,0))&'min'}"/>
</apex:column>

...

 ...it works.

 

With the dynamically generated VF, seems as though the datetime is not being treated as a datetime.  I tried wrapping CreatedDate in DATETIMEVALUE() but that did not work either.

 

Anyone have any ideas on this one?

 

Thanks

Does anyone know how to set a cookie for a page that is not the current page?  I have page1 calling page2.  When page2 is .currentPage(), I want to set a cookie for page1.

 

I tried doing this:

PageReference page1 = new PageReference('/apex.page1');
Cookie cookieMsg = new Cookie('msg', 'My message', null, -1, false);      
page1.setCookies(new Cookie[]{cookieMsg});

 But that did not work.  

 

Thanks for your help.

I must be missing something very basic here.  I am trying to build a page with multiple components and want to encapsulate all of the functionality for each component into the component's own controller.  So a simplified version of it would look something like this:

 

-- VF page --
<apex:page controller="pageController">
   <c:myComponent/>
</apex:page>

-- myComponent.component--
<apex:component controller="compController" allowDML="true">
   <apex:attribute name="c" description=" " Type="Case" assignTo="{!cLookup}" required="required"/>
   
<apex:inputText label="Look Up a Case: " value="{!cNumber}"/> <apex:commandButton action="{!lookUpCase}" value=" Go "/>
<apex:messages/>
<apex:outputLabel value="Case Number: "/>
<apex:outputField value="{!c.CaseNumber}"/>
<apex:outputLabel value="Status: "/>
<apex:outputField value="{!c.status}"/>
</apex:component>

-- compController.cls --
public with sharing class compController {
private PageReference pageRef = ApexPages.currentPage();
public Case cLookup;
public String cNumber {get; set;}

public Case getcLookup() {
return cLookup;
}

public void setcLookup(Case cs) {
cLookup = cs;
}

public PageReference lookUpCase() {
if (cNumber.trim() != null) {
if ([Select COUNT() FROM Case WHERE caseNumber = :cNumber LIMIT 1] != 1) {
ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'The Case number indicated was not found.' ); ApexPages.addMessage(msg);
} else {
cLookup = ([Select CaseNumber, Status FROM Case WHERE caseNumber = :cNumber LIMIT 1]);
}
}
return pageRef;
}
}

 In the above example, I know the component controller is being called...if a bad case number is input the error message shows on the screen and I can see that the query is returning a record when a good case number is input by looking at the logs.  What is not happening is the case field values are not displaying on the screen.  If I copy all of the code in compController into pageController and change the controller reference in the component to pageController all is good.  

 

Again, I am not understanding something very basic here I am sure.  Please enlighten me.  Thanks

Has anyone put conditional formatting on the individual selectOptions values?  

 

I have a pop that allows assignment of cases to queues or the members of the queues.  The users selects a radio button for the queue or the user they want the case assigned to.  It is displayed in a kind-of tree like structure like so:

 

Queue 1

- Member 1

- Member 2

Queue 2

- Member 1

....

 

I would like to format the font of Queues different from the font of members so that it is easier to distinguish.  Cannot figure out how to do it either when the SelectOption list is being built in the page controller or in the visual force page.  Has anyone done this?  Thanks.

I finally got around to watching the adv testing and debugging webinar.  The new developer console looks to be greatly improved from the old one (which I was never able to make heads or tails of).  However, I noticed that some of the windows have scroll bars that will auto-magically scroll back up to the top of the window.  I am seeing this in the window when I look at class or trigger source code...scroll down by dragging the bar and when you let it go it scrolls back up to the top.  In fact it does this even if you do not let the bar go.  It is annoying and makes it almostt impossible to inspect the code, code coverage results, etc.

 

I am using Chrome on Windows.  Any one else seeing this?

When I try to use !URLFOR() with $Action.Case.ChangeOwner in a pageBlockTable like so: 

 

<apex:column headerValue="Ownership">
    <apex:outputLink value="{!URLFOR($Action.Case.ChangeOwner,c.id)}">[Assign]</apex:outputLink>
</apex:column>

 and then click on the link, i get the following error:

 

Unable to Access Page
The value of the "ids" parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information.

 

How does using the URLFOR() function differ when using in a row of  a table from when using it in a plain old Details page?

 

Thanks

Can some one help me understand why using the name of the param in the outputText value field does not work:

 

<apex:pageBlockSection columns="1" id="pbsList">
   <apex:pageBlockTable value="{!casesInQ}" id="pbt" var="c" columns="11" columnsWidth="50" width="1200" rowClasses="grey_background, white_background"> 
	<apex:column value="{!c.CaseNumber}"/>
	<apex:column value="{!c.Priority}"/>
	<apex:column value="{!c.Subject}" width="400"/>
	<apex:column value="{!c.Type}" width="200"/>
	<apex:column value="{!c.Status}"/>
	<apex:column value="{!c.ContactId}"/>
	<apex:column value="{!c.OwnerId}"/>
	<apex:column value="{!c.CreatedDate}"/>
	<apex:column headerValue="Case Age (hrs)">
	   <apex:outputText value="{cDt}" >
		<apex:param name="cDt" value="{!ROUND((NOW() - c.CreatedDate) * 24, 2)}"/>
	   </apex:outputText>		
        </apex:column>	
    </apex:pageBlockTable>      
</apex:pageBlockSection>

 I get a error when saving the page saying the value of the Output is not in a valid format.

 

If I {0} in the value field of outputText it works fine but, ultimately I want to change the background color of the column based on the age of the case, but using 0 to reference the param in a conditional that says if the age of the case is > 2, make the background red, is never going to eval correctly.

 

Thanks for your help

Two things....

 

First, is inline edit support on VF pages by default?   The reason I ask is because I had inlineEditSupport tags on a VF page that I built.  I was having trouble getting an actionsupport to work.  As part of debugging that, I removed all of the inlineEditSupport tags on the page thinking that they might be the issue.  When I tried the page with all of the inlineEditSupport tags removed, I was still able to do inline editing.  What gives?

 

As for why the actionSupport not working, I cannot figure that out.   Here is the relevent part of the page:

 

 	<!-- The Opportunity Information Section -->
      	<apex:actionRegion > 	<!-- This action region sets the prob % when the stage is changed -->
        	<apex:pageBlockSection collapsible="false" columns="2" id="pbsOppInfo">
        		<apex:repeat value="{!$ObjectType.Opportunity.FieldSets.Opportunity_Information}" var="f">
            		<apex:outputField value="{!showFieldSet[f]}">
           				<apex:inlineEditSupport disabled="{!IF(f.Label = 'Name' || CONTAINS(f.Label,'Probability'), true, false)}" showOnEdit="sBtn, cBtn" hideOnEdit="eBtn, dBtn" event="ondblClick" changedStyleClass="inline_edit_color" resetFunction="resetInlineEdit"/>
               			<apex:actionSupport event="onchange" action="{!getprobPercentage}" rerender="pbsOppInfo" disabled="{!IF(f.Label != 'Stage', true, false)}" />
                	</apex:outputField>
                </apex:repeat>
				<apex:pageBlockSectionItem >
	        		<apex:outputLabel value="  "/>
	        		<apex:outputLink value="{!URLFOR($Action.Opportunity.ChangeOwner,Opportunity.Id)}">[Change Owner]</apex:outputLink>
				</apex:pageBlockSectionItem>
			</apex:pageBlockSection>
		</apex:actionRegion>
       		<!--  -->

 The thing is that the identical actionSupport works on the edit page that I built, just not this view page.  The only difference between the two pages are the use of outputfields and the inlineEditSupport.  Does anyone know if ActionSupport does not work right when it is a child of a outputfield that also has a child inlineEditSupport?

 

Thanks

I am wondering if anyone has come across this before.  When deploying code that is used by a Schedulable class, the platform prevents you from deploying the code if the code in question is anywhere in the dependency tree of the schedulable class.  Today I tried to deploy some code that would be two levels down from a schedulable class that I have and was prevented form doing so.  The problem is, the schedulable class that used it was not actually scheduled...another class was scheduled, but that class did not use this code at all. 

 

Once I deleted that scheduled job that did not use the code in question (there is no way to edit a scheduled job, since the screen only has a Delete button and a Cancel button AND it seems to me that there should be an Active checkbox that allows you to disable the job without deleting it, but I am starting to rant here...), I was allowed to deploy the code.

 

Is this a bug?

 

Notwithstanding the above situation, it seems to me that if code is more than one level away from the Schedulable class, and the jobs is not currently running, you should be able to deploy your code without having to delete the job.

I am currently creating opportunity teams in a trigger by inserting into OpportunityTeamMember and then OpportunityShare.  Everything is working on the surface...the team members are getting created.  But when I look into the logs, I am seeing errors when inserting into the team member table:

 

12:20:39.283 (283789000)|USER_DEBUG|[236]|DEBUG|.............The DB Insert failed for the following Opportunity Team Member: 00560000000zDeyAAE
12:20:39.286 (286362000)|USER_DEBUG|[237]|DEBUG|.............The DB returned the following error for the above record: Database.Error[getFields=(Opportunity);getMessage=Required fields are missing: [Opportunity];getStatusCode=REQUIRED_FIELD_MISSING;]

From the message,  I am not quite sure which required field is missing. I am inserting the Opportunity ID, the user ID, and the team role into the team member table.  then for each record that was inserted into the team member  table, I am inserting a corresponding opportunityshare record.  The only other field that looks like it may be required in the OpportunityTeamMember table is the OpportunityAccessLevel column, but that field is not writeable (I assume this column is being updated by a backend process once the opportunityshare record is created).

 

If there are suppose to be three users on the team, there will three sets of the above messages in the logs, yet all three members are showing on the opportunity as team members.  So it appears to be working.  Any ideas why I am seeing this in the logs?  Thanks

Here is another one for inlineEditSupport....I am noticing that if you are using the showOnEdit and hideOnEdit attributes to display and hide buttons, that if you have code somewhere that does .addErroor on a field, those attributes seem to be ignored.  

 

I am doing this:

 

<apex:inlineEditSupport showOnEdit="saveBtn, cancelBtn" hideOnEdit="editBtn, deleteBtn" event="ondblClick" changedStyleClass="inline_edit_color" resetFunction="resetInlineEdit"/>

which works fine until I do a .addError, then the save button and cancel button disappear and the edit and delete button appear which is unfortunate because the error message say "...click the Cancel button to continue :).  Anyone know how to fix this?  Thanks.

 

 

How does one intilialize field sets for dynamic Visualforce?  The value attribute of the repeat tag takes an Object list, so I cannot do this in Apex:

 

Component.Apex.Repeat someAcctFields = new Component.Apex.Repeat();
someAcctFields.value = "{!$ObjectType.Account.FieldSets.aBunchOfAcctFields}";
someAcctFields.var = 'f';

 

I cannot find any documentation on the syntax for this and obviously lack the smarts to figure it out on my own :)  !   Anyone know?  Thanks

 

 

I have a client that I implemented nightly batch load process for years ago using the dataloader command line interface.  It has worked every night for 7 years without an issue.  They now need to upgrade the server it is running on and at the same time want to upgrade dataloader.  They installed dataloader 34.0 and I cannot get it to connect to salesforce and I am starting to think there is a bug in dataloader 34. 

Here is the error:
 
C:\Program Files (x86)\salesforce.com\Data Loader\bin>process "C:\Program Files (x86)\salesforce.com\Data Loader" tempCont
2015-06-23 11:19:54,373 INFO  [main] controller.Controller initLog (Controller.java:389) - Using built-in logging configuration
\salesforce.com\Data Loader\bin\log-conf.xml
2015-06-23 11:19:54,373 INFO  [main] controller.Controller initLog (Controller.java:391) - The log has been initialized
2015-06-23 11:19:54,373 INFO  [main] process.ProcessConfig getBeanFactory (ProcessConfig.java:103) - Loading process configurat
)\salesforce.com\Data Loader\process-conf.xml
2015-06-23 11:19:54,443 INFO  [main] support.AbstractApplicationContext prepareRefresh (AbstractApplicationContext.java:495) -
ort.FileSystemXmlApplicationContext@13bd574: startup date [Tue Jun 23 11:19:54 PDT 2015]; root of context hierarchy
2015-06-23 11:19:54,474 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinitions (XmlBeanDefinitionReader.java:315) - Loadi
/Program Files (x86)/salesforce.com/Data Loader/process-conf.xml]
2015-06-23 11:19:59,029 ERROR [main] process.ProcessConfig getProcessInstance (ProcessConfig.java:96) - Error loading process:
\Program Files (x86)\salesforce.com\Data Loader\process-conf.xml
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from URL [file://C:/Program Fi
s-conf.xml]; nested exception is java.net.UnknownHostException: C
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.
        at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableAppl
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.jav
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
        at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:140)
        at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:84)
        at com.salesforce.dataloader.process.ProcessConfig.getBeanFactory(ProcessConfig.java:105)
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(ProcessConfig.java:93)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRunner.java:287)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRunner.java:273)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:246)
Caused by: java.net.UnknownHostException: C
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at sun.net.NetworkClient.doConnect(Unknown Source)
        at sun.net.NetworkClient.openServer(Unknown Source)
        at sun.net.ftp.FtpClient.openServer(Unknown Source)
        at sun.net.ftp.FtpClient.openServer(Unknown Source)
        at sun.net.www.protocol.ftp.FtpURLConnection.connect(Unknown Source)
        at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(Unknown Source)
        at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:125)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
        ... 17 more
2015-06-23 11:19:59,045 FATAL [main] process.ProcessRunner topLevelError (ProcessRunner.java:238) - Failed to create process
com.salesforce.dataloader.exception.ProcessInitializationException: Error loading process: tempCont configuration from config f
Data Loader\process-conf.xml
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(ProcessConfig.java:97)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRunner.java:287)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRunner.java:273)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:246)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from URL [file://C:
ader/process-conf.xml]; nested exception is java.net.UnknownHostException: C
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.
        at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableAppl
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.jav
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
        at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:140)
        at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:84)
        at com.salesforce.dataloader.process.ProcessConfig.getBeanFactory(ProcessConfig.java:105)
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(ProcessConfig.java:93)
        ... 3 more
Caused by: java.net.UnknownHostException: C
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at sun.net.NetworkClient.doConnect(Unknown Source)
        at sun.net.NetworkClient.openServer(Unknown Source)
        at sun.net.ftp.FtpClient.openServer(Unknown Source)
        at sun.net.ftp.FtpClient.openServer(Unknown Source)
        at sun.net.www.protocol.ftp.FtpURLConnection.connect(Unknown Source)
        at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(Unknown Source)
        at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:125)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
        ... 17 more

The error is java.net.UnknownHostException: C

Here is the relevent bean in the process-conf.xml file:
 

        Test upsert
        
        
            
        
    

The reason that I think there is a bug in DL 34 is because I also have DL 30.0.0 installed on my machine and when I change this line in the process.bat file:
 
..\Java\bin\java.exe -cp ..\dataloader-34.0-uber.jar -Dsalesforce.config.dir=%1  com.salesforce.dataloader.process.ProcessRunner %PROCESS_OPTION%

to this:
 
..\Java\bin\java.exe -cp ..\dataloader-30.0.0-uber.jar -Dsalesforce.config.dir=%1  com.salesforce.dataloader.process.ProcessRunner %PROCESS_OPTION%

and keep everything else the same, I don't get the  java.net.UnknownHostException: C  error.  

Can anyone shed any light onto this?

Thanks
I have a VF page, Page1, that contains a Datatable that has it's rows populated through a wrapper class like it is described here: http://wiki.developerforce.com/page/Wrapper_Class.  Page1 functions just like the example, including the checkboxes for the user to select rows in the table.

I also have a second VF page, page2, that pops up when the user clicks a link on one of the Datatable rows in Page1.  Page2 uses the same controller as Page1 and is suppose to process the rows that have their checkbox selected.  The problem is that the object collection that was built to populate the Datatable for page1 is null when I get to Page2.  Should I be able to see the members of the collection in Page2?  If so, how can I access them?  Thanks
This may be a basic question, but I need to manipulate a string. I have a string that is a phone number in this format: +18888888888. I need it to become 888-888-8888. How can I do so?
Thank you!
Can Any Idea about this both alpha numeric and values between 100-200 should work.
ex.zx12should work
ex.101should work
ex.201 should not work.
Any formula idea about this.
  • March 27, 2020
  • Like
  • 0

I have a trigger that runs after a PO Number record is created. It finds the record's related Opportunity and updates the PO Number lookup field on the Opportunity with the PO Number that fired the trigger. 

 

Everything works fine except that it's not bulkified. SOQL and DML in a for loop. I'm having difficulty understanding how to bulkify something like this. I know collections are needed but I'm not sure how to use them correctly.

 

Can anyone please help me understand a step by step process of how to bulkify something like this trigger? Any help is greatly appreciated.

 

trigger updateOppPoNumber on PO_Number__c (after insert) {
    for (PO_Number__c poNum : Trigger.new) {
        if (poNum.Id != null && poNum.Opportunity__c != null) {
            // Get related Opportunity
            List<Opportunity> opp = [
                SELECT Id, PO_Number__c
                  FROM Opportunity
                 WHERE Id = :poNum.Opportunity__c
                 LIMIT 1
            ];

            // Update related Opportunity with PO Number
            if (!opp.isEmpty()) {
                opp.get(0).PO_Number__c = poNum.Id;
                update opp;
            }
        }
    }
}
Can you deserializeUntyped with JSON arrays?
I'm finding it difficult to get down into the "client" level so that I can retrieve ID and Status. 
results.get('items') was easy enough at the top level, but attempting results.get('client') fails.

Using this JSON:
{
    "items": [
        {
            "client": {
                "id": "xyz65240-a8e0-4184-8aaa-8b381ea83ce5",
                "status": "enabled"
            }
        },
        {
            "client": {
                "id": "8b265241-3662-4a49-b7dd-97f948ca9bb6",
                "status": "enabled"
            }
        }
    ]
}

Using this code:
Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());

List<Object> items = (List<Object>) results.get('items');
    System.debug('Received the following items:');
    for (Object item: items) {
        System.debug('Item:');
        System.debug(item);
    }

Hi All!

The LWC I've created lives on the Opportunity record page - and I want the LWC to pull all of the related records from an object titled, 'Junction - Opportunity/Competitor'. Right now, I am only able to hard code the recordid that the component pulls from. 

I am trying to get my LWC (a lightning-datatable) to pull in the recordid automatically so that the component shows information relevant to the record you're viewing.



relatedlist_competitor.cls

public with sharing class relatedlist_competitor {
    @AuraEnabled(cacheable = true)
public static List<Junction_Competitor_Opportunity__c> fetchCompetitor (String Opportunityid){
       return [SELECT Id,Competitor_Name_for_Flow__c,Bullet_1__c,Bullet_2__c,Opportunity__c FROM Junction_Competitor_Opportunity__c WHERE Opportunity__c = :Opportunityid];
    }
}


relatedlist_competitor.html
<template>

        <!--lightning datatable-->
         <lightning-datatable 
               key-field="id"
               data={parameters.data}
               onrowaction={handleRowAction}
               row-number-offset={rowOffset}
               hide-checkbox-column="true"
               columns={columns}></lightning-datatable>
                  
           <!-- Detail view modal start -->
         <template if:true={bShowModal}>
          <section role="dialog" tabindex="-1"
                   aria-labelledby="modal-heading-01"
                   aria-modal="true"
                   aria-describedby="modal-content-id-1"
                  class="slds-modal slds-fade-in-open">
             <div class="slds-modal__container">
                <!-- modal header start -->
                <header class="slds-modal__header">
                   <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closeModal}>
                      <lightning-icon icon-name="utility:close" alternative-text="close" variant="inverse" size="small" ></lightning-icon>
                   </button>
                   <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">Record Detail</h2>
                </header>
                <!-- modal body start -->
                <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                  <dl class="slds-list_horizontal slds-wrap">
                      <dt class="slds-item_label" title="Name">Competitor Name</dt>
                      <dd class="slds-item_detail">{record.Competitor_Name_for_Flow__c}</dd>
                  </dl>
                </div>
                <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-2">
                     <dl class="slds-list_horizontal slds-wrap">
                         <dt class="slds-item_label" title="Name">Bullet 1</dt>
                         <dd class="slds-item_detail">{record.Bullet_1__c}</dd>
                     </dl>
                   </div>
                   <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-3">
                        <dl class="slds-list_horizontal slds-wrap">
                            <dt class="slds-item_label" title="Name">Bullet 2</dt>
                            <dd class="slds-item_detail">{record.Bullet_2__c}</dd>
                        </dl>
                      </div>
                <!-- modal footer start-->
                <footer class="slds-modal__footer">
                     <lightning-button variant="brand"
                     label="Close"
                     title="Close"
                     onclick={closeModal}
                     ></lightning-button>
                </footer>
             </div>
          </section>
          <div class="slds-backdrop slds-backdrop_open"></div>
       </template>
       <!-- Detail view modal end -->
  
      </template>

relatedlist_competitor.js
import {
    LightningElement,
    wire,
    api,
    track,
} from 'lwc';
 
//import method from the Apex Class
import fetchCompetitor from '@salesforce/apex/relatedlist_competitor.fetchCompetitor';
 
// Declaring the columns in the datatable
const columns = [{
        label: '',
        type: 'button-icon',
        initialWidth: 75,
        typeAttributes: {
            iconName: 'utility:picklist_type',
            title: 'Preview',
            variant: 'border-filled',
            alternativeText: 'View'
        }
    },
    {
        label: 'Competitor',
        fieldName: 'Competitor_Name_for_Flow__c'
    },
];
 
// declare class to expose the component
export default class DataTableComponent extends LightningElement {
    @track columns = columns;
    @track record = {};
    @track rowOffset = 0;
    @track data = {};
    @track bShowModal = false;
    @api recordid;
    @wire(fetchCompetitor, {Opportunityid:"00629000008UIbbAAG"}) parameters;
 
    // Row Action event to show the details of the record
    handleRowAction(event) {
        const row = event.detail.row;
        this.record = row;
        this.bShowModal = true; // display modal window
    }
 
    // to close modal window set 'bShowModal' tarck value as false
    closeModal() {
        this.bShowModal = false;
    }
}

relatedlist_competitor.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="dataTableComponent">
    <apiVersion>45.0</apiVersion>
    <isExposed>true</isExposed>
    <!-- With following targets make component available for lightning app page, record page and home page in salesforce --><targets>
        <target>lightning__RecordPage</target>
    </targets>
</LightningComponentBundle>

 
I have a client that I implemented nightly batch load process for years ago using the dataloader command line interface.  It has worked every night for 7 years without an issue.  They now need to upgrade the server it is running on and at the same time want to upgrade dataloader.  They installed dataloader 34.0 and I cannot get it to connect to salesforce and I am starting to think there is a bug in dataloader 34. 

Here is the error:
 
C:\Program Files (x86)\salesforce.com\Data Loader\bin>process "C:\Program Files (x86)\salesforce.com\Data Loader" tempCont
2015-06-23 11:19:54,373 INFO  [main] controller.Controller initLog (Controller.java:389) - Using built-in logging configuration
\salesforce.com\Data Loader\bin\log-conf.xml
2015-06-23 11:19:54,373 INFO  [main] controller.Controller initLog (Controller.java:391) - The log has been initialized
2015-06-23 11:19:54,373 INFO  [main] process.ProcessConfig getBeanFactory (ProcessConfig.java:103) - Loading process configurat
)\salesforce.com\Data Loader\process-conf.xml
2015-06-23 11:19:54,443 INFO  [main] support.AbstractApplicationContext prepareRefresh (AbstractApplicationContext.java:495) -
ort.FileSystemXmlApplicationContext@13bd574: startup date [Tue Jun 23 11:19:54 PDT 2015]; root of context hierarchy
2015-06-23 11:19:54,474 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinitions (XmlBeanDefinitionReader.java:315) - Loadi
/Program Files (x86)/salesforce.com/Data Loader/process-conf.xml]
2015-06-23 11:19:59,029 ERROR [main] process.ProcessConfig getProcessInstance (ProcessConfig.java:96) - Error loading process:
\Program Files (x86)\salesforce.com\Data Loader\process-conf.xml
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from URL [file://C:/Program Fi
s-conf.xml]; nested exception is java.net.UnknownHostException: C
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.
        at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableAppl
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.jav
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
        at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:140)
        at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:84)
        at com.salesforce.dataloader.process.ProcessConfig.getBeanFactory(ProcessConfig.java:105)
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(ProcessConfig.java:93)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRunner.java:287)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRunner.java:273)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:246)
Caused by: java.net.UnknownHostException: C
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at sun.net.NetworkClient.doConnect(Unknown Source)
        at sun.net.NetworkClient.openServer(Unknown Source)
        at sun.net.ftp.FtpClient.openServer(Unknown Source)
        at sun.net.ftp.FtpClient.openServer(Unknown Source)
        at sun.net.www.protocol.ftp.FtpURLConnection.connect(Unknown Source)
        at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(Unknown Source)
        at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:125)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
        ... 17 more
2015-06-23 11:19:59,045 FATAL [main] process.ProcessRunner topLevelError (ProcessRunner.java:238) - Failed to create process
com.salesforce.dataloader.exception.ProcessInitializationException: Error loading process: tempCont configuration from config f
Data Loader\process-conf.xml
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(ProcessConfig.java:97)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRunner.java:287)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRunner.java:273)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:246)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from URL [file://C:
ader/process-conf.xml]; nested exception is java.net.UnknownHostException: C
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRea
        at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.
        at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableAppl
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.jav
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
        at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:140)
        at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:84)
        at com.salesforce.dataloader.process.ProcessConfig.getBeanFactory(ProcessConfig.java:105)
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(ProcessConfig.java:93)
        ... 3 more
Caused by: java.net.UnknownHostException: C
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at sun.net.NetworkClient.doConnect(Unknown Source)
        at sun.net.NetworkClient.openServer(Unknown Source)
        at sun.net.ftp.FtpClient.openServer(Unknown Source)
        at sun.net.ftp.FtpClient.openServer(Unknown Source)
        at sun.net.www.protocol.ftp.FtpURLConnection.connect(Unknown Source)
        at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(Unknown Source)
        at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:125)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
        ... 17 more

The error is java.net.UnknownHostException: C

Here is the relevent bean in the process-conf.xml file:
 

        Test upsert
        
        
            
        
    

The reason that I think there is a bug in DL 34 is because I also have DL 30.0.0 installed on my machine and when I change this line in the process.bat file:
 
..\Java\bin\java.exe -cp ..\dataloader-34.0-uber.jar -Dsalesforce.config.dir=%1  com.salesforce.dataloader.process.ProcessRunner %PROCESS_OPTION%

to this:
 
..\Java\bin\java.exe -cp ..\dataloader-30.0.0-uber.jar -Dsalesforce.config.dir=%1  com.salesforce.dataloader.process.ProcessRunner %PROCESS_OPTION%

and keep everything else the same, I don't get the  java.net.UnknownHostException: C  error.  

Can anyone shed any light onto this?

Thanks
Hi There,

I am looking to make a minor change to an apex class in production? What is the best and secure way of making this change? (ie: change it in sandbox, and push the change set through to production? OR make the change in Eclipse and update the changes to the server?)

Also, if you could point me a resource which shows you how to update the code from eclipse to our production environment, it would be much appreciated. Thanks!
I have a controller that I built based off this article:

http://www.soliantconsulting.com/blog/2012/08/view-triggers-salesforce-trigger-opportunity-contact-roles

However the issues is after I add a contact role and return to the opportunity page, the fields are not updated. It only updates when I do a manual page refresh.

Here is my controller:
 
public without sharing class OppHelper {
    public Opportunity opp;
    public OppHelper( ApexPages.StandardController stdController ) {
        opp = ( Opportunity )stdController.getRecord();        
    }
    public void insertOppContacts(){
        OppHelper.insertOppContactsFuture( opp.Id );    
    }
    @future public static void insertOppContactsFuture( Id oppId ) {
        Contact[] contactList = [ SELECT Id, FirstName, LastName, Email FROM Contact
                             WHERE Id IN ( SELECT ContactId FROM OpportunityContactRole
                                         WHERE OpportunityId = :oppId AND isPrimary = True ) ];
        Opportunity opp = [ SELECT Id, Primary_Contact__c FROM Opportunity WHERE Id = :oppId ];
        
        for( Contact contact : contactList ) {
            opp.Primary_Contact__c = contact.Id;
        }
        update opp;
    }
}



Here is my visualforce page:
 
<apex:page standardController="Opportunity" extensions="OppHelper" action="{!insertOppContacts}" />

 
I am seeing an issue with Activities History since my client's org got upgraded to Winter 15 over this last weekend.  Look at the sample VF page below:
<apex:page standardcontroller="Account">
	<apex:pageBlock title="Testing Activities History" >
	 	<apex:pageBlockSection title="Activities History in pageBlockTable use to work before Winter 15">
			<apex:pageBlockTable value="{!account.ActivityHistories}" var="x">
				<apex:column value="{!x.Account.Name}"/>
				<apex:column value="{!x.subject}"/>	
				<apex:column value="{!x.status}"/>
				<apex:column value="{!x.owner.name}"/>
			</apex:pageBlockTable>
		</apex:pageBlockSection>
	 	<apex:pageBlockSection title="Activities History using relatedList tag">
			<apex:relatedList list="ActivityHistories" pageSize="10"/>
		</apex:pageBlockSection>
	</apex:pageBlock>
	
	<apex:pageBlock title="Testing Open Activities" >
		<apex:pageBlockSection title="Open Activities in pageBlockTable still works after Winter 15">
			<apex:pageBlockTable value="{!account.OpenActivities}" var="x">
				<apex:column value="{!x.Account.Name}"/>
				<apex:column value="{!x.subject}"/>	
				<apex:column value="{!x.status}"/>
				<apex:column value="{!x.owner.name}"/>
			</apex:pageBlockTable>
		</apex:pageBlockSection>
		<apex:pageBlockSection title="Open Activities using relatedList tag">
			<apex:relatedList list="OpenActivities" pageSize="10"/>
		</apex:pageBlockSection>
	</apex:pageBlock>
</apex:page>
There have always been restrictions on how you look up Activities History and Open Activities for non Admin users, but the two pageBlockTables worked for non Admin users before the Winter 15 upgrade.  After the upgrade, only the Open Activities pageBloackTable works for non Admin users.  The ActivityHistories pageBlockTable for a non Admin user will now return the error message:

Object type not accessible. Please check permissions and make sure the object is not in development mode: There is an implementation restriction on ActivityHistories. When you query this relationship, security evaluation is implemented for users who don't have administrator permissions, and you must use a specific sort order: ActivityDate DESC, LastModifiedDate DESC 

Since the pageBlockTable is just using the standard relationship lookup in this case, there is no opportunity to add the sort order to the query.  

I read through the Winter 15 release notes and cannot find anything about a change that might effect this.

Anyone else seeing this?

Salesforce, is this a bug?  

I need a resolution to this since my clients cannot use some functionality since this weekend due to this issue.  

Thanks
Hello,

I am building a "Site" for guest users to submit a Case for support.  I have the site built, the visualforce page, and a controller extension built to add an attchment.  When the case is submitted form the site, it creates a Case record in Salesforce, the attachment shows under the notes and attachments related list, but the subject and description fields that were filled out on the Site are not being populated on the case record.  

I am at a loss here as to why they are not working, and I am a new developer so I very well could have missed something very easy.  Please look over the following code for my VF Page, and the controller extension, and if available please help me figure out how to get the subject and description fields to populate on the case record with the information that was submitted via the site submission.  

Thank you in advance for your time and help!

VF Page

<apex:page standardcontroller="Case" extensions="caseattachment"
showHeader="false">
<img src="{!$resource.AVISPL_Logo2}"></img><b/><b/>
    <apex:form >
    <apex:pageBlock >
<apex:pageBlockSection title="Hello, Thank You For Reporting Your Incident!  A Salesforce Platform Engineer Will Be In Touch Shortly. " columns="1" showHeader="True" collapsible="False">
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageMessages />

        <apex:pageBlock >
        <apex:inputField value="{!Case.CaseNumber}"/>
            <apex:pageBlockSection title="Subject">
                <apex:inputText value="{!Case.subject}" />
            </apex:pageBlockSection>

            <apex:pageBlockSection title="Attachment Or ScreenShot">                                   
            <apex:inputFile id="fileToUpload" value="{!fileBody}" filename="{!fileName}" styleClass="input-file"/>                            
            
            </apex:pageBlockSection>

            <apex:pageBlockSection title="Tell Us About The Incident">
                <apex:inputTextarea value="{!Case.Description}" rows="8" cols="80" />
            </apex:pageBlockSection>

            <apex:commandButton value="Submit Incident" action="{!Save}" />
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller extension

public class caseattachment
{
public case objcase{get;set;}
public Attachment myAttachment{get;set;}
public string fileName{get;set;} 
public Blob fileBody{get;set;}

    public caseattachment(Apexpages.standardcontroller controller)
    {
        objcase = new case();
        myAttachment =new Attachment();
    }
    public pagereference save()
    {
        insert objcase;
        System.debug('@@@@@fileBody'+fileBody);     
        myAttachment  = new Attachment();
              Integer i=0;
              myAttachment .clear();
              myAttachment.Body = fileBody;
              myAttachment.Name = this.fileName; 
              myAttachment.ParentId = objcase.id;             
              insert myAttachment;                 
        pagereference pr = new pagereference('/'+objcase.id);                           
        return pr;
    }
}
I have a trigger that fires on Insert/Update.  Works fine when testing this by entering contacts or updating contacts manually one at a time.
However, when there is a batch update it seems to ignore this one  IF condition in my code.

Anyone ever experience this?
  • October 22, 2014
  • Like
  • 0
I think I have done all I can to "bulkify" this trigger but if I update 200 opportunities at once then I get the error about too many SOQL queries. I can't see anything more I need to do for this trigger. What else is there to do?

trigger Update_Sam_Marketing_Customer_Field on Opportunity (after insert, after update, after delete) {

try{
    //the trigger will update the account's SAM Marketing Customer field
    if (! trigger.isDelete) {
    
  List<Id> oppIds = new List<Id>() ;
  List<Id> AccountIds = new List<Id>() ;
  List<Account> AcctToUpdate = new List<Account>() ;
     
      for (opportunity op : trigger.New){
        oppIds.add(op.Id);
        AccountIds.add(op.AccountId);
        
  Map<Id,Opportunity> oppMap = new Map<Id,Opportunity>([Select id, StageName from Opportunity where id in :oppIds and
   name = 'Security Audit Manager'and Status__c != 'Inactive']) ;   
    
  Map<Id,Account> acctMap = new Map<Id,Account>([select id, SAM_Marketing_Customer__c, name, Closed_Won_Opps__c, Type 
   from Account where id in :AccountIDs]);
  
        //Find the account for this opportunity which is being updated
        Account oAccount =  acctMap.get(op.AccountId);
        Opportunity SamOpportunity = oppMap.get(op.Id);

         if (oppMap.isEmpty()){  //No SAM opportunities
    if (oAccount.Closed_Won_Opps__c == 0 && SamOpportunity.StageName != 'Closed Won') {
     oAccount.SAM_Marketing_Customer__c = 5;
    }
    else {
     oAccount.SAM_Marketing_Customer__c = 4;
    }
    AcctToUpdate.add(oAccount);
         }
         else { //There are SAM opportunities so see how many of them are closed/won
          Integer iCountClosedWon = 0;
          
      for(Opportunity samMap: oppMap.values()){       
     if (samMap.StageName == 'Closed Won') {
      iCountClosedWon += 1;
     }      
      }   
          
          if (iCountClosedWon > 0) {
     oAccount.SAM_Marketing_Customer__c = 1;
          }
          else {
           if (oAccount.Closed_Won_Opps__c == 0){
            oAccount.SAM_Marketing_Customer__c = 3;
      //update oAccount;  
           }
           else {
             oAccount.SAM_Marketing_Customer__c = 2;
           }
           
          }
          AcctToUpdate.add(oAccount);
         }
       }
       update AcctToUpdate;
   }
 
 if (trigger.isDelete) {
    
  List<Id> oppIds = new List<Id>() ;
  List<Id> AccountIds = new List<Id>() ;
  List<Account> AcctToUpdate = new List<Account>() ;
    
     for (opportunity op : trigger.Old){
        oppIds.add(op.Id);
        AccountIds.add(op.AccountId);
        
  Map<Id,Opportunity> oppMap = new Map<Id,Opportunity>([Select id, StageName from Opportunity where id in :oppIds and
   name = 'Security Audit Manager'and Status__c != 'Inactive']) ;   
    
  Map<Id,Account> acctMap = new Map<Id,Account>([select id, SAM_Marketing_Customer__c, name, Closed_Won_Opps__c, Type 
   from Account where id in :AccountIDs]);
  
        //Find the account for this opportunity which is being updated
        Account oAccount =  acctMap.get(op.AccountId);
        Opportunity SamOpportunity = oppMap.get(op.Id);

         if (oppMap.isEmpty()){  //No SAM opportunities
    if (oAccount.Closed_Won_Opps__c == 0 && SamOpportunity.StageName != 'Closed Won') {
     oAccount.SAM_Marketing_Customer__c = 5;
    }
    else {
     oAccount.SAM_Marketing_Customer__c = 4;
    }
    AcctToUpdate.add(oAccount);
         }
         else { //There are SAM opportunities so see how many of them are closed/won
          Integer iCountClosedWon = 0;
          
      for(Opportunity samMap: oppMap.values()){       
     if (samMap.StageName == 'Closed Won') {
      iCountClosedWon += 1;
     }      
      }   
          
          if (iCountClosedWon > 0) {
     oAccount.SAM_Marketing_Customer__c = 1;
          }
          else {
           if (oAccount.Closed_Won_Opps__c == 0){
            oAccount.SAM_Marketing_Customer__c = 3;
      //update oAccount;  
           }
           else {
             oAccount.SAM_Marketing_Customer__c = 2;
           }
          }
          AcctToUpdate.add(oAccount);
         }
     }
     update AcctToUpdate;    
   }
}
catch (Exception e ){
            System.debug('Create customer field trigger exception ' + e.getMessage());
            
      }
 }