AnsweredAssumed Answered

Create Email (compose.js) - how do I access the pre-populated contacts from the render function?

Question asked by Maritn Hawes on Sep 12, 2017
Latest reply on Sep 12, 2017 by Maritn Hawes

Hello, 

 

For context: I am attempting to extend compose.js to set up some default values based on the number of contacts initially added. I am creating the email from the email subpanel on a case, which adds the case contacts into the email recipients by default.

 

The following code sample illustrates my problem: 

({
    extendsFrom: 'BaseEmailsComposeView',

    initialize: function (options) {
        this._super("initialize", [options]);
    },

    _render: function () {
        this._super("_render");

        // These lines show as 0 in the console.
        console.log(this.model.getRelatedCollection('contacts').length);
        console.log(this.model.get('to_addresses').length);
    }
})

 

 

The console output always shows 0 regardless of how many recipients. How can I retrieve the initial recipients? 

 

Thanks very much,

Martin

Outcomes