AnsweredAssumed Answered

Module Relationships load_relationship()

Question asked by john Fieldsend on Sep 20, 2019
Latest reply on Oct 2, 2019 by john Fieldsend

Hi all,


been busy learning lots about sugar and made masses of progress with moving from Salesforce to sugar CRM but just hit another snag and wanted to check if my login or understanding was correct.


We have two custom modules Holokote (holo_holokote) and Feature Keys (holo_featurekey), these should have a relation ship of one holokote can have many feature-keys.


Our original sugar integrators did this by a custom field in holokote to store the id of the feature-key, this means only one feature key per holokote and we cant see the relationships in sugar.


to fix this i created a one to many relationship in sugars holokote module, which created  `holo_holokote_holo_featurekey_1_c` table, all good


I now need to alter the api method to use this relationship when saving a feature key instead of using the custom field

    $fkey = BeanFactory::newBean('holo_FeatureKey');
    $fkey->name               = $args['name'];
    $fkey->status             = $args['status'];
    $fkey->holokotetype       = $args['type'];

    // OLD Relationships by custome fields
    $fkey->s_serialnumber_id_c                    = $args['serialNumber'];
    $fkey->holo_holokote_id_c                     = $args['holokote'];
    $fkey->holo_featurekey_contactscontacts_ida   = $args['contact'];

    // bean relationship
    if ($fkey->load_relationship('holo_Holokote')) {

trying to use the load_relationship to create this relationship but this isn't getting saved


we use sugar 9 cloud