Results 1 to 2 of 2

Thread: how do i update another table from an editview?

  1. #1
    netron is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    85

    Default how do i update another table from an editview?

    how do you update another table from a module editview?

    i've added an extra field to my leads table, which will store the date and time of when a call was made to that lead.
    therefore, when i submit a call via the calls.editview page , i'd like to also update that leads table field.

    its just a simple sql query

    update leads set lastcalled=NOW() where leads.id='$related_id'

    but i'm not entirely sure where the sql statements for updating/inserting occur once you hit "save" on an editview page.

  2. #2
    clint's Avatar
    clint is offline Sugar Team Member | Forums Lead Moderator
    Join Date
    Aug 2004
    Location
    Silicon Valley
    Posts
    2,120

    Default Re: how do i update another table from an editview?

    Quote Originally Posted by netron
    how do you update another table from a module editview?

    i've added an extra field to my leads table, which will store the date and time of when a call was made to that lead.
    therefore, when i submit a call via the calls.editview page , i'd like to also update that leads table field.

    its just a simple sql query

    update leads set lastcalled=NOW() where leads.id='$related_id'

    but i'm not entirely sure where the sql statements for updating/inserting occur once you hit "save" on an editview page.
    You will want to create a "before_save" custom logic hook and write your code there that does the update. Watch the Business Logic Hooks tutorial found at developers.sugarcrm.com. This will explain how to create upgrade-safe "before_save" code.
    Sugar Developer Zone - developer resources | Sugar University - user and admin training
    Sugar Docs - user and admin documentation |
    Sugar Bug Tracker - Enter or view bugs
    SugarForge- open source modules, themes, lang packs | SugarExchange - commercial extensions

    Clint Oram
    Chief Technology Officer and Co-founder
    SugarCRM

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Manually drop scheme (5.0 upgrade) ?
    By niallhannon in forum Installation and Upgrade Help
    Replies: 1
    Last Post: 2008-01-07, 05:41 PM
  2. problemi step 6 di SugarSuite-Full-4.0.1h
    By lucia in forum Italiano
    Replies: 0
    Last Post: 2006-12-27, 08:50 AM
  3. Fatal error: Max
    By spokes2k4 in forum Help
    Replies: 3
    Last Post: 2006-01-15, 03:50 PM
  4. Empty config.php at the end of install
    By aemadrid in forum Help
    Replies: 2
    Last Post: 2005-08-01, 06:29 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
  •