Skip to content

get_opportunity_forecasts() generator not working, ValueError #34

@djBirdman

Description

@djBirdman

I'm trying to use the OpportunityForecastAPI, but trying to use the result from get_opportunity_forecasts() for the forecasts under an opportunity results in a "ValueError: dictionary update sequence element #0 has length 1; 2 is required" error.

In testing, the get count gives the expected number of forecasts. e.g. this works:

api_cw_forecast = opportunity_forecast_api.OpportunityForecastAPI(url=URL, auth=AUTH, parent=opp.id)
print(api_cw_forecast.get_opportunity_forecasts_count())

But

api_cw_forecast = opportunity_forecast_api.OpportunityForecastAPI(url=URL, auth=AUTH, parent=opp.id)
forecasts = api_cw_forecast.get_opportunity_forecasts()
for f in forecasts:
    print(f.id)

results in

Traceback (most recent call last):
  File "./opportunity.py", line 26, in <module>
    for f in forecasts:
  File "..../connectpyse/cw_controller.py", line 35, in _get
    yield self._class(json)
  File "..../connectpyse/sales/opportunity_forecast.py", line 31, in __init__
    super().__init__(json_dict)
  File "..../connectpyse/cw_model.py", line 5, in __init__
    self.__dict__.update(json_dict)
ValueError: dictionary update sequence element #0 has length 1; 2 is required

I've confirmed that get_opportunity_forecasts() returns a generator object, but not sure about things beyond that. Guessing it could be the structure of forecast / forecastItems under the opportunity being different?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions