AnsweredAssumed Answered

Relationship between custom module and Contacts module not working

Question asked by Autchara Chaiprom on Jan 24, 2017
Latest reply on Jan 30, 2017 by Autchara Chaiprom

I have module Feedback and need to create relationship between Feedback and Contacts to get email address from Contact to send Email.

So, I go to Studio to create relationship from Feedback and create relationship btw both but it still not working

 

 

I tried another way, I go to module builder and add relationship, it still not working

 

 

When I need to send out email from Feedback, it look like cannot get Contact info from Feedback although I like Contact to this record.

 

 

 

function in custom/modules/Emails/clients/base/views/compose/compose.js clone from _populateForCases

_populateForFeedback: function(relatedModel) {
        var config = app.metadata.getConfig(),
            keyMacro = '%1',
            caseMacro = config.inboundEmailCaseSubjectMacro,
            subject = caseMacro + ' ' + relatedModel.get('name');

        subject = subject.replace(keyMacro, relatedModel.get('feedback_number'));
        this.model.set('subject', subject);
        if (!this.isFieldPopulated('to_addresses')) {
            // no addresses, attempt to populate from contacts relationship
            var contacts = relatedModel.getRelatedCollection('contacts');

            contacts.fetch({
                relate: true,
                success: _.bind(function(data) {
                    var toAddresses = _.map(data.models, function(model) {
                        return {bean: model};
                    }, this);

                    this.model.set('to_addresses', toAddresses);
                }, this),
                fields: ['id', 'full_name', 'email']
            });
        }
    },

 

Can you suggest a thing that I need to do?

 

Sugar 7.7.0.1

Thanks,

M

Outcomes