rails_workflow icon indicating copy to clipboard operation
rails_workflow copied to clipboard

Assign operation on run time after completion a operation

Open dilkhush opened this issue 8 years ago • 4 comments

Hello I really like your gem but i need to know following points:

  • How we can assign a operation to multiple roles ?
  • Can I assign an Operation dynamically to an user after completing an operation? For Ex. 'a' operation completed after flow should go to the 'b' operation but 'b' should assigned at that time to whom it should assigned ?
  • Can I re-assign the operation to previous step if current operation is failed ?

I am also looking deep into your gem your answer can save some of my time.

Thanks For your reply in advance

dilkhush avatar Jan 10 '17 12:01 dilkhush

@dilkhush thanks! As for your questions:

  1. How can we assign an operation to multiple roles? You can create new MultipleRolesOperation class like this one, and add 'roles' to it. And then just check if template roles list includes user role.
  2. There are few ways to do it. For example, you can update add #build_operation method in Operation Template - here you will have the only argument - operation, created by this operation template. There you can add code to assign this operation to some specific user or any other.
  3. Not sure what do you mean by re-assign operation to the previous step if the current operation is failed. Can you describe this case in more details?

madzhuga avatar Jan 10 '17 13:01 madzhuga

@madzhuga Thanks for you quick reply 3 point was If I configure a template with 3 operations like A, B, C. B will be in-progress if A is done and C will be in-progress if A and B both are done. This the success workflow will be A > B > C. Now My requirement is if B operation got cancel then A should be again in-progress state again. One more thing in your demo application its not able to find cancel/skip methods in controller so do i need to create cancel/skip action in my application or I am missing any thing ? I am getting this error "The action 'cancel' could not be found for RailsWorkflow::OperationsController "

dilkhush avatar Jan 11 '17 06:01 dilkhush

@dilkhush sorry for the delay. You can configure operation A so that it will be created when operation B gets canceled. The most proper way is to re-create completed operation rather than re-open it. I will need to add cancel to operations controller in demo app - looks like I forgot to add it. There is API to cancel operation but may be I missed to add controller action.

madzhuga avatar Jan 15 '17 17:01 madzhuga

@madzhuga Thanks for your reply. I have one scenario where if the current task is cancel/rejected then I need to restart the flow from a point. Example:

  1. A customer give me a requirement
  2. Marketing Team Accept It
  3. Technical Team Give Efforts
  4. Sales Team Add costs
  5. If Customer Reject that
  6. Reassign to sales team and modified cost assign back to customer
  7. Now if customer say 'Yes' then the flow should go to Technical Team Again to thee 3rd point

In that case I was trying to use the same process but its not effecting here. Can you help me out in the scenario.

dilkhush avatar Jan 16 '17 08:01 dilkhush