We're currently using Salesforce for our sales process, which involve trying to get people to sign up to our "accounts management system", submit details, documents, and get reviewed by an admin. This is a whole PHP system outside of SF, let's call it "Cherry".
What we're doing right now is: Cherry keeps track of the accounts, but everything that happens is sent to SalesForce, so our salespeople have the list of leads to contact. When anything changes in Cherry, things get updated in SalesForce, including converting the SF Lead to an Account when the customer gets reviewed by our admins in Cherry. (After this we still update SF data, but this is less critical, since this is already a customer now)
To send information from Cherry to SF, I'm simply using the "SforceEnterpriseClient.php" API library, and calling the Create/Update/Delete methods provided by that library. I don't know if there's any other way to be honest, but our needs are very simple. Just creating Leads, updating their fields, and converting them to Account.
My problem is that our salespeople want to use time-dependent workflows, to automatically e-mail the leads every few days, change them from one status to another, etc. However, once a Lead gets "taken" by one of these workflows, the record is locked (until the time the action is executed, which is typically many days), and anything I try to do with it through the API (update it, or particularly "convertlead") fails with error RECORD_IN_USE_BY_WORKFLOW.
Now, this seems like a pretty common scenario (both using the API to update records, and using time-dependent workflow). In fact, it almost seems to our salespeople that the whole point of using SalesForce is the workflows, so I'm quite surprised something as basic as this fails...
So the basic question is....
- Is there any obvious way around this problem? (Using some other API? Doing something different with the workflows?)
- If not, is there any way to "detach" a Lead from its workflow? (or somehow unlock that record)
- If not, are there any workarounds that imply more programming on the SalesForce side?
Thank you VERY much for your help Daniel
You definitely can't convert a lead with pending workflow actions. However, you should be able to update the lead. In particular, you'll have to update the lead in a way that disqualifies it from the workflow rule. To achieve this, you might think about adding a hidden checkbox field called "Exclude from workflow" that you make part of the workflow criteria. In this case, you'd make an update call to to set this field to true.
Once the Lead is disqualified from the workflow rule, the workflow action will be removed from the queue. Then you can convert the lead.