Break workflow on specific point

Hi All
I have workflow works with conditions
the normal behavior

A → B → C → D

the exception

If B == something, Move to → D

How can id implement this scenario ?

@mostafa, in the validate event (client or backed, by your design), change the value of workflow_state for the state that do you want!

It will change temporary, If you refresh the page it will back to the workflow :frowning:

@mostafa, do you need change the value and run frm.save_or_update() :stuck_out_tongue_winking_eye:

@max_morais_dmm I’m working from the back-end

self.workflow_state = “Approved”

If I do the following

self.save()

It will execute run_before_save_methods and run_post_save_methods methods, And it will be infinite recursive, I can manage it by adding variable to check that, but this is not a best practice.

@mostafa, in the backend you can run

self.db_set("workflow_state", "Approved")
2 Likes

@max_morais_dmm WoW, It works perfectly :smiley: Thank you very much,

You are frappe Hero.

2 Likes

This topic was automatically closed after 2 days. New replies are no longer allowed.