PUSH_ALLOWED event allows subscribers to prevent items from being pushed to Salesforce under some conditions - this is great.

However, sometimes we want to disallow an item from being pushed immediately (real-time), but queue it for pushing asynchronously.
For example:
SF Account mapped to Drupal node DrupalAccount
SF Contact mapped to Drupal DrupalContact.
When saving a node with paragraphs, paragraphs are written to the database first.
Thus, when we save a new DrupalAccount, the DrupalContact hook_entity_insert event fires prior to the DrupalAccount hook_entity_insert, and we cannot push the DrupalContact (since we require an AccountId).

SalesforcePushAllowedEvent currently uses a boolean value to determine whether pushing is allowed.

Suggested implementation is to define more granular control over what is allowed:
- disallow permanent (equivalent to current behavior of isPushAllowed() returning FALSE)
- disallow only once (new feature - fail, but queue for later)
- neutral / allow (equivalent to current behavior of isPushAllowed() returning TRUE or NULL)

Let's copy whatever patterns make sense from AccessResult to make this work

Comments

aaronbauman created an issue.