There are three relevant Opportunity fields here:
- StageName
- ForecastCategoryName
- ForecastCategory
StageName
Required. Current stage of this record. The StageName field controls
several other fields on an opportunity. Each of the fields can be
directly set or implied by changing the StageName field. ..snip.. If the StageName is updated, then the
ForecastCategoryName, IsClosed, IsWon, and Probability are
automatically updated based on the stage-category mapping.
ForecastCategoryName
Available in API version 12.0 and later. The name of the forecast
category. It is implied, but not directly controlled, by the StageName
field. You can override this field to a different value than is
implied by the StageName value.
ForecastCategory
Restricted picklist field. It is implied, but not directly controlled,
by the StageName field. You can override this field to a different
value than is implied by the StageName value. The values of this field
are fixed enumerated values. ..snip..
In API version 12.0 and later, the value of this field is
automatically set based on the value of the ForecastCategoryName and
can’t be updated any other way. The field properties Create, Defaulted
on create, Nillable, and Update are not available in version 12.0.
So, things to take a look at:
- Trigger API version (affects #2 and 3)
- Is the error from a custom validation rule? - if so, then you need to make sure the trigger updates are consistently updating the stageName and ForecastCategoryName (or ForecastCategory if V11 or earlier)
- Is the error coming from SFDC itself? Again, are you updating the relevant fields to be consistent? Are you using a forecastCategoryName (or ForecastCategory) that is not in the picklist defined in the metadata?
Based on what you stated, I'm going to surmise that the trigger is explicitly updating the Forecast value and overriding the default stage > forecast mapping