So my user wants to send an email when the Lifecycle state moves from one particular state to another. I have been able to use the Lifecycle template to add in a workflow on the state the document is moving into (aka on the Phase Process) but I need it to only send the email if the previous state is one specific state. I'm not sure how to get that previous lifecycle state. I'm very new to all this so not even sure it can be done.
In general, best practice has been to tied a single workflow to the first state and let that workflow change the state of the objects. This is similar to how change objects work. Have you looked at notifications or subscriptions as a way to avoid workflows?
To your specific point, I would look at the LifecycleHelper.service class, specifically the method below:
QueryResult getHistory(LifeCycleManaged object)
This should tell you what the previous state was before the current one. But, based on what you described, I would caution if you have the right method to do these notifications. Workflows seem like a bit too much overhead.
The users have looked into those options but considered them not a good fit for this as the amount of subscriptions individuals would have to create would be time consuming. We do use workflows to change the states, but only upto a point in the process where our customers must be notified. At that time, it's a manual effort since we are waiting on the customer to acknowledge our efforts to get in touch with them.
I'm sorry do you have an example of this method. Again I am very new to all this and just would like documentation on this method before attempting. Thank you.