This thread is resolved. Here is a description of the problem and solution.
Problem:
Client has added a notification to an Edit Form which changes the post status to published which should be sent when the status is changed to publish, but it doesn't fire the first time, only if the same post is edited again.
Solution:
The notification on the edit form should be set to send when the form is submitted, or the notification should be added to the form where the post is initially published rather than the edit form.
here's the workflow I use on my website, which however doesn't trigger notification when I expect it should:
1. Contributor submits a post with Pending Review status.
2. Manager has a form where he can edit the post, which after the form submission has Published status. The form submission has notification set up; the notification should be sent to the post Author (here, Contributor) when the post status changes to Published. However, this notification doesn't work at this stage.
3. Yet the Manager has another form to manage posts: the form that changes post status back to Pending Review. When I submit this form (after I already submitted the form from step 2., so the post has Published status before submission and Pending Review upon submission) and then I submit the form from the above step 2. again (post status = Published) the notification is however sent this time.
I think the problem is that the form in step 2 is set to send a notification when the status changes to published, but when you submit that form the status *is* published.
You can solve this by either leaving the notification in the form in step 2 but changing it to be triggered when the form is submitted (which itself sets the status as published), or you can move the notification to the original form in step 1 and set it to be sent when the status changes to published (which will happen in step 2).
Either of the above should have it work how you expect.
When the Contributor submits the form (step 1) the post has Pending Review status. Then the Manager edits the post (step 2) (the post has still Pending Review status before the form submission, right?) and submits it, which subsequently causes the post has status of Published, so the status changes to Published and so the notification should be triggered, or am I missing something at this point :)?
Well from what you experience (I tested it and found the same) it seems that the test for changing post status happens after the form has been submitted, so would only be picked up on subsequent changes to the post status, not with whatever status is set when the form is submitted. That's what the "When the form is submitted" option is for, but in any case it probably makes more sense to add such a notification based upon a change in status to the initial form. Then the notification would be sent whether the status is changed by an edit form, or directly in the backend.
I played around with notifications and it appears that, as you suggested, to have a working notification triggered when post status changes I have to set it up "one form ahead", so not in the form for editing post in my case (step 2), but in the form for adding the post (step 1). Not how I would expect it to be, but at least it works now. Thanks for your tips Nigel.