Is it possible to make a logical Hook who will be fired when you create a new record??
Is it possible to make a logical Hook who will be fired when you create a new record??
You can implement either a before_save or after_save logic_hook.
You can find examples on sugar wiki.
Kind regards
André Lopes
DevToolKit / Project of the Month - June 2009
Lampada Global Services- Open Source Solutions
Avenida Ipiranga, 318
Bloco B - CJ 1602
São Paulo, SP 01046-010
Brazil
Office: +55 11 3237-3110
Mobile: +55 11 7636-5859
e-mail: andre@lampadaglobal.com
Lampada Global delivers offshore software development and support services to customers around the world.
Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.
I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.
before_save and after_save don't fire when I create the record. It only fire when the record is saved.
When I click on "create contract or create opportunities, the logik is not fired...
They both fire on the initial create. I have several logic hooks that handle only the initial create case by checking if $bean->fetched_row['id'] is set and they are working.
Please paste the path to your logic_hooks.php file and its contents to this thread. Also paste the path and contents of your class definition file. I have found that it is often an error in the filenames or an if condition within the called function that makes it appear like it did not fire.
Phil
Use after_retrieve when going to the edit view from clicking a "Create new..." link. Then in the hook do a check to see if the record is new:
PHP Code:if(empty($bean->fetched_row['id'])) {
return; //Ignore for a new record
}
Co-Founder of: SugarOutfitters
Modules:
SecuritySuite (Teams)
Photo Module
Follow me on Twitter:eggsurplus
Your Personal Developer
eggsurplus wrote: Use after_retrieve when going to the edit view from clicking a "Create new.
How??
For example, How can I make a logic who will print "hello" when I click on "create contract"?
I can make it when i click on "save" but not when I click on "create..."
thi logic is like:
function test (&$bean, $event, $arguments) {
echo"hello"; exit;}
It's exactly the same as how you do it when you hit save but use after_retrieve instead of after or before_save in your logic_hooks.php for the module. There are plenty of examples on this forum.
Co-Founder of: SugarOutfitters
Modules:
SecuritySuite (Teams)
Photo Module
Follow me on Twitter:eggsurplus
Your Personal Developer
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks