• AAlex11
  • NEWBIE
  • 30 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 6
    Replies
Hi everyone,
I've got some issues using data loader from the command line.
I follow all steps described in the data loader guide and the procedure works fine!
Now I 'd like to set up the config.properties file to avoid inserting every time the infos of endpoint, password and username.
I 've created the properties file in this way 
#Loader Config
#Thu Sep 10 09:37:47 PDT 2009
sfdc.endpoint=https://login.salesforce.com
sfdc.username=xxx@yyyy.it.dev
process.encryptionKeyFile=C:\Program Files (x86)\salesforce.com\data loader\bin\password.txt
sfdc.password=7c70f134b4e7542523a22faf15569753671ea416756a75db
but when I throw the process in command line I receive  the following error
2016-10-14 17:25:39,951 INFO  [main] controller.Controller initLog (Controller.java:389) - Using built-in logging configuration, no log-conf.xml in C:\Program Files (x86)\salesforce.com\Data Loader\bin\log-conf.xml
2016-10-14 17:25:39,967 INFO  [main] controller.Controller initLog (Controller.java:391) - The log has been initialized
2016-10-14 17:25:39,967 INFO  [main] process.ProcessConfig getBeanFactory (ProcessConfig.java:104) - Loading process configuration from config file: C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf\process-conf.xml
2016-10-14 17:25:40,139 INFO  [main] support.AbstractApplicationContext prepareRefresh (AbstractApplicationContext.java:495) - Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@a30797: startup date [Fri Oct 14 17:25:40 CEST 2016]; root of context hierarchy
2016-10-14 17:25:40,233 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinitions (XmlBeanDefinitionReader.java:315) - Loading XML bean definitions from file [C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf\process-conf.xml]
2016-10-14 17:25:40,311 INFO  [main] support.DefaultListableBeanFactory preInstantiateSingletons (DefaultListableBeanFactory.java:557) - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6e2eef: defining beans [ANTAW01F_Upsert]; root of factory hierarchy
2016-10-14 17:25:40,451 INFO  [ANTAW01F_Upsert] controller.Controller initConfig (Controller.java:327) - config dir created at C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf
2016-10-14 17:25:40,467 ERROR [ANTAW01F_Upsert] config.Config initEncryption (Config.java:756) - Error initializing encryption for key file C:Program Files (x86)salesforce.comdata loaderbinpassword.txt: Cannot Access Key File: C:Program Files (x86)salesforce.comdata loaderbinpassword.txt
2016-10-14 17:25:40,467 FATAL [ANTAW01F_Upsert] process.ProcessRunner topLevelError (ProcessRunner.java:238) - Unable to run process ANTAW01F_Upsert
java.lang.RuntimeException: com.salesforce.dataloader.exception.ControllerInitializationException: Error loading config file: C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf\config.properties.  Please make sure that it exists and is readable
	at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:112)
	at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
	at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
Caused by: com.salesforce.dataloader.exception.ControllerInitializationException: Error loading config file: C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf\config.properties.  Please make sure that it exists and is readable
	at com.salesforce.dataloader.controller.Controller.initConfig(Controller.java:360)
	at com.salesforce.dataloader.controller.Controller.<init>(Controller.java:110)
	at com.salesforce.dataloader.controller.Controller.getInstance(Controller.java:212)
	at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:110)
	... 2 more
