AnsweredAssumed Answered

Sugar 7 : What is the best way to delete records when field change?

Question asked by Gaelle Fernandez on Oct 20, 2015
Latest reply on Aug 10, 2018 by Jonathan Houle
Hello everybody !

What i want :
I would like to create a process that marks my custom Quotes as deleted when the quotes status is equal to "Souscrit". 
But i want to mark all the quotes' relationship as deleted too !

What i tried / What i thought of :
  1. I thought about Workflows, which are really great to achieve what i want : When a Quote's record is saved and the status field from Quotes changed to "Souscrit", i would like to create an action that marks the Quote as deleted. BUT in the Workflow management, you can not change that field's value. Neverwhere.

  2. I thought about a Scheduled Job running a simple query in database like the following :
    UPDATE de_devis SET deleted='1' WHERE status = 'Souscrit';
    But i don't know how to search for relationships for every record and how i could mark these as deleted too.

  3. I thought about an after_save logic_hook, which could be more convenient than the Job, because it acts only on one record at the time, but because the record are updated through the Sugar REST WebService, i don't know if the logic_hook is triggered.
So, here are the options I thought of. Please tell me if there are other ones.

And tell me your feeling about what i thought, please.

Thanks a lot for your time and patience !