Quotes Module | change value of original quote when you duplicate it

Hello all,

How to change dropdown values of the primary quote to something else when we duplicating it.

image

So, we have above two dropdown in the Quotes modules. Now, when we duplicate it, when want to update values for these two dropdowns automatically. How to do it?

SuiteCRM: 7.13
PHP: 7.4

Please help to solve this problem.

Anyone knows it? :thinking: :thinking: :face_with_spiral_eyes:

You might want to try a workflow that runs on new records if Invoice status = Invoiced, change to not invoiced, etc.

1 Like

Thank you so much @pstevens!

I will give it a try. :smiley:

So, if user duplicate the record, will it change value into original quote?
Do I have to use conditions/actions? :thinking:

Here’s what I’m thinking (my stages are differnent than yours but it should give you an idea)

ohhhhhhhhhhh that’s interesting solution. I will try it on my side and update you.

For some reason, that did not work for me. I will try to play more around it.

Yeah, I thought that might be a problem. The workflows kind of operate like a before save hook. It could be timing thing since its a new record, when the workflow fires and checks the staus, the status may not exist in the bean yet.

You might have to do an after save hook so that AFTER the record is created the hook runs and changes the status. You can’t do this with worklfow, you’d have to code the hook.

Are you suggesting to use logic hooks? :face_with_peeking_eye:

I never code those before, so I think I need to learn and check examples.

Yes, I’d try an after save, basically:

  1. load the bean
  2. Check conditions
  3. Update the bean with new values
  4. Save the bean.

HOWEVER, with after save hooks you have to be careful you don ’ t end up in an endless loop. At the beginning of the process you have to check that the hook hasn’t already been run, other wise, the save triggers the hook which saves the bean, which triggers the hook…

1 Like

Thank you so much! Is it possible to create workflow such that when a particular quote is duplicated then send an email to sales person to update those values for older(primary) quote? :thinking:

I don’t think so. It would have to trigger on the new quote that gets created when you duplicate and there is nothing to tell the workflow which new quotes to fire on. Just by duplicating a quote you couldn’t fire a WF.

However, if you created a relate field like “related quote” in the NEW quote you were creating and populated it, you could presumably fire a workflow that fires if “related quote” is populated on a new quote record and then the action send the email. (or I would create a task, which will send an email once assigned.).

1 Like