I 've put the config.properties file in samples folder ( in data loader directory) and I checked many times it exists and it's readable!
Like I said before storing this information in process-conf.xml (without using config.properties file) the procedure works perfectly, so I'm asking where Am I wrong??
Any ideas?
Thanks in advace.
Alex

 
Hi Guys!I wrote this custom controller to create a custom button new for my custom object Family__c that has two lookup relations one on account and an other on opportunity.
I need to rebuild in my controller this url
/a04/e?CF00N4E000000MBgM={!Opportunity.Name}&CF00N4E000000MBgM_lkid={!Opportunity.Id}
&CF00N4E000000MBfn={!Account.Name}&CF00N4E000000MBfn_lkid={!Account.Id}&retURL=%2F{!Opportunity.Id}  in order to have the new Family__c record page with lookup fields automatically filled.
This is my controller
public without sharing class Guest_Stud_BottonCtrl {</span>
  public Family__c hfs { get; set; } 
  public Opportunity opp{ get; set; }
  public String opp1{ get; set; }
  public String retURL {get; set;}
  public String saveNewURL {get; set;}

  public String opps {get; set;}
  public String cancelURL {get; set;}
  public String ent {get; set;}
  public String confirmationToken {get; set;}



  public Guest_Stud_BottonCtrl (ApexPages.StandardSetController controller) {
   hfs = (Family__c)controller.getRecord();
   
  // Id Opportunity_Id = [SELECT Id FROM opportunity WHERE AccountId=:Account_Id  LIMIT 1].id;
  Id Opportunity_Id=ApexPages.CurrentPage().getParameters().get('opp.id');
   Id Account_Id = ApexPages.CurrentPage().getParameters().get('acc.id');
   retURL = ApexPages.currentPage().getParameters().get('retURL');

       opps=[SELECT Id FROM opportunity WHERE AccountId=:Account_Id  LIMIT 1].id;
  
       
  
        cancelURL = ApexPages.currentPage().getParameters().get('cancelURL');

        ent = ApexPages.currentPage().getParameters().get('ent');
 
        confirmationToken = ApexPages.currentPage().getParameters().get('_CONFIRMATIONTOKEN');

        saveNewURL = ApexPages.currentPage().getParameters().get('save_new_url');
     }

    
    
public PageReference urlredirect() {

  PageReference newPage;

  PageReference returnURL;

            returnURL = new PageReference('/a04/e');

            returnURL.getParameters().put('retURL', retURL);

            returnURL.getParameters().put('opp.id', opps);

            returnURL.getParameters().put('cancelURL', cancelURL);

            returnURL.getParameters().put('ent', ent);

            returnURL.getParameters().put('_CONFIRMATIONTOKEN', confirmationToken);

            returnURL.getParameters().put('save_new_url', saveNewURL);

            returnURL.getParameters().put('nooverride', '1');

            returnURL.setRedirect(true);

            return returnURL;
             }

  }

the problem is that when I launch the button the page redirect on standard  page new family__c record and doesn't fill the lookup field automatically as I want.
Where am I wrong?
Anyone could help me please?
Thanks
Hi,
I wrote a controller extension with a class which read txt file from static resource inside.
The class in my controller is like this:
public String textFromSomeUniqueName {

    get {
        StaticResource sr = [
                select Body
                from StaticResource
                where Name = 'SomeUniqueName'
                ];
        return sr.Body.toString();
    }
}
Now I have to write test class for my controller extension but I don't know how testing this particular part.
I tried to test the class, as usual, creating test data for static resource but I've realize that DML operations aren't allowed on StaticResource object.
Anyone could help me?
Thanks
 
Hi, 
I'm developing a visualforce page with two columns layout.
The VFpage works fine but when I try to render my page as pdf CSS style is ignored.
this is my code:
<apex:page >
<center> <b> My title </b> </center>
<br> </br>

       <head>
<style type="text/css">
.newspaper {
    -webkit-column-count: 2;
    -moz-column-count: 2;
    column-count: 2;

    -webkit-column-gap: 40px;
    -moz-column-gap: 40px;
    column-gap: 40px;

    
}
</style>
</head>
<span>


<div class="newspaper">

My content

</div>
</apex:page>

Why is ignored CSS style?
Anyone could help me?
Thanks
Hi,
I'm creating a VF Page with a two columns table.
In the two columns I have to insert for each row a .txt file loaded from static resource.
That's my problem:
When I loaded the txt file in Visulaforce page with this line of code:
​<tr><b>{!$Resource.Cond1}</b></tr>

