Results 1 to 4 of 4

Thread: Assign value to related field

  1. #1
    fmarambio is offline Member
    Join Date
    Jun 2011
    Posts
    5

    Default Assign value to related field

    Hi there!

    I just been trying couple of days to do the following:

    I created a custom related field (Account) in module A and I created a logic hook that has to assign a value to this related field (Account) from module B. Which value do I have to assign to the related field, in this case the account ID?? or do I have to use load_relationship function.

    Thanks for your help.

  2. #2
    rafael.q.g@hotmail.com's Avatar
    rafael.q.g@hotmail.com is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    Florianópolis - Brazil
    Posts
    782

    Default Re: Assign value to related field

    A related field is composed of two fields, one that is stored on db, that is the related id, and other that is used just to display the related record name on screen.

    So if your logic_hook is to save a related object, you just have to assign the desired Id to the id field before save it.
    If you want to compute some relation before display the record on screen, you have to set values to both fields, the ID, and the textual one.
    Rafael Queiroz Gonçalves
    Advanced OMG UML Certified Professional
    Sun Certified Enterprise Architect for the Java Platform
    Sun Certified Programmer for the Java 2 Platform
    IBM Certified Advanced Application Developer - Lotus Notes and Domino
    IBM Certified Application Developer - IBM WebSphere Portlet Factory
    Computer Science Mastering / UFSC - PPGCC

  3. #3
    fmarambio is offline Member
    Join Date
    Jun 2011
    Posts
    5

    Default Re: Assign value to related field

    Thank very much Rafael,

    Now I get it!!! I was just assigning to the related field the id (in this case the contact id, is this correct right?) and It was not showing nothing in the detail view.

    Now if I want to assign the id and the display value on screen how do I do this assignation? Could you give me an example?

    Thank you very much, do you recommend any documentation for this matter??

    Francisco

  4. #4
    rafael.q.g@hotmail.com's Avatar
    rafael.q.g@hotmail.com is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    Florianópolis - Brazil
    Posts
    782

    Default Re: Assign value to related field

    Here is a short exemple:

    //inside method callled by logic_hook
    $focus->contact_id="abcd-1234-efgh...";
    $focus->contact="The contact Name";

    Just it will assign the desired values to the related field.

    I don't known any good documentation for this (The is just the sugar developer guide, but I think it don't goes in these details), but on sugar forum you can find many explanations.
    Rafael Queiroz Gonçalves
    Advanced OMG UML Certified Professional
    Sun Certified Enterprise Architect for the Java Platform
    Sun Certified Programmer for the Java 2 Platform
    IBM Certified Advanced Application Developer - Lotus Notes and Domino
    IBM Certified Application Developer - IBM WebSphere Portlet Factory
    Computer Science Mastering / UFSC - PPGCC

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Access control on Assign to field.
    By Mithun in forum Developer Help
    Replies: 2
    Last Post: 2010-01-07, 08:16 PM
  2. How to hyperlink Assign To field in Accounts Module
    By rraushan2007 in forum Feature Requests
    Replies: 4
    Last Post: 2008-08-22, 01:05 PM
  3. Replies: 4
    Last Post: 2008-03-25, 01:29 AM
  4. Replies: 0
    Last Post: 2007-10-20, 05:52 PM
  5. Replies: 0
    Last Post: 2007-09-05, 05:45 AM

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
  •