0

I have time based Workflow on opportunity Object. As per our workflow criteria when 'Reservation End date equals today's date and Reservation Flag is true' the workflow fires and updates 2 fields namely 'Stage Name' and 'Close Date'.

Aftre this before update Trigger Fires- updates field on opportunity. Workflow is working for some records but for some records getting below error:

Closed/Lost opportunity stage should match with Omitted forecast
category.

I am not able to understand reason for this error.

1

There are three relevant Opportunity fields here:

  1. StageName
  2. ForecastCategoryName
  3. 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:

  1. Trigger API version (affects #2 and 3)
  2. 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)
  3. 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.