Hi,
I'm creating a rule to be executed upon the creation of new content.  I need to execute php code, with some data that is available only during the creation of the new content.  I need to update a custom field of the node (field_myfield) with the data.

When I attempt to save_node() after the assignment, I get a: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'nid' for key 'PRIMARY'.  This leads me to believe I am attempting to update the node before Drupal has completely set the node in the db.  (I have similar code in an Updated Content rule that works well.)

So, what are the alternatives: save the nid and data in a file for later batch execution, or find an alternate way to update the node.  In the former case, how do I schedule the execution of the file in say, a minute or 2 (Batch API)?  Is there an alternate way to update the node that is 'in context' (while having access to the data)?

Thank you in advance,
Bill