Byte #7: Workflows should never contain current.update()

The Scenario

You’re using a script activity in the Change Workflow to look up the value of a particular field on a Change Task that was just closed. You want to update the Change with that same data, and as a result you’re using a code snippet that looks like this:

The Problem

While this particular code might not cause a problem, using current.update() within a workflow has the potential to cause duplicate updates, or in the worst case scenario: infinite loops.

The Solution

Listen to ServiceNow’s recommendation and never use current.update() inside a workflow (or a business rule for that matter). Simply set the value of the field as you normally would, and leave current.update() out of it.

The Workflow Execution engine will update the current record for you.
Example: