Sugar7 how to change default "From" address in email drawer?

--The Question--

I need to find a way to leverage the email options to set the default From address on an Email compose drawer. 

Occasionally the user will need to change the From so the other options should remain, but the default needs to be the queue on the case.


--Background--

I have several custom email compose buttons on the Email subpanel on Cases:
Internal Compose, Compose, Reply.

Each populates a number of fields like To, Subject, Body, and relates the email to the Case.
I do this via a custom API that returns an array:

               
    $composePackage = array(
      'to_addresses' => $toAddresses,
      'parent_type' => $parent_type,
      'parent_id' => $parent_id,
      'parent_name' => $parent_name,
      'subject'  => $subject,
      'html_body' => $body_html,
      'body' => $body,
  )
             


and $toAddresses is itself an array, for example:

        $toAddresses[]=array(
          'email'=>$email_addr,
          'module'=> 'Contacts',
          'name'=>$contact->full_name
        );
                       


This is used by a custom field type which is an extension of EmailactionFrield and opens the drawer with everything in place.

So, any thoughts on how to get the from default to be passed correctly to the EmailOptions?

thanks,
FrancescaS
Parents
  • I don't think you can extend sender view, without coping the code (which I wouldn't call extending)?!

    I did this by cerateing a new field type extending the basic filed type (what I know thats the only field type you can extend) Then I used the new field type for the subject field (which is of the basic field type by defult)

    You can change what field type to use in the compesview, 'type' => 'NewFiled'
    custom/modules/Emails/clients/base/views/compose/compose.php

    In the NewFiled.js I adde a listener on parent_id
    this.listenTo(this.model, "change:parent_id",function() {

    It works fine (I also think it is very simular to what EvilPeri recommended me erlier) but if anyone have a better solution please let me know.
  • Hi FrancescaS,

    Actually we can not set "From" address easily on our own. Sugar automatically picks "From" address by default. But If you add different inbound email accounts in sugar then you will have a list of "From" Addresses and you will have option to choose From address list. 

    Rolustech: SugarCRM Engineering
    Website: www.rolustech.com
    Ph (US): +1 - 310 - 492 - 5564
    Ph (UK): +44 - 207 - 9938 - 524
    Email: info@rolustech.com
    Skype: rolustech
Reply Children
No Data