where Cond1  is the name of the txt file I loaded in static resources

My output in the page is
/resource/1469117262000/Cond1
instead of the actual content of txt Cond1 file.
Where am I wrong?
There's a special visualforce tag to use?
Please help me to solve this issue.


 
Hi everyone,
I write a trigger on opportunity (before insert, after insert, before update, after update) now I  need to test it.
I put trigger logic in a trigger Handler Class.
My trigger has to populate a date field ContractDate , with today's date, on the object Procedure__c releted to Opportunity with a lookup relationship where the record type of Procedure__C has a certain value  and when School__c field ( on opportunity object) is populated.
.that's the handler class
public class OpportunityTriggerHandler {

public static void date_program() {

list<Opportunity> OppList = new list<Opportunity>();

RecordType rtype= [SELECT id, Name FROM RecordType WHERE sObjectType= 'Procedure__c' and name='Client'  limit 1];

List<Procedure__c> listtoupdate= [SELECT ContractDate__c FROM Procedure__c WHERE recordTypeId= :rtype.id] ;

for (Opportunity op: (List<Opportunity>)Trigger.new) {
    for (Procedure__c proc : listtoupdate){
if(op.School__c !=NULL) {


proc.Contractdate__c= date.today();


}
        else{
            proc.ContractDate__c= null;
            }
          
            

update listtoupdate;
  
}}

}
}

That's the test class
@isTest
private class AddOppTriggerTest
{
    static testMethod void testOpportunityTriggerHandler() {

    
    
    
    Opportunity o= new Opportunity(name='tester', Numero_di_Rate__c= '2', CloseDate=date.ValueOf('2016-09-21'), StageName='QUESTIONARIO');
    insert o;
  RecordType rtid= [SELECT id, Name FROM RecordType WHERE sObjectType= 'Procedure__c' and name='Client'  limit 1];
    Opportunity opp=[SELECT id from Opportunity limit 1];
 

    Procedure__c pr = new Procedure__c (Opportunita__c=opp.id, recordtypeid=rtid.id );  
     system.debug(pr.ContractDate__c);
    insert pr;
       
    if (o.School--c!=NULL  )
    {
        pr.Contractdate__c= date.today() ;  
    }
        o=[Select  school__c from Opportunity];
    pr = [Select ContractDate__c from Procedure__c];

        
    system.debug(o.School__c);   
    system.assertEquals(false,o.School__c !=null); 
        
    system.debug(pr.Contractdate__c==date.today()  );
    system.assertEquals(false, pr.ContractDate__c == date.today());
               
               
              
}
}
Trigger works fine and also the test passes but I can't achieve the code coverage necessary.
The problem is There's no coverage for the if statement.
Any suggestion? where am I wrong?
 
Hi, I've recently written a basic controller extension for a visualforce page, and of course now  I need to test it. 
Problem is I can't reach the necessary code coverage.
I need some help to solve this issue.
That's my controller code :
 
public with sharing class Contact_survey_CX {
     private final Contact ctc;
     private final Contact ctc2;
    
    public Contact_survey_CX(ApexPages.StandardController stdController) {
        this.ctc = (Contact)stdController.getRecord();
        this.ctc2= (Contact)stdController.getRecord(); 
    }
    
    public List<Survey_Question__c> results {
        get {
            if (results == null) {
                results = new List<Survey_Question__c>([SELECT Name, ordernumber__c, question__c
                  FROM Survey_Question__c  WHERE Survey__r.name='Psico-Motivazionale'ORDER BY Survey_Question__c.ordernumber__c ASC]);
                   }           
            return results;
        } 
        private set;
    }
public List<SurveyQuestionResponse__c> results4 {
        get {
           if (results4 == null) {
                results4 = new List<SurveyQuestionResponse__c>([SELECT name,response__c FROM SurveyQuestionResponse__c where Survay__c='Psico-Motivazionale' AND SurveyTaker__r.Contact__r.Id= :ctc2.Id order by Name ,  LastModifiedDate ]);
             }           
            return results4;
        } 
        private set;
        
     }  }
 

 
