Skip to main content

I have been challenged with incorporating Outlook into our Salesforce using Skuid. I was able to connect our Microsoft server and have succeeded in creating new single emails using the Outlook Draft object, pretty cool.


I am now stuck on allowing the user to select multiple Contacts (mass email). I currently have the Outlook Contacts as a table to select the records to grab the email addresses and am using a snippet from another post to create a semi-colon seperated array. This works great, but I need to pass the email addresses to the Recipients field in a model called NewDraft that is opened via PopUp that is used to create the new email. So I need to replace the yellow highlighted code below with this functionality.


Any direction on this would be greatly appreciated


Thanks!

Ann


I’m not 100% sure this will work, but its worth a try. 

1. Your snippet should take the resulting array and update a field in a UI Only model with that value  (Look for the documentation on updateRow here )

2.  Use the DataSource action for your Outlook data source that sends a message.  The “TO” property will take a semicolon separated list of email addresses.  If your UI Only field has that list you can use merge syntaxt to pass it in. Somthing like this:  {{$Model.UiModelName.data.0.EmailAddressesFieldName}} 

cc0fa891a9180cb193856a99b4de875771110704.png


Good luck with this!  



I was able to get this working, thank you Rob for your direction! Here’s a brief summary where I landed up to get it working:



  • Created a UI Model with UI Field.




  • Created global action that runs the Email Array snippet to populate the UI Model/Field, and then creates new row in Draft model via PopUp- populating the “ToRecipients” field with the string in the UI Field. Subject and Body fields are editable for user input




  • Added a button to the Draft model PopUp that saves Draft and runs an Outlook 365 Action : Send Draft



**Snippet: **


// Get the Email of the selected items as an Array

_var emailArray = skuid.$.map(argumentsu0].list.getSelectedItems(),function(item){ _


_ return item.row.Email; _


});


// Convert array to String


var emailString = emailArray.join(‘;’);
var $ = skuid.$,

_ model = skuid.model.getModel(‘UIEmAd’),_

_ row = model.getFirstRow();_

_ model.updateRow(row, {emadr:emailString}_);


Run Snippet and Create Rows Action Framework:



**Send Button Action Framework:


**


Thanks for documenting your solution back to the community.  Sharing the riches!!!