AnsweredAssumed Answered

Is there a way other than $arguments['isUpdate'] to know when an object is new

Question asked by Gina Ochoa on May 31, 2017
Latest reply on May 31, 2017 by Gina Ochoa

I have a custom module, I built a before_save logic hook to preset some fields one, of them is a status. If it is a new object I must set a field (dropdown) = "new subscription", it does set the field value without the condition but when I add the if($arguments['isUpdate']==false) it is always returns false failing to set the field value when is a new object. One of the object fields is related to a contact, I guess it is always an update since the object is new only before the contact relationship is created, even before saving the object, am I right?

 

 

 

 

if($arguments['isUpdate']==false){
$bean->bk_status='New';
}

 

I also need this to do more than set a field value i.e. send a "welcome email" email and create a new meeting,  when creating a new subscription, and for this reason it is very important to be able to identify a new object

 

Is there any other way to achieve such identification?

 

Sugar community Version 6.5.25 (Build 344)

Outcomes