that's the test class for the controller
@isTest
public class Contact_survey_CXTest{

 static testMethod void testTableSurveyPage() {
 //data for the  test
 Contact ct= new Contact( LastName='test1');
 insert ct;
 Survey__c s2= new Survey__c(name='test1', Submit_response__c='test1');
 insert s2;
 Survey__c s1=[SELECT Id FROM Survey__c  limit 1];
 Survey_Question__c sq1= new Survey_Question__c(Name='question_test_1', survey__c=s1.id, 
 ordernumber__c=4000, type__c='nessuno', question__c='text_quest_1');
 insert sq1;
 
 Survey_Question__c sq2=[SELECT Id FROM Survey_Question__c  limit 1];
SurveyTaker__c st2= new SurveyTaker__c(taken__c='text1');
insert st2;
 SurveyTaker__c st1= [SELECT Id FROM SurveyTaker__c   limit 1];
 
 SurveyQuestionResponse__c sr1= new SurveyQuestionResponse__c(Survey_Question__c= sq2.id, SurveyTaker__c=st1.id);
 insert sr1;
 
 // create a new Contact standard controller by passing it the account record
    ApexPages.StandardController controller = new ApexPages.StandardController(ct);

    // now pass it to the extension
   Contact_survey_CX stdController = new Contact_survey_CX(controller);
 ApexPages.currentPage().getParameters().put('id',st1.id );
    system.assert(stdController != null); // controller has successfully been created
   

        
 }
}
This test class pass but unfortunately works just for the first 7 rows.
It would be great if someone could help me write the correct test class for this controller.

 
Hi everyone,
I've got some issues using data loader from the command line.
I follow all steps described in the data loader guide and the procedure works fine!
Now I 'd like to set up the config.properties file to avoid inserting every time the infos of endpoint, password and username.
I 've created the properties file in this way 
#Loader Config
#Thu Sep 10 09:37:47 PDT 2009
sfdc.endpoint=https://login.salesforce.com
sfdc.username=xxx@yyyy.it.dev
process.encryptionKeyFile=C:\Program Files (x86)\salesforce.com\data loader\bin\password.txt
sfdc.password=7c70f134b4e7542523a22faf15569753671ea416756a75db
but when I throw the process in command line I receive  the following error
2016-10-14 17:25:39,951 INFO  [main] controller.Controller initLog (Controller.java:389) - Using built-in logging configuration, no log-conf.xml in C:\Program Files (x86)\salesforce.com\Data Loader\bin\log-conf.xml
2016-10-14 17:25:39,967 INFO  [main] controller.Controller initLog (Controller.java:391) - The log has been initialized
2016-10-14 17:25:39,967 INFO  [main] process.ProcessConfig getBeanFactory (ProcessConfig.java:104) - Loading process configuration from config file: C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf\process-conf.xml
2016-10-14 17:25:40,139 INFO  [main] support.AbstractApplicationContext prepareRefresh (AbstractApplicationContext.java:495) - Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@a30797: startup date [Fri Oct 14 17:25:40 CEST 2016]; root of context hierarchy
2016-10-14 17:25:40,233 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinitions (XmlBeanDefinitionReader.java:315) - Loading XML bean definitions from file [C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf\process-conf.xml]
2016-10-14 17:25:40,311 INFO  [main] support.DefaultListableBeanFactory preInstantiateSingletons (DefaultListableBeanFactory.java:557) - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6e2eef: defining beans [ANTAW01F_Upsert]; root of factory hierarchy
2016-10-14 17:25:40,451 INFO  [ANTAW01F_Upsert] controller.Controller initConfig (Controller.java:327) - config dir created at C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf
2016-10-14 17:25:40,467 ERROR [ANTAW01F_Upsert] config.Config initEncryption (Config.java:756) - Error initializing encryption for key file C:Program Files (x86)salesforce.comdata loaderbinpassword.txt: Cannot Access Key File: C:Program Files (x86)salesforce.comdata loaderbinpassword.txt
2016-10-14 17:25:40,467 FATAL [ANTAW01F_Upsert] process.ProcessRunner topLevelError (ProcessRunner.java:238) - Unable to run process ANTAW01F_Upsert
java.lang.RuntimeException: com.salesforce.dataloader.exception.ControllerInitializationException: Error loading config file: C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf\config.properties.  Please make sure that it exists and is readable
	at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:112)
	at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
	at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
