Skip to content

Support getting fields from nested / joined objects #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
acro-tanaka opened this issue Feb 14, 2017 · 2 comments
Open

Support getting fields from nested / joined objects #9

acro-tanaka opened this issue Feb 14, 2017 · 2 comments

Comments

@acro-tanaka
Copy link

Now we can get only one kind of SFDC_OBJECT using this plugin at one time.

private
def get_query()
query = ["SELECT",@sfdc_fields.join(','),
"FROM",@sfdc_object_name]
query << ["WHERE",@sfdc_filters] unless @sfdc_filters.empty?
query << "ORDER BY LastModifiedDate DESC" if @sfdc_fields.include?('LastModifiedDate')
query_str = query.flatten.join(" ")
@logger.debug? && @logger.debug("SFDC Query", :query => query_str)
return query_str
end

https://github.com/logstash-plugins/logstash-input-salesforce/blob/master/lib/logstash/inputs/salesforce.rb#L139

Dataloader (salesforce's tool) can get some data from some SFDC_OBJECT those data are joined and output.
Likewise, want to get several data from some SFDC_OBJECT at one time using salesforce plugin.

■FYR
SOQL query for extraction of Dataloader

"Select LastName, FirstName, Email, Phone, Owner.UserName, Owner.ID, Owner.Name From Lead"

@mkreth
Copy link
Contributor

mkreth commented Dec 1, 2021

This would be very useful - e.g. when reading the AsyncApexJob object, it has a field ApexClassId which is a relationship field referencing an ApexClass. The ApexClassId only gives us the technical Id of the class. To get to the name of the Apex class we need to navigate across the relationship and query the ApexClass.Name field. From the AsyncApexJob object this would mean a cross-object join in the projection: SELECT Id, ApexClass.Name FROM AsyncApexJob.

I tested that this is already supported by the Restforce query method. Only the setup of the query and processing of the query results in the logstash-input-salesforce plugin needs to be updated.

@fransflippo
Copy link
Collaborator

#32 implements this. I'll enhance the PR with some unit tests showing the usage of the feature and then include it in the next release of the plugin, 3.4.0.

@fransflippo fransflippo reopened this May 15, 2025
@fransflippo fransflippo changed the title Get several SFDC_OBJECT at one time. Support getting fields from nested / joined objects May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants