franglais
franglais

Reputation: 938

One workflow or multiple workflows?

I have an opportunity form and it has 4 statuses on it. For each of those statuses, I want to have a status date on it.

When I'm making my workflow, I know that I can simply create four workflows to get the effect I'm looking for, but can it be done all in one workflow?

So if status 1 and 2 are changed, the record is saved, I'd want status 1 date adn status 2 date to update to today's date, but not status 3 date or status 4 date.

I have a feeling the answer is no, but thought I'd check

Upvotes: 0

Views: 239

Answers (1)

BlueSam
BlueSam

Reputation: 1888

Correct. In a workflow, if you are triggering the workflow by multiple fields on an Update message, you only know that at least one of those fields was changed, so you would have to use 4 workflows to accomplish your goal.

If you are worried about having too many workflows, you could use a plugin to accomplish this. As an example, you could do something like this:

Entity entity = (Entity)context.InputParameters["Target"];
if(entity.Attributes.Contains("new_status1"))
{
    entity["new_status1date"] = DateTime.UtcNow;
}

Upvotes: 1

Related Questions