Caused by: com.salesforce.dataloader.exception.ControllerInitializationException: Error loading config file: C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf\config.properties.  Please make sure that it exists and is readable
	at com.salesforce.dataloader.controller.Controller.initConfig(Controller.java:360)
	at com.salesforce.dataloader.controller.Controller.<init>(Controller.java:110)
	at com.salesforce.dataloader.controller.Controller.getInstance(Controller.java:212)
	at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:110)
	... 2 more
I 've put the config.properties file in samples folder ( in data loader directory) and I checked many times it exists and it's readable!
Like I said before storing this information in process-conf.xml (without using config.properties file) the procedure works perfectly, so I'm asking where Am I wrong??
Any ideas?
Thanks in advace.
Alex

 
Hi,
I wrote a controller extension with a class which read txt file from static resource inside.
The class in my controller is like this:
public String textFromSomeUniqueName {

    get {
        StaticResource sr = [
                select Body
                from StaticResource
                where Name = 'SomeUniqueName'
                ];
        return sr.Body.toString();
    }
}
Now I have to write test class for my controller extension but I don't know how testing this particular part.
I tried to test the class, as usual, creating test data for static resource but I've realize that DML operations aren't allowed on StaticResource object.
Anyone could help me?
Thanks
 
Hi, 
I'm developing a visualforce page with two columns layout.
The VFpage works fine but when I try to render my page as pdf CSS style is ignored.
this is my code:
<apex:page >
<center> <b> My title </b> </center>
<br> </br>

       <head>
<style type="text/css">
.newspaper {
    -webkit-column-count: 2;
    -moz-column-count: 2;
    column-count: 2;

    -webkit-column-gap: 40px;
    -moz-column-gap: 40px;
    column-gap: 40px;

    
}
</style>
</head>
<span>


<div class="newspaper">

My content

</div>
</apex:page>

Why is ignored CSS style?
Anyone could help me?
Thanks
Hi everyone,
I write a trigger on opportunity (before insert, after insert, before update, after update) now I  need to test it.
I put trigger logic in a trigger Handler Class.
My trigger has to populate a date field ContractDate , with today's date, on the object Procedure__c releted to Opportunity with a lookup relationship where the record type of Procedure__C has a certain value  and when School__c field ( on opportunity object) is populated.
.that's the handler class
public class OpportunityTriggerHandler {

public static void date_program() {

list<Opportunity> OppList = new list<Opportunity>();

RecordType rtype= [SELECT id, Name FROM RecordType WHERE sObjectType= 'Procedure__c' and name='Client'  limit 1];

List<Procedure__c> listtoupdate= [SELECT ContractDate__c FROM Procedure__c WHERE recordTypeId= :rtype.id] ;

for (Opportunity op: (List<Opportunity>)Trigger.new) {
    for (Procedure__c proc : listtoupdate){
if(op.School__c !=NULL) {


proc.Contractdate__c= date.today();


}
        else{
            proc.ContractDate__c= null;
            }
          
            

update listtoupdate;
  
}}

}
}

That's the test class
@isTest
private class AddOppTriggerTest
{
    static testMethod void testOpportunityTriggerHandler() {

    
    
    
    Opportunity o= new Opportunity(name='tester', Numero_di_Rate__c= '2', CloseDate=date.ValueOf('2016-09-21'), StageName='QUESTIONARIO');
    insert o;
  RecordType rtid= [SELECT id, Name FROM RecordType WHERE sObjectType= 'Procedure__c' and name='Client'  limit 1];
    Opportunity opp=[SELECT id from Opportunity limit 1];
 

    Procedure__c pr = new Procedure__c (Opportunita__c=opp.id, recordtypeid=rtid.id );  
     system.debug(pr.ContractDate__c);
    insert pr;
       
    if (o.School--c!=NULL  )
    {
        pr.Contractdate__c= date.today() ;  
    }
        o=[Select  school__c from Opportunity];
    pr = [Select ContractDate__c from Procedure__c];

        
    system.debug(o.School__c);   
    system.assertEquals(false,o.School__c !=null); 
        
    system.debug(pr.Contractdate__c==date.today()  );
    system.assertEquals(false, pr.ContractDate__c == date.today());
               
               
              
}
}
Trigger works fine and also the test passes but I can't achieve the code coverage necessary.
The problem is There's no coverage for the if statement.
Any suggestion? where am I wrong?
 
Hi, I've recently written a basic controller extension for a visualforce page, and of course now  I need to test it. 
Problem is I can't reach the necessary code coverage.
I need some help to solve this issue.
That's my controller code :
 
public with sharing class Contact_survey_CX {
     private final Contact ctc;
     private final Contact ctc2;
    
    public Contact_survey_CX(ApexPages.StandardController stdController) {
        this.ctc = (Contact)stdController.getRecord();
        this.ctc2= (Contact)stdController.getRecord(); 
    }
    
    public List<Survey_Question__c> results {
        get {
            if (results == null) {
                results = new List<Survey_Question__c>([SELECT Name, ordernumber__c, question__c
                  FROM Survey_Question__c  WHERE Survey__r.name='Psico-Motivazionale'ORDER BY Survey_Question__c.ordernumber__c ASC]);
                   }           
            return results;
        } 
        private set;
    }
public List<SurveyQuestionResponse__c> results4 {
        get {
           if (results4 == null) {
                results4 = new List<SurveyQuestionResponse__c>([SELECT name,response__c FROM SurveyQuestionResponse__c where Survay__c='Psico-Motivazionale' AND SurveyTaker__r.Contact__r.Id= :ctc2.Id order by Name ,  LastModifiedDate ]);
             }           
            return results4;
        } 
        private set;
        
     }  }
 

 
that's the test class for the controller
@isTest
public class Contact_survey_CXTest{

 static testMethod void testTableSurveyPage() {
 //data for the  test
 Contact ct= new Contact( LastName='test1');
 insert ct;
 Survey__c s2= new Survey__c(name='test1', Submit_response__c='test1');
 insert s2;
 Survey__c s1=[SELECT Id FROM Survey__c  limit 1];
 Survey_Question__c sq1= new Survey_Question__c(Name='question_test_1', survey__c=s1.id, 
 ordernumber__c=4000, type__c='nessuno', question__c='text_quest_1');
 insert sq1;
 
 Survey_Question__c sq2=[SELECT Id FROM Survey_Question__c  limit 1];
SurveyTaker__c st2= new SurveyTaker__c(taken__c='text1');
insert st2;
 SurveyTaker__c st1= [SELECT Id FROM SurveyTaker__c   limit 1];
 
 SurveyQuestionResponse__c sr1= new SurveyQuestionResponse__c(Survey_Question__c= sq2.id, SurveyTaker__c=st1.id);
 insert sr1;
 
 // create a new Contact standard controller by passing it the account record
    ApexPages.StandardController controller = new ApexPages.StandardController(ct);

    // now pass it to the extension
   Contact_survey_CX stdController = new Contact_survey_CX(controller);
 ApexPages.currentPage().getParameters().put('id',st1.id );
    system.assert(stdController != null); // controller has successfully been created
   

        
 }
}
This test class pass but unfortunately works just for the first 7 rows.
It would be great if someone could help me write the correct test class for this controller.