Add notes to custom module

Hi all, we had a developer add a custom module Feature Keys (holo_FeatureKeys)  to our Sugar Ent 9.0. I now need to add notes support to this module.

Using studio I created a relationship one-to-many in the feature key module to notes (see attached) however when I try and create a note and attach it to the feature-keys module  it does not show in the related to field. I understand the related to field in notes is a flex relate field so I don't understand why I cant see my Feature Key module. I trie a quick repair and rebuild but this did not fix it.

I tried adding a note via the api 

    public function createNote($api, $args) {
      $db = $GLOBALS['db']->getConnection();
      $result = [
        'totalSize'   => 0,
        'done'        => true,
        'success'     => false,
      ];

      $note = BeanFactory::getBean('Notes');
      $note->description        = 'Custom Holokote Image: '.$args['file_ext'];
      $note->id                 = create_guid();
      $note->new_with_id        = true;
      $note->filename           = $args['file'];
      $note->parent_type        = $args['parentType'];
      $note->modified_user_id   = $args['contact'];
      $note->created_by         = $args['contact'];
      $note->parent_id          = $args['parentID'];
      $note->file_mime_type     = $args['file_mime_type'];
      $note->file_ext           = $args['file_ext'];
      $note->file_size          = $args['file_size'];
      $note->save();

      if (isset($note->id) && !empty($note->id)) {
        $result['success'] = true;
        $file = $GLOBALS['sugar_config']['upload_dir'] . '/' . $note->id;
        sugar_file_put_contents($file, base64_decode($args['file_content']));
      }
      return $result;
    }

where $args['parent_type'] = holo_FeatureKey and the parent_id is set to the id of the newly created feature-key.

Am i missing a step or is there some custom code that is stopping this module showing in the notes related to field. All our other custom modules show.

I have also tried to add this to the dropdown list record_type_display_notes

Parents Reply
  • I mentioned that it will add the Meetings, Tasks, Emails and Calls relationships.  I made my suggestion for a few reasons:

    • Many people don't know how to write the custom code or upload it to the Cloud.
    • It's easier to write and module load few custom files that hide the unwanted subpanels than it is to create custom files to add what you need for functioning relationships.
    • The Studio does create many files.  All of those files may be necessary for the correct functioning of the subpanel as well as the relationship elsewhere in the system.  Where possible, I prefer to let Sugar tools do the work for me as I've inherited too many instances where custom code was written incorrectly or incompletely and I can't get Support for the problems that arise.
Children