Skip to main content
Solved

Custom query Salesforce import

  • January 4, 2024
  • 2 replies
  • 369 views

Forum|alt.badge.img+5

Hi!

I would like to do an import of  a Salesforce report with 13000 lines.

To do so I need to use the custom query import mode.

The problem I have is that i need to use some fieds located in Opportunity table and other in Lead table.

I wrote :
Select Field A, Field B
From Lead , Opportunity

but it is not working.

 

Can you help me ?

Thanks

 

 

Best answer by Julien

Hi @Cedric LJ, when you say it is not working do you mean you get an error or the results aren’t the ones you expect?

You probably need to add a WHERE clause to specify how the data should be referenced between the 2 tables.

Check the Relationship Queries from SFDC’s documentation for some examples on how you can format your query: https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_understanding.htm

 

Maybe something like this would work?

SELECT Lead.FieldA, Opportunity.FieldB
FROM Lead, Opportunity
WHERE Lead.ConvertedAccountId = Opportunity.AccountId

 

2 replies

Forum|alt.badge.img+5
  • Author
  • Master Author
  • 22 replies
  • January 9, 2024

UP :) 


Julien
Employee
Forum|alt.badge.img+8
  • Employee
  • 47 replies
  • Answer
  • January 9, 2024

Hi @Cedric LJ, when you say it is not working do you mean you get an error or the results aren’t the ones you expect?

You probably need to add a WHERE clause to specify how the data should be referenced between the 2 tables.

Check the Relationship Queries from SFDC’s documentation for some examples on how you can format your query: https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_understanding.htm

 

Maybe something like this would work?

SELECT Lead.FieldA, Opportunity.FieldB
FROM Lead, Opportunity
WHERE Lead.ConvertedAccountId = Opportunity.AccountId