You need to sign in to do that
Don't have an account?
Surendra Muthye
Collaborative Forecasting
We are trying to access data from ForecastingItem using Apex. The code works fine in Execute Anonymous window of Developer Console. When we try to put it as a method in Apex class, we are unable to do so.
We have 4 Forecast Types defined and have not changed any picklist values anywhere - it is an out-of-the-box environment.
Code:
public List<ForecastingItem> getForecastItems(List<Id> userIdList, List<Id> periodIdList, List<Id> forecastTypeList) {
List<ForecastingItem> forecastItemList = [SELECT AmountWithoutAdjustments, AmountWithoutManagerAdjustment,
ForecastAmount, ForecastCategoryName, ForecastingTypeId,
ForecastQuantity, HasAdjustment, Id, IsAmount, IsQuantity,
IsUpToDate, OwnerId, OwnerOnlyAmount, OwnerOnlyQuantity,
ParentForecastingItemId, PeriodId, ProductFamily,
QuantityWithoutAdjustments,
QuantityWithoutManagerAdjustment,
Owner.Name
FROM ForecastingItem
WHERE OwnerId in :userIdList
AND PeriodId in :periodIdList
AND ForecastingTypeId in :forecastTypeList
];
return forecastItemList;
We have 4 Forecast Types defined and have not changed any picklist values anywhere - it is an out-of-the-box environment.
Code:
public List<ForecastingItem> getForecastItems(List<Id> userIdList, List<Id> periodIdList, List<Id> forecastTypeList) {
List<ForecastingItem> forecastItemList = [SELECT AmountWithoutAdjustments, AmountWithoutManagerAdjustment,
ForecastAmount, ForecastCategoryName, ForecastingTypeId,
ForecastQuantity, HasAdjustment, Id, IsAmount, IsQuantity,
IsUpToDate, OwnerId, OwnerOnlyAmount, OwnerOnlyQuantity,
ParentForecastingItemId, PeriodId, ProductFamily,
QuantityWithoutAdjustments,
QuantityWithoutManagerAdjustment,
Owner.Name
FROM ForecastingItem
WHERE OwnerId in :userIdList
AND PeriodId in :periodIdList
AND ForecastingTypeId in :forecastTypeList
];
return forecastItemList;
In fact, I tried that in the developer console after stripping the code to the bare minimum with the same result