Results 1 to 7 of 7

Thread: make record ids available to an outside application

  1. #1
    Nisbet is offline Sugar Community Member
    Join Date
    Aug 2007
    Posts
    42

    Default make record ids available to an outside application

    good morning all


    I have set up a link to an external application using the methods described in the following post:

    Creating an HTML link in an Account

    What I would like to do is pass the record id to the application I am linking to. I have tried adding the variable to the query string , but so far haven't had any luck


    example:


    array (
    'name' => 'test_link_c',
    'label' => 'LBL_TEST_LINK',
    'customCode' => '<a href="extl_apps/ext_manager.php?key={$_REQUEST[record]}" target="_blank">Key Management</a>',
    ),


    I have tried several this several ways, but haven't been able to push the record id to th external application. Does anyone have any ideas on how I could get this to work?


    I am running the community edition Version 5.0.0b (Build 3150)
    On Linux with Apache/PHP/MySQL


    Thanks

  2. #2
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: make record ids available to an outside application

    I'm interested in doing this as well and I'm on the same platform.

    I'll play with it and we can compare notes.

    Phil

  3. #3
    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: make record ids available to an outside application

    Hi, Nisbet

    Can you provide us the generated html for the field you are trying to set a link?

    Cheers

    --
    André Lopes
    Lâmpada Global Services
    Rua Bela Cintra, 299 conjunto. 51
    São Paulo, SP 01415-000
    tel1. 55 11 3237-3110
    cel. 55 11 7636-5859
    e-mail: info@lampadacrm.com.br

  4. #4
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: make record ids available to an outside application

    OK, I got it working, but I'm not sure what changed.

    At first it behaved exactly as you described with the field value not getting filled in. Specifically, I put a raw URL page, then attempted to fill in the field value and it took the URL, but did not fill in any field value.

    Then I played with several things and it worked great, but I don't know exactly what changed.

    Here is the php code that defines a panel with two different ways of defining the link taken directly from custom/modules/Accounts/metadata/detailviewdefs.php. I copied the definition for an entire new panel where I put two test links, thus the PANEL 2 label and the array with 0 and 1. Both links work with this code:

    PHP Code:
           'PANEL 2' =>
            array (
              
    =>
              array (
                
    =>
                array (
                  
    'name' => 'ut_number_c',
                  
    'label' => 'LBL_UT_NUMBER',
                  
    'customCode' => '<a href="http://HOSTNAME/UTOrgAdd.asp?number={$fields.ut_number_c.value}" target="_blank">{$fields.ut_number_c.value}</a>',
                ),
                
    =>
                array (
                  
    'name' => 'ut_link_c',
                  
    'label' => 'LBL_UT_LINK',
                  
    'customCode' => '<a href="{$fields.ut_link_c.value}" target="_blank">UT Link</a>',
                ),
              ), 

    WARNING: Using SugarCRM Admin panel to edit Layouts blows away the customized line defining the link -- at least if you move the link field.


    Also note that I had to clear the cache from the admin panel before any changes would take effect.

    Phil
    Last edited by datasponge; 2008-04-03 at 01:21 AM. Reason: Hide IP addr

  5. #5
    Nisbet is offline Sugar Community Member
    Join Date
    Aug 2007
    Posts
    42

    Default Re: make record ids available to an outside application

    here is the generated html:

    <td width='37.5%' class='tabDetailViewDF' >
    <a href="ext_apps/ext_app.php?key_id=" target="_blank">Key Management</a>
    &nbsp;
    </td>

  6. #6
    Nisbet is offline Sugar Community Member
    Join Date
    Aug 2007
    Posts
    42

    Default Re: make record ids available to an outside application

    I was also able to get it working using the method described by datasponge(thanks by the way!)

  7. #7
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: make record ids available to an outside application

    More research clarified most behaviors and shows how to do this right to save it across Layout changes.

    In my earlier post I said:
    Quote Originally Posted by datasponge
    OK, I got it working, but I'm not sure what changed.
    and
    Quote Originally Posted by datasponge
    taken directly from custom/modules/Accounts/metadata/detailviewdefs.php.
    and
    Quote Originally Posted by datasponge

    WARNING: Using SugarCRM Admin panel to edit Layouts blows away the customized line defining the link -- at least if you move the link field.
    The first thing that changed was that the original post said to edit the file custom/working/modules/Accounts/metadata/detailviewdefs.php not the one I reference above. I found that one using grep to search to see how my edits were propagated by the rebuilds.

    Having noticed the two different paths I could do some experiments and note the effect, so here's what I found:
    1. Save & Deploy for Accounts Detail view Layout propagates the changes from custom/working/modules/... to custom/modules/...
    2. Changes made to working path are not lost
    3. The link works just fine after Save & Deploy
    4. Changes made ONLY to custom/working/modules/... never took effect without a later Save & Deploy through Admin Studio

    My recollection was that I initially changed only the working folder path, then cleared the cache and saw the link, but without the field getting filled in. I was unable to reproduce this behavior, so this is the only remaining question mark.

    I tried deleting the customCode line from custom/modules/Accounts/metadata/detailviewdefs.php and leaving the same line in custom/working/modules/..., then clearing cache and no link at all showed up. I then opened the layout and clicked Save & Deploy and the link worked great again.

    But the missing step appears to have been that you must re-save the Layout AFTER editing custom/working/modules/Accounts/metadata/detailviewdefs.php, which propagates the customCode line to custom/modules/Accounts/metadata/detailviewdefs.php making the link work perfectly.

    Hope that helps someone out there.

    Phil

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. ListView 'Contact' field is linked to wrong record
    By leenwebb in forum Developer Help
    Replies: 4
    Last Post: 2007-02-19, 05:41 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
  •