Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: auto relate project opportunity account

  1. #1
    eddor1614 is offline Member
    Join Date
    Jul 2008
    Posts
    7

    Red face auto relate project opportunity account

    hello everybody

    my setup:

    Debian Etch
    SugarCRM Community Edition Version 5.0.0g (Build 3391)
    Apache 2.2.3
    PHP 5.2.0
    MySQL 5.0.32


    We are basically using Contacts, Accounts, Opportunities and Projects.
    we use Projects as Invoices, after adding an autonumber field and an amount field.
    we create the Invoices (Projects) using the sub-panel on opportunities module.
    right now if we want to see the Invoices (Projects) for an Account, first i have to go to that Invoice, and then select the Account using the sub-panel.
    what i need is a way to automatically set this last relation, so every time i create an Invoice using the sub-panel on the Opportunity, it also shows up on the Invoice sub-panel for the corresponding Account.
    Is this possible?
    has anybody done this already?

    thanks

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: auto relate project opportunity account

    Hi eddor1614.

    You can create a logic_hook before_save in Projects.
    This logic_hook can automatically relate the Project (Invoice) to the Account related to the Opportunity.

    Best 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.

  3. #3
    JVWay is offline Sugar Community Member
    Join Date
    Sep 2007
    Location
    Corvallis, Oregon
    Posts
    452

    Default Re: auto relate project opportunity account

    Quote Originally Posted by andopes
    Hi eddor1614.

    You can create a logic_hook before_save in Projects.
    This logic_hook can automatically relate the Project (Invoice) to the Account related to the Opportunity.

    Best regards.
    I just did this recently using SQL insert and update queries. While I was researching I found posts creating new objects and retrieving and saving the object. That seemed like a more elegant way of creating the relationship. Except I couldn't see how to retrieve a single record or save a single new record. The examples all used a for each loop and would want get data from the current record and either create a new record or update an existing record.

    Do you, or anyone else , have pointers on how to go about this?
    I've reviewed this entry http://www.sugarcrm.com/wiki/index.php?title=SugarBean but it's pretty vague.

    Thanks for whatever assistance you can provide. I thought this could be especially relevant for what the OP was asking and I know it's what I wanted to do.
    Jerry Way
    Business Process Administrator

    Sugar 6.1.4 Professional
    (Testing 6.1.2)
    LAMP on Centos 5
    PHP 5
    MySQL 5
    Apache 2.2

  4. #4
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: auto relate project opportunity account

    Hi Jerry

    Do you know logic_hooks?

    The logic_hook before_save is called just before saving the record into database.
    It is a method in a class where you can implement what is necessary to get the goal. In your scene:
    1. retrieve the Opportunity related to the Invoice
    2. retrieve the Account related to the Opportunity
    3. relate the account to Invoice

    That is it.

    Cheers
    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.

  5. #5
    eddor1614 is offline Member
    Join Date
    Jul 2008
    Posts
    7

    Default Re: auto relate project opportunity account

    hey
    thanks for the fast reply.

    so, there is no way of doing this without php programming, right?

    now I'm trying to find an complete example of these logic_hooks.

    any recommendation?

  6. #6
    JVWay is offline Sugar Community Member
    Join Date
    Sep 2007
    Location
    Corvallis, Oregon
    Posts
    452

    Default Re: auto relate project opportunity account

    That's true it can only be done in logic_hooks.

    This thread is what gave me the lead on doing this with objects. I've not found much more about it but it's certainly more elegant than SQL queries especially since database structure could change in future version.

    http://www.sugarcrm.com/forums/showt...tom+logic+hook

    I think I see in this thread the answer to my question.
    In this line
    $tempTask->retrieve($task->id);
    He's asking to retrieve the id that he got from the task object. I think that if I put the id as the variable that will get me a single record. He's doing this from a for each loop.

    Go here
    http://www.sugarcrm.com/wiki/index.p...Developer_Wiki
    Also developers.sugarcrm.com
    For all the info about the logic hooks. There are examples and downloads. Somewhere there is a zipped example that got me started. It's something about assignment notification I think. From that I was able to take off and I knew nothing about PHP programming. I've done other languages and PHP's pretty easy.
    Jerry Way
    Business Process Administrator

    Sugar 6.1.4 Professional
    (Testing 6.1.2)
    LAMP on Centos 5
    PHP 5
    MySQL 5
    Apache 2.2

  7. #7
    eddor1614 is offline Member
    Join Date
    Jul 2008
    Posts
    7

    Default Re: auto relate project opportunity account

    thank you very much!

  8. #8
    eddor1614 is offline Member
    Join Date
    Jul 2008
    Posts
    7

    Default Re: auto relate project opportunity account

    hello again
    anybody knows an easy way to do this using the 5.1.0 version?
    thanks

  9. #9
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: auto relate project opportunity account

    Hi eddor1614

    Still logic_hook before_save.
    There are articles in the SugarWiki documenting how to use this.
    Let me know if you have any issue.

    Best 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.

  10. #10
    JVWay is offline Sugar Community Member
    Join Date
    Sep 2007
    Location
    Corvallis, Oregon
    Posts
    452

    Default Re: auto relate project opportunity account

    Quote Originally Posted by eddor1614
    thank you very much!
    No problem, in this post http://www.sugarcrm.com/forums/showt...853#post126853 I attached an example of one of my logic_hook code sets. It kind of long since there's a lot of calculations but it might help on general usage.
    Jerry Way
    Business Process Administrator

    Sugar 6.1.4 Professional
    (Testing 6.1.2)
    LAMP on Centos 5
    PHP 5
    MySQL 5
    Apache 2.2

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 2008-07-17, 03:01 PM
  2. Replies: 3
    Last Post: 2007-12-05, 06:18 PM
  3. Replies: 0
    Last Post: 2007-02-05, 09:49 PM
  4. Replies: 1
    Last Post: 2006-07-06, 03:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •