Table of Contents

Article

When to set the WriteNow parameter in the Obj-Sav and Obj-Delete methods

Summary

The WriteNow option to the Obj-Save and Obj-Delete methods is useful in a few very specific scenarios only. System Architects should take care to use this option only in places where it will not interfere with standard flow processing. Standard flow processing already saves and commits work information, and an interceding Obj-Save with the WriteNow option can cause information to become inconsistent.

Explanation

The WriteNow option instructs the PRPC engine to immediately save and commit the page specified, and includes several ramifications. The Obj-Save WriteNow transaction:

  • Can be overwritten by a previous deferred Save (for example, in the case of flow processing)
  • Prevents rollback when there are errors with the statement
  • Does NOT represent the end of a transaction in and of itself
  • Does NOT release a lock or terminate other deferred saves

Suggested approach

Use the Obj-Save method with the WriteNow option primarily outside of flow processing.

Here are some examples of when to use Obj-Save with the WriteNow option selected:

  • In a rule called by a SOAP service, you might save one object with the WriteNow option selected because it is unnecessary to perform a deferred transaction (Obj-Save or Obj-Delete) for one object that is immediately followed by a Commit transaction.
  • Write to a log or history class to report progress during a larger transaction.
  • Write a new object out to disk during a larger transaction so that a subsequent database browse picks it up.

Additional information

Troubleshooting: Error - Flow Not At Task with incorrect use of WriteNow parameter in Obj-Sav method

Design Time Warnings for WriteNow and Obj-Save

How to correct the Write Now warning for activity rules

How to write an agent activity

How to create activities that attach files to work

Published July 20, 2012 — Updated October 2, 2015


100% found this useful

Related Content

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.