In SharePoint 2013, I have developed a custom ribbon action that is associated to a Content Type, which is in turn also associated to a workflow. The exact same URL is built up under the ribbon action as would have been triggering from the workflow ribbon action. I gather List (GUID), ID, ItemGuid, and TemplateID. For Template ID (which is really WorkflowAssociationID
), I use the REST API, such as:
/_api/web/lists('6bcf19e6-ae0c-40c1-994a-dbaf0a3f7ce2')/items(57)?$select=Id,GUID,ContentTypeId,ContentType/Name,ContentType/WorkflowAssociations/Id,ContentType/WorkflowAssociations/Name&$expand=ContentType,ContentType/WorkflowAssociations
...to get this by its Name. It's name being "My Workflow", not "My Workflow (Previous Version:26/05/2016 1:43:56 PM)".
The problem I'm facing is when the workflow runs, it is running a previous version of the workflow, such as "My Workflow (Previous Version:26/05/2016 1:43:56 PM)", when I would have expected it to run "My Workflow", which is the latest version.
If I happen to do this twice, which would mean I visit the /Sites/mySite/_layouts/15/Workflow.aspx?ID=20&List={6BCF19E6-AE0C-40C1-994A-DBAF0A3F7CE2}&Source=blah
..page, then it will pick up the correct workflow and runs it. Without me visiting this page before it does not know which is the latest version of the workflow.
Has anyone experienced this?
Cheers.