• Ray Dehler
  • NEWBIE
  • 30 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 11
    Replies

Hi,  I have two classes with a master-detail relationship. It's currently set up so that object2 points to object1 and can access properties like this:

 

obj2.obj1__r.property

 

Object 2 also has a status field.  When I set that field to say 'Done', I would like to change the master-detail relationship so that it points to a completely new object.  The purpose of this: I would basically like to archive object2 so it doesn't show up in a list when I look at the object1 Tab.

 

I'm not sure how to go about this.  I think I can just query for the ID of the appropriate object1 and do the following:

 

LIST<object1> object1IDs = [SELECT id FROM object1 WHERE name = 'Done'];

for (object 2 myvar: trigger.old)

myvar.obj1__c = ID;

 

But I know this is wrong, any hints?

 

Thanks!

~Weyland

Hello.  I am working in a single sandbox - and ideally would like to periodically make a copy of my entire sandbox environment.  Does anyone know if a backup utility (for free or purchase) exists?  I ideally would like to be able to periodically back up my VF pages, Controllers, Workflows, etc. - just so I could revert back to previous versions if needed.  I know I could purchase an additional sandbox license...but I was curious if a backup utility existed similar to the data backup that salesforce.com offers.

 

I was not sure if this is even available - so I thought I would ask.

 

Thanks

I am able to embed the VF page I want into a custom controller, but its behavior is very weird.

 

I have a series of currency values that I am putting in a panel grid. The VF Code looks like this:

 

<apex:page standardController="Object__c" extensions="RevenueBookController">
   <apex:CommandButton action="{!save}" value="Update Revenue Book" rerender="thePanel" /> 
  <apex:form >
        <apex:CommandButton
        <apex:outputPanel id="thePanel">
        <apex:panelGrid columns="6" id="theGrid" width="80%">
            <b>Revenue Types:</b> 
            <apex:outputText value="Month 1" id="Month1"/> 
            <apex:outputText value="Month 2" id="Month2"/>
            <apex:outputText value="Month 3" id="Month3"/>
            <apex:outputText value="Quarter" id="Quarter"/>
            <apex:outputText value="Total" id="Total"/>
            
            <apex:outputText value="Revenue: " id="Revenue"/>
            <apex:inputField value="{!Object__c.Revenue_Month1__c}"/> 
            <apex:inputField value="{!Object__c.Revenue_Month2__c}"/>
            <apex:inputField value="{!Object__c.Revenue_Month3__c}"/>
            <apex:inputField value="{!Object__c.Revenue_Quarter__c}"/>
            <apex:outputField value="{!Object__c.Revenue_Total__c}"/>
    
        </apex:panelGrid>
      </apex:outputPanel>
  </apex:form>
</apex:page>

 When I go to the page it looks right - the input fields show up in a grid as expected. However, when I add a value to one of the input fields and hit the update button, the entire page refreshes within the VF section.

What I want to happen is to just have the outputpanel refresh with updated numbers in the Total field.

 

Its probably something obvious, but its stumping me. Any suggestions and solutions appreciated.

Hi, can someone help me write the  test method for the following custom component. I couldnt find any link to custom component test methods in the force.com knowledgebase/community. Please help.

 

public with sharing class AutoComplete_Controller{

	//Constructors
	
    public AutoComplete_Controller() {}
    
    
    public AutoComplete_Controller(ApexPages.StandardController controller) {}

	//Attributes
	
	private List<String> resultsname = new List<String>();
	private Boolean hasparams = false;
	private Boolean hasnoresults = false;
    public String state = '';
        
    //Getters and Setters
    
 	public Boolean getHasparams(){
 		return hasparams;
 	}
 	
 	public void clearValues(){
 		hasparams = false;
 	}
 	
 	public Boolean getHasnoresults(){
 		return hasnoresults;	
 	}

	public void avoidRefresh(){
	}

 	/*public void setState(String sName) {
        state = sName;
        system.debug('sName  - ' + sName);
    }
            
    public String getState() {
        return state;
    }*/
   
    public PageReference searchSuggestions() {

		//Initalize variables, hasparams just indicates that a search has started
        resultsname.clear();   
        hasparams = true;
        hasnoresults = false;

		//Obtain current parameters
        String sobjectname = System.currentPageReference().getParameters().get('objectname');
        String stext = String.escapeSingleQuotes(System.currentPageReference().getParameters().get('aname').trim())+'%';
        String stateText = String.escapeSingleQuotes(System.currentPageReference().getParameters().get('statename').trim());
        
        system.debug('State Name  - ' + state);
        system.debug('stateText - ' + stateText);
        
        //Limit Suggestions to 10 Results
        Integer iLimit = 10;
        
     //Validate if there's an input and get results
     
     if(stext.length() > 2){

		try{
	        		
			  //String sql = 'select City__C from ' + sobjectname + ' where City__C like \''+stext+'\' and State__c = ' + stateText + '' limit '+ iLimit;
			  String sql = 'select City__C from ' + sobjectname + ' where City__C like \'' + stext + '\' and State__c = \''+ stateText+'\' GROUP BY City__C'; 
			  // limit ' + iLimit;
			  //lstAR = [];
			  system.debug('SQL Formed + ' + sql );
		         	// 
		         	for(sobject x : Database.query(sql)){
		        		
		        		String s  = String.escapeSingleQuotes(((String)(x.get('City__C'))));
		        		resultsname.add(s);	
		        	}
				
				
			
		}catch(Exception e){
			
			resultsname.add('Unexpected Error, please contact support- ');	
		}


     }
       return null;
  }
  
	  
	  
	 public List<String> getResultsname(){
	  	  //Make sure to clear past values
	      clearValues();
	      if(resultsname.isEmpty()){
			hasnoresults = true;
			resultsname.add('No Results');
	      }
	      return resultsname;
	  }
}

 thank you

 

  • June 29, 2011
  • Like
  • 0

Hi,  I have two classes with a master-detail relationship. It's currently set up so that object2 points to object1 and can access properties like this:

 

obj2.obj1__r.property

 

Object 2 also has a status field.  When I set that field to say 'Done', I would like to change the master-detail relationship so that it points to a completely new object.  The purpose of this: I would basically like to archive object2 so it doesn't show up in a list when I look at the object1 Tab.

 

I'm not sure how to go about this.  I think I can just query for the ID of the appropriate object1 and do the following:

 

LIST<object1> object1IDs = [SELECT id FROM object1 WHERE name = 'Done'];

for (object 2 myvar: trigger.old)

myvar.obj1__c = ID;

 

But I know this is wrong, any hints?

 

Thanks!

~Weyland

I am trying to create a case whenever the contract is activated and have the case link back to the contract. I've been perusing the forum for a few days and haven't posted this until I decided that I knew enough to even know i needed help.

 

the code i have is below.. the two comments in the middle are what i am trying to do.. and where it is erroring.

 

unfortunately.. there is no ContractId for a case like there is an AccountId for a case. that's where I got confused.

 

I've created two additional fields that i thought would help but i cannot populate them:

 

 Contract

Contract__c

Lookup(Contract)

 

Contract Number

Contract_Number__c

Lookup(Contract)

 

I can't pass the contract number by string or by reference:

 

string:

There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger ActivateContract caused an unexpected exception, contact your administrator: ActivateContract: execution of BeforeUpdate caused by: System.StringException: Invalid id: 2011061331: Trigger.ActivateContract: line 14, column 6"

 

reference:

There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger ActivateContract caused an unexpected exception, contact your administrator: ActivateContract: execution of BeforeUpdate caused by: System.DmlException: Upsert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Account ID: id value of incorrect type: 800T0000000XtfjIAC: [AccountId]: Trigger.ActivateContract: line 22, column 4". 

 

Code:

 

trigger ActivateContract on Contract (before update) {

 // Create a list of accounts to update
 List<Account> acctList = new List<Account>();

 for (Contract contract : Trigger.new) {

  // If the contract has been activated...
  if (contract.Status == 'Activated Signed') {
   if(contract.Major_Product_Line__c == 'Background (BSG)') {
 	 	Case c = new Case(AccountId = contract.Id);
  	 	//c.Contract_Number__c = contract.ContractNumber;
  //	 	c.Contract_Number__c = contract.Id;

	  upsert c;
   }
  }
  // update the database with the account status changes
  update acctList;
 }
}

 Any Ideas?

 

I have a workflow rule setup with the following criteria:

 

today() - Last_QCCP_Call__c >= 90

 

On this rule I have 4 time dependent workflow actions which are tasks.  The criteria for these to be added are:  90 Days After Last QCCP Call

 

My problem is if I enter a date that is >90 days the tasks are not being added to the account. 

 

If I add them as immediate workflow actions they are.  I need them as a time based so every 90 days they are added automatically.

 

Does anyone out there have any ideas for this novice?

  • June 29, 2011
  • Like
  • 0

In Debug log, I see most of the time....

System.Debug(ANY)

 

Please tell me that what is exactly means by ANY here...

I have a workflow rule setup to add 4 tasks under a Time Dependant Workflow Action of 90 Days After Last QCCP Call

 

This is the rule criteria:  today() - Last_QCCP_Call__c >= 90

 

When i go to test this: and put a date in the Last QCCP Call field, nothing happens.  The number of days does equal 90 or more.

 

What am i doing wrong? 

 

If I take out the time dependant and just use an immediate workflow action it works.  But i need this to be recurring.

 

 

  • June 28, 2011
  • Like
  • 0

 

I am a newbie, This is the command I m executing

 

c:\Program Files (x86)\salesforce.com\Apex Data Loader 22.0\bin>process.bat "C:\Program Files (x86)\salesforce.com\Apex Data Loader 22.0\conf" csvAccountExtractProcess

 

Not sure how to resolve this error and the error I m getting is 

 

2011-06-28 00:47:41,686 INFO  [main] controller.Controller initLog (Controller.java:367) - The log has been initialized2011-06-28 00:47:41,691 INFO  [main] process.ProcessConfig getBeanFactory (ProcessConfig.java:78) - Loading process configuration from config file: C:\Program Files (x86)\salesforce.com\Apex Data Loader 22.0\conf\process-conf.xml2011-06-28 00:47:41,735 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinitions (XmlBeanDefinitionReader.java:163) - Loading XML bean definitions from file [C:\Program Files (x86)\salesforce.com\Apex Data Loader 22.0\conf\process-conf.xml]2011-06-28 00:47:41,761 INFO  [main] core.CollectionFactory <clinit> (CollectionFactory.java:66) - JDK 1.4+ collections available2011-06-28 00:47:41,770 INFO  [main] core.CollectionFactory <clinit> (CollectionFactory.java:71) - Commons Collections 3.x available2011-06-28 00:47:41,825 INFO  [csvAccountExtract] controller.Controller initConfig (Controller.java:328) - The controller config has been initialized2011-06-28 00:47:41,829 INFO  [csvAccountExtract] process.ProcessRunner run (ProcessRunner.java:90) - Initializing process engine2011-06-28 00:47:41,830 INFO  [csvAccountExtract] process.ProcessRunner run (ProcessRunner.java:93) - Loading parameters2011-06-28 00:47:42,762 INFO  [csvAccountExtract] config.LastRun load (LastRun.java:101) - Last run info will be saved in file: C:\Program Files (x86)\salesforce.com\Apex Data Loader 22.0\conf\csvAccountExtract_lastRun.properties2011-06-28 00:47:42,774 INFO  [csvAccountExtract] process.ProcessRunner run (ProcessRunner.java:101) - Logging in to: https://login.salesforce.com2011-06-28 00:47:42,783 INFO  [csvAccountExtract] client.PartnerClient login (PartnerClient.java:448) - Beginning Partner Salesforce login ....2011-06-28 00:47:42,803 INFO  [csvAccountExtract] client.PartnerClient loginInternal (PartnerClient.java:488) - Salesforce login to https://login.salesforce.com/services/Soap/u/22.0 as user xxx@hotmail.com2011-06-28 00:47:43,530 INFO  [csvAccountExtract] dao.DataAccessObjectFactory getDaoInstance (DataAccessObjectFactory.java:51) - Instantiating data access object: C:\Program Files (x86)\salesforce.com\Apex Data Loader 22.0\OutputFiles\extract.csv of type: csvWrite2011-06-28 00:47:43,564 INFO  [csvAccountExtract] process.ProcessRunner run (ProcessRunner.java:106) - Checking the data access object connection2011-06-28 00:47:43,569 INFO  [csvAccountExtract] process.ProcessRunner run (ProcessRunner.java:111) - Setting field types2011-06-28 00:47:44,464 INFO  [csvAccountExtract] process.ProcessRunner run (ProcessRunner.java:115) - Setting object reference types2011-06-28 00:47:45,310 INFO  [csvAccountExtract] process.ProcessRunner run (ProcessRunner.java:119) - Creating Map2011-06-28 00:47:45,350 FATAL [main] process.ProcessRunner topLevelError (ProcessRunner.java:211) - Unable to run process csvAccountExtractjava.lang.RuntimeException: java.lang.IllegalArgumentException: Cannot parse empty string        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:136)        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:74)        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:226)Caused by: java.lang.IllegalArgumentException: Cannot parse empty string        at com.salesforce.dataloader.mapping.SOQLInfo.getTrimmed(SOQLInfo.java:162)        at com.salesforce.dataloader.mapping.SOQLInfo.access$000(SOQLInfo.java:38)        at com.salesforce.dataloader.mapping.SOQLInfo$SOQLFieldInfo.<init>(SOQLInfo.java:52)        at com.salesforce.dataloader.mapping.SOQLInfo$SOQLFieldInfo.<init>(SOQLInfo.java:72)        at com.salesforce.dataloader.mapping.SOQLMapper.putPropertyEntry(SOQLMapper.java:98)        at com.salesforce.dataloader.mapping.Mapper.putPropertyFileMappings(Mapper.java:129)        at com.salesforce.dataloader.mapping.Mapper.putPropertyFileMappings(Mapper.java:124)        at com.salesforce.dataloader.mapping.Mapper.<init>(Mapper.java:76)        at com.salesforce.dataloader.mapping.SOQLMapper.<init>(SOQLMapper.java:57)        at com.salesforce.dataloader.controller.Controller.createMapper(Controller.java:179)        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:120)        ... 2 more

 

Process-conf.xml is 

 

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans>    <bean id="csvAccountExtractProcess"          class="com.salesforce.dataloader.process.ProcessRunner"          singleton="false">      <description>csvAccountExtract job gets account info from salesforce and saves info into a CSV file."</description>        <property name="name" value="csvAccountExtract"/>        <property name="configOverrideMap">            <map>                <entry key="sfdc.debugMessages" value="false"/>                <entry key="sfdc.debugMessagesFile" value="c:\dataloader\samples\status\sfdcSoapTrace.log"/>                <entry key="sfdc.endpoint" value="https://login.salesforce.com"/>                <entry key="sfdc.username" value="xxx@abc.com"/>               <!-- password below has been encrypted using key file, therefore it will not work without the key setting: process.encryptionKeyFile                the password is not a valid encrypted value, please generate the real value using encrypt.bat utility -->                <entry key="sfdc.password" value="f9ffa659b6f79c1993e42d748778"/><entry key="process.encryptionKeyFile" value="C:\Program Files (x86)\salesforce.com\Apex Data Loader 22.0\conf\sforcekey.key"/>                <entry key="sfdc.timeoutSecs" value="600"/>                <entry key="sfdc.loadBatchSize" value="200"/>                <entry key="sfdc.entity" value="Account"/>                <entry key="sfdc.extractionRequestSize" value="500"/>                <entry key="sfdc.extractionSOQL" value="Select Id, Name, Type, ParentId, Phone, AccountNumber, Website, Sic, AnnualRevenue, NumberOfEmployees, TickerSymbol, Oracle_Id__c FROM Account"/>                <entry key="process.operation" value="extract"/>                <entry key="process.mappingFile" value="C:\Program Files (x86)\salesforce.com\Apex Data Loader 22.0\samples\conf\accountExtractMap.sdl"/>                <entry key="dataAccess.type" value="csvWrite"/>                <entry key="dataAccess.name" value="C:\Program Files (x86)\salesforce.com\Apex Data Loader 22.0\OutputFiles\extract.csv"/>            </map>        </property>    </bean></beans>

 

Any help will be greatly appreciated.

hai friends,

 

     I have list of contactfields,this list is chanfing dynamically based on user input.Based on the user input i am adding columns dynamically to Datatable,Now i want to add that rows to the datatable dynamically.Here Number of rows also user input.

 

Can you please help me in this scenario.

 

Thank you

Haribabu

Hey,

 

I am having this error, while trying to create a custom object via api in my C# salesforce applications. Plz help



Failed to execute query succesfully, error message was: MALFORMED_QUERY: Billed_Out_Invoices__c where Account__c=2500 Invoice_Amount__c=2500 ^ ERROR at Row:1:Column:107 unexpected token: 'Invoice_Amount__c'

 

I am not sure what's going wrong.

 

Here is how i am creating the object.

 

 Billed_out = new sforce.sObject();                   

System.Xml.XmlElement[] acct = new System.Xml.XmlElement[5];                   

System.Xml.XmlDocument doc = new System.Xml.XmlDocument();

 

acct[0] = doc.CreateElement("Account__c"); acct[0].InnerText = "12345";                   

acct[1] = doc.CreateElement("DA_Link__c"); acct[1].InnerText = "http://www.yahoo.com";                   

acct[2] = doc.CreateElement("Invoice_Amount__c"); acct[2].InnerText = "23.34";                   

acct[4] = doc.CreateElement("Name"); acct[4].InnerText = "Hello salesforce";                   

acct[3] = doc.CreateElement("Invoice_Date__c"); acct[3].InnerText = DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss-00:00");

Billed_out.type = "Billed_Out_Invoices__c";                   

Billed_out.Any = acct;