Skip to main content

Search

How to add file attachments in the send mail action?

Comments

3 comments

  • Christof

    Hi Joerg

    You can achieve this case with skybow List Actions.

    The user select first the documents to attach to the email and press the List Action button containing the Send email action.

    Configuration of List Action


    1. Create List Action in execution context of Current list


    2. Create a variable named "attachments" of type array like this:

    3. Loop on the selected documents with [[@SelectedItems]] placeholder and fill the file urls of the selected documents into the array variable:

    Value expression of Set variable action (use expression of type Function):

    var attachmentarray = [[@Variables.attachments]];
    attachmentarray.push([[@Web.QueryList([[@List.ServerRelativeUrl]], '<Where><Eq><FieldRef Name="ID" /><Value Type="Integer">[[=[[@Actions.Loop_selected_Items.CurrentItem]].ID]]</Value></Eq></Where>', 1, 'FileRef', 'Scope=Recursive')]][0].FileRef);
    return attachmentarray;
     

    4. Use the array variable in the Attachments property of the Send email action


    Expression (type Assignment):
    [[@Variables.attachments]].join(';')
    0
  • JayT

    Hey Christof, I keep getting this error message when I try and execute the list action.

    Failed to evaluate property "Value" in "Set variable": Error occurred on evaluating expression "{ var attachmentarray = [[@Variables.attachments]]; attachmentarray.push([[@Web.QueryList([[@List.ServerRelativeUrl]], '<Where><Eq><FieldRef Name="ID" /><Value Type="Integer">[[=[[@Actions.Loop_selected_Items.CurrentItem]].ID]]</Value></Eq></Where>', 1, 'FileRef', 'Scope=Recursive')]][0].FileRef); return attachmentarray; }". Action "Loop_selected_Items" has not been executed yet.

    Any ideas on how I can fix this?

    0
  • Christof

    Hi Jay,
    seems your Loop Action is not same named as in my example. Replace this part in the expression [[@Actions.Loop_selected_Items.CurrentItem]] with your own Action output. You can get it from Actions in the Expression Builder:

    0

Please sign in to leave a comment.