Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow triggers on change that is not actually a change #1378

Open
Luke1982 opened this issue Oct 17, 2022 · 2 comments
Open

Workflow triggers on change that is not actually a change #1378

Luke1982 opened this issue Oct 17, 2022 · 2 comments

Comments

@Luke1982
Copy link
Contributor

I have some code that updates the duedate on a salesorder. Sometimes, the code is triggered because a time changed, but the date has not. Even then, the code will trigger a save on the salesorder, updating the duedate to the same one as it already was.

I also have a workflow in place, that should run when the duedate changes. Now that workflow runs when the duedate is 'touched', even when it does not change. So for instance, the code could update a field that is set to 2022-10-27 to that exact same value, still triggering the workflow.

Could we change that? So that the workflow does not only check if the field is touched but also if it actually changed?

@joebordes
Copy link
Contributor

what I understand is that you have one workflow that triggers correctly and updates the duedate
then another workflow has a "has changed" condition to detect if the duedate has changed and this second one is triggering even when the duedate update is identical.

first I looked at the code and see that the condition is not equal, so it shouldn't be triggering the "has changed": https://github.com/tsolucio/corebos/blob/master/data/VTEntityDelta.php#L154

then I created the two workflows as I understand and it seems to be working for me: the "has changed" event is not triggered if the update is the same value.

image

image

The tag is added only when I really change the duedate

Let me know

@Luke1982
Copy link
Contributor Author

Your description is almost correct: I don't have two workflows: I have some custom code that updates the SalesOrder duedate and a workflow that should respond on that update. I see the code you reference, and you're right: the update shouldn't trigger the workflow. Maybe some leading or trailing space messed up the comparison in hasChanged. Thanks for the update, we could close this until I investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants