Results 1 to 2 of 2

Thread: SugarCE 6.2.0 GA - Custom Module - Multiple Addresses for Single Account

  1. #1
    wmarques's Avatar
    wmarques is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    France
    Posts
    14

    Default SugarCE 6.2.0 GA - Custom Module - Multiple Addresses for Single Account

    DISCLAIMER: If you choose to follow my instructions, read a step, stop, think, read again, stop again, think again, and if you're up for it, it's your risk.

    This is a very basic module, with basic functionality, built to interact with other modules.
    You DO NOT need to get into any configuration files to edit code.
    You DO need to read instructions carefully, and have at least poked around SugarCE's interface casually as an administrator.


    INTRO: I needed to implement a quick and dirty way to link multiple addresses for one same account. Also, while viewing a specific address/location, I wanted to be able to get the "Parent Site" address of the location I was viewing.

    I couldn't find any decent thread explaining how to do this, within the same thread, so I decided to document my procedures in hopes of saving others some time. Most of this is in the works, and I'll probably be changing things here and there. I'd like to share in case others have already done this and had additional tips/tricks, or were simply looking for a way to build a similar module.

    I'm using as many fields already built-in to SugarCE, trying to only add those that absolutely have to be created. The added fields are all in French, as I'll let the language pack do the translating for the rest. For the purpose of this thread, I'll use English field names and SugarCE 6.2.0 GA

    Basic Steps for the step-skippers:
    A. Create custom module with desired fields without any relate fields;
    B. Deploy your custom module;
    C. Add your Relate fields in studio and add your relationships;

    "Detailed" Steps for the detail-hungry folks:

    1. I begin by creating a custom module in the module builder called "Addresses", using the 'basic' module as a template.

    2. I've added some custom fields: (Note: Every field I create, I use XXX_YYY_ZZZ for Field Name, and XXX YYY ZZZ for Field Label by removing the underscore.)
    -Address 1
    -Address 2
    -Postal Code
    -City
    -Country
    -Site Active

    Fields I would use that were already included in the template were:
    -Name (required field)
    -Description
    -Date Entered
    -Date Modified
    -Deleted

    I could have used another template with these fields already present, but then again this is my first module, so I'd like to start from scratch.

    3. I then deploy the custom module (you can fix-up the multiple layouts before or after deployment, remember there are still some missing fields, so you'll have to get inthere anyways after deploying).

    Once the module deployed, I can now go into Studio to further add functionality to my module.

    4. I navigate to the fields and create my Relate field: (Note: Every field I create, I use XXX_YYY_ZZZ for Field Name, and XXX YYY ZZZ for Field Label by removing the underscore.)
    -Parent Address
    -I choose Addresses from the module I'm relating to.

    This allows me to pick an existing record in the Addresses module I wish to set as a link back to a parent address.
    E.G. BestBuy could have "CarAudioShop", "Storage", "Dumpster", all 3 different locations, or addresses, and the Parent address would be "BestBuy - Marin City, CA" for instance. (I miss the Bay Area :sadface:

    The reason I create this particular relate field here is that I cannot see the Addresses Module in the module dropdown before it's deployed (duh!), so I rather deploy the module first, and then use Studio to create the relate fields and add relationships and such. I'll eventually add this field through the different layouts of my module, but I'll leave that for the end and keep doing some other stuff first.

    (Note: Relate fields, for i.e. existing dropdowns, can be created before deployment.)

    5. I then go to my "Accounts" module in Studio, and navigate to "Relationships", and click "Add Relationship".

    6. There, I add a one-to-many relationship (One account with many addresses, makes sense to me at least).
    So on the left there is Primary Module (Accounts), in the center is Type (One-To-Many), and on the right is the Related Module with Module: Addresses, Label: Addresses, and Subpanel from addresses: Default. Hit "Save and Deploy".

    7. Now that the relationship has been created, I go back to my Addresses Module in Studio, and see that the relationship has indeed been created (Click Relationships to see this). Also notice that if you click on "Fields", you won't see any additional fields created (To link-up our Client Account to an Address entry). Instead, in the various Layout options for the new module, an "Accounts" field becomes visible, and this is what is used to link the address with an account.

    8. Now we're ready to go ahead and setup our various layouts. I won't make it lengthy here, but add:
    -Name (Important, this is the location name)
    -Parent Address
    -Accounts (created after our relationship b/w Accounts and Addresses)
    -Site Active
    -Address 1
    -Address 2
    -Postal Code
    -City
    -Country
    -Description

    I usualy leave out Date Created/By, Date Modified/By, from all Edit and create layouts. You are advised to do as you see fit.


    CONCLUSION: If there is anything strange with any of the steps, as in, it needs clarification, has a typo, or is misleading, please let me know so I can correct them. I beg you to quote the portion of text that if "odd" and to ptovide more information on what the issue is.
    Last edited by wmarques; 2011-07-20 at 11:53 AM.

  2. #2
    wmarques's Avatar
    wmarques is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    France
    Posts
    14

    Default Re: SugarCE 6.2.0 GA - Custom Module - Multiple Addresses for Single Account

    If this has helped anyone please let me know.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Setting up an account with multiple addresses
    By bastonian in forum General Discussion
    Replies: 4
    Last Post: 2011-04-28, 09:57 AM
  2. Multiple users for single account
    By kasturi_ion in forum Developer Tutorials
    Replies: 1
    Last Post: 2010-06-04, 03:52 PM
  3. Replies: 0
    Last Post: 2008-11-20, 04:31 PM
  4. Replies: 0
    Last Post: 2008-11-20, 04:28 PM
  5. Campaign problem: email addresses with single quote don't get sent
    By maryhaskett in forum Marketing/Campaign Management
    Replies: 1
    Last Post: 2006-07-05, 02:34 PM

Tags for this Thread

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
  •