• Marcelo Junior
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

Hello.

 

Im new at Apex and im having this problem.

 

I need to get an list of an object populated with Apex Data Loader and now im trying to get some fields and save into another object.

 

Something like it

 

 

public void createClienteCustom(){	
		List<Carga_Inicial__c> cargaInicial = [Select c.uf__c, c.municipio__c,	
							c.dataCadastro__c, 
							c.cnpjCpf__c, 
							c.cliente__c, 
							c.campoLivre__c, 
						        c.campoLivreAlt__c 
							From Carga_Inicial__c c];
		
	
		Cliente__c cli = new Cliente__c();
		for(Carga_Inicial__c carga: cargaInicial){
				cli.cnpjCpf__c = carga.cnpjCpf__c,
				cli.cliente__c = carga.cliente__c,
				cli.campoLivre__c = carga.campoLivre__c,
				cli.campoLivreAlt__c = carga.campoLivreAlt__c,
				cli.dataCadastro__c = carga.dataCadastro__c,
				cli.municipio__c = carga.municipio__c,
				cli.uf__c = carga.uf__c
			
			insert cli;	
		}
	}

 

 

Im getting the following message
System.DmlException: Insert failed. First exception on row 0 with id a0AA0000002tPi0MAE; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]

 

 

What can i do to solve it?

 

Tks for all community

Hello! 

I'm new at development and Force.com and i have some questions to do.

 

I have an object called Person:

 

Can i upload a XML with information about a Person  and parse it for a new data?

Ex: XML -> Parse -> Popule a New Person Object -> Save it 

 

Another question is:

Can i have an Object List as "Field" inside my Custom Object?

As i see when i was doing the tutorial, i can do a Picklist field. But its not what i want because i need to define the values, and i want to populate it with some datas from XML. An String List for example.

 

Tks for all help!

And sorry about my english! Im studying a lot to write and speak better =)

 

 

 

 

 

Hello.

 

Im new at Apex and im having this problem.

 

I need to get an list of an object populated with Apex Data Loader and now im trying to get some fields and save into another object.

 

Something like it

 

 

public void createClienteCustom(){	
		List<Carga_Inicial__c> cargaInicial = [Select c.uf__c, c.municipio__c,	
							c.dataCadastro__c, 
							c.cnpjCpf__c, 
							c.cliente__c, 
							c.campoLivre__c, 
						        c.campoLivreAlt__c 
							From Carga_Inicial__c c];
		
	
		Cliente__c cli = new Cliente__c();
		for(Carga_Inicial__c carga: cargaInicial){
				cli.cnpjCpf__c = carga.cnpjCpf__c,
				cli.cliente__c = carga.cliente__c,
				cli.campoLivre__c = carga.campoLivre__c,
				cli.campoLivreAlt__c = carga.campoLivreAlt__c,
				cli.dataCadastro__c = carga.dataCadastro__c,
				cli.municipio__c = carga.municipio__c,
				cli.uf__c = carga.uf__c
			
			insert cli;	
		}
	}

 

 

Im getting the following message
System.DmlException: Insert failed. First exception on row 0 with id a0AA0000002tPi0MAE; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]

 

 

What can i do to solve it?

 

Tks for all community

Hello! 

I'm new at development and Force.com and i have some questions to do.

 

I have an object called Person:

 

Can i upload a XML with information about a Person  and parse it for a new data?

Ex: XML -> Parse -> Popule a New Person Object -> Save it 

 

Another question is:

Can i have an Object List as "Field" inside my Custom Object?

As i see when i was doing the tutorial, i can do a Picklist field. But its not what i want because i need to define the values, and i want to populate it with some datas from XML. An String List for example.

 

Tks for all help!

And sorry about my english! Im studying a lot to write and speak better =)