We have a workflow in both 4.0 and 2011 that is currently set to fire when a record for one of our custom entity types is created or when a particular attribute on that record changes.
The above attribute changes when a user clicks a custom button . Javascript changes the attribute value and saves the form.
The issue appears if a user enters data on the form and clicks the out of the box 'save' icon and immediately also clicks the button to change the attribute.
When this happens the workflow fires twice - first because the save icon was clicked it fires because the record was created and by that time it also recognizes that the attribute value has changed. Since the workflow logic looks for the attribute value to be a certain value (which now it is) it fires a task.
The workflow is firing a second time due to the attribute changing value and like above because it is the correct value another task is fired.
If a user clicks the save icon and waits long enough before clicking the custom button there is no issue. Most users don't use the save icon and only click the button which saves (creates) the record and the workflow fires only once there as well.
This doesn't appear to be a huge issue but how can I explain what is occurring here that causes the workflow in the above scenario to fire twice.