Skip to main content
Notice removed Draw attention by CommunityBot
Bounty Ended with Tim Smith's answer chosen by CommunityBot
added 408 characters in body
Source Link
Ralph Callaway
  • 24.7k
  • 18
  • 116
  • 195

Question

Any tips or tricks for providing a good user experience when a time-based workflow field update can lead to an exception?

BackgroundDetail

For each wrench in the Salesforce toolkit there is often a good choice for error handling. For triggers addError allows you to delegate the error handling to the code making the DML statement, or have it bubble up to the UI. For VF you have pageMessages to let the user. For time based workflows, no ones home, so what to do? What error handling techniques are good for this case?

Concrete Example

In my scenario we have an approval-ish object (meaning it can be active/inactive), and we limit the number of active objects users can own. We use .addError to display an error message to the user if they try and activate the object and their over the limit. Trouble is, we also use time based workflows to activate them on a specific date.

I'm not an expert on time-based workflow error handling (and can't find anything in the docs), but my understanding is someone gets an email (not sure who) if it fails.

In this case, the field update fails, but this leaves the data in an inconsistent state. Does anyone have some examples of what they've done to handle errors with time based workflow?

Question

Any tips or tricks for providing a good user experience when a time-based workflow field update can lead to an exception?

Background

In my scenario we have an approval-ish object (meaning it can be active/inactive), and we limit the number of active objects users can own. We use .addError to display an error message to the user if they try and activate the object and their over the limit. Trouble is, we also use time based workflows to activate them on a specific date.

I'm not an expert on time-based workflow error handling (and can't find anything in the docs), but my understanding is someone gets an email (not sure who) if it fails.

In this case, the field update fails, but this leaves the data in an inconsistent state. Does anyone have some examples of what they've done to handle errors with time based workflow?

Question

Any tips or tricks for providing a good user experience when a time-based workflow field update can lead to an exception?

Detail

For each wrench in the Salesforce toolkit there is often a good choice for error handling. For triggers addError allows you to delegate the error handling to the code making the DML statement, or have it bubble up to the UI. For VF you have pageMessages to let the user. For time based workflows, no ones home, so what to do? What error handling techniques are good for this case?

Concrete Example

In my scenario we have an approval-ish object (meaning it can be active/inactive), and we limit the number of active objects users can own. We use .addError to display an error message to the user if they try and activate the object and their over the limit. Trouble is, we also use time based workflows to activate them on a specific date.

I'm not an expert on time-based workflow error handling (and can't find anything in the docs), but my understanding is someone gets an email (not sure who) if it fails.

In this case, the field update fails, but this leaves the data in an inconsistent state. Does anyone have some examples of what they've done to handle errors with time based workflow?

Tweeted twitter.com/#!/StackSalesforce/status/420330507365535745
Notice added Draw attention by Ralph Callaway
Bounty Started worth 100 reputation by Ralph Callaway
Source Link
Ralph Callaway
  • 24.7k
  • 18
  • 116
  • 195

Bests practices for handling potential errors as a result of time based workflow

Question

Any tips or tricks for providing a good user experience when a time-based workflow field update can lead to an exception?

Background

In my scenario we have an approval-ish object (meaning it can be active/inactive), and we limit the number of active objects users can own. We use .addError to display an error message to the user if they try and activate the object and their over the limit. Trouble is, we also use time based workflows to activate them on a specific date.

I'm not an expert on time-based workflow error handling (and can't find anything in the docs), but my understanding is someone gets an email (not sure who) if it fails.

In this case, the field update fails, but this leaves the data in an inconsistent state. Does anyone have some examples of what they've done to handle errors with time based workflow?