Switch Identity when composing email

Interested in talking about Mash-up's? This is the place.
Post Reply
g.tsankov
Posts: 5
Joined: Wed Feb 22, 2017 7:40 am

Switch Identity when composing email

Post by g.tsankov »

Hi guys,

I am writing a zimlet which needs to switch the identity (from field) when a email is composed and populate the other fields if neccessary. I've managed to populate the fields, but switching identities doesn't seem to work.
The code I am trying to execute is:

Code: Select all

var composeView = appCtxt.getCurrentView();
var val = composeView.identitySelect.getOptionWithValue(from);

composeView.identitySelect.setSelectedOption(val);
composeView.identitySelect.updateRendering();
But this code does not seem to work.
I have also tried using the

Code: Select all

 
 composeView.setAddress("FROM",from);
 
, but with limited success, as it gives out errors and opens a context menu somewhere in the screen.
I have also tried to change the accountName using the Compose Controller but that will send an email on behalf of the account that i wish, which is not desired in my case.

Can you guys help me out switching that value?

Regards,
George.
g.tsankov
Posts: 5
Joined: Wed Feb 22, 2017 7:40 am

Re: Switch Identity when composing email

Post by g.tsankov »

One way I managed to solve this today was by getting the option that i needed from the identitySelect, clearing all its options and then appending the value that is needed:

Code: Select all

var identitySelect = appCtxt.getCurrentView().identitySelect;
var val = identitySelect.getOptionWithValue(from);

identitySelect.clearOptions();
identitySelect.addOption(val,true,from);

Probably there is a better way, feel free to post other solutions.
Post Reply