简体   繁体   中英

How to Query from salesforce the OpportunityFieldHistory with python

I am having an issue figuring out how to start a query on the OpportunityFieldHistory from Salesforce.

The code I usually use and works for querying Opportunty or Leads work fine, but I do not know how should be written for the FieldHistory.

When I want to query the opportunity or Lead I use the following:

oppty1 = sf.opportunity.get('00658000002vFo3')
lead1 = sf.lead.get('00658000002vFo3')

and then do the proper query code with the access codes...

The problem arises when I want to do the analysis on the OpportunityFieldHistory, I tried the following:

opptyhist = sf.opportunityfieldhistory.get('xxx')

Guess what, does not work. Do you have any clue on what should I write between sf. and .get?

Thanks in advance

Looking at the simple-salesforce API , it appears that the get method accepts an ID which you are passing correctly. However, a quick search in the Salesforce API reference seems to indicate that the OpportunityFieldHistory may need to be obtained by another function such as get_by_custom_id(self, custom_id_field, custom_id) .

  (OpportunityFieldHistory){ Id = None CreatedDate = 2012-08-27 12:00:03 Field = "StageName" NewValue = "3.0 - Presentation & Demo" OldValue = "2.0 - Qualification & Discovery" OpportunityId = "0067000000RFCDkAAP" }, 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM