Use a user group in E-Mail

Forums Dynamic Forms for SharePoint Use a user group in E-Mail

This topic contains 1 reply, has 2 voices, and was last updated by  Alexander Bautz 3 weeks, 5 days ago.

  • Author
    Posts
  • #18251

    David Salewski
    Participant

    Hello!

    I am trying to send an e-mail to a specific user group with the help of the “E-Mail and Print”-Tab.

    If I put a people picker field as source ( {FIELD_NAME} ) , it works fine, if I add only single names, but fails to deliver the mails when I put in a SharePoint group.
    If I put {usergroup: GROUP_NAME} in the “To” field, it works perfectly, but I cant hard code the group as I have different group names for different occasions.

    I tried to use a workaround by writing the name of the group in a separate field and put {usergroup: {FIELD_NAME}} into the “To” field. This delivers the exact same spelling, but sadly, it does not work.

    Do you have a solution for this problem?

    Thanks in advance,

    David

  • #18294

    Alexander Bautz
    Keymaster

    Hi,
    You can add this code to the custom js (change “GroupA” with your group name – you can use getFieldValue to get it form another field if you like):

    var ugr = spjs.dffs.getUserCollectionFromGroup("GroupA");
    var emails = [];
    jQspjs.each(ugr,function(k,uo){
    	emails.push(uo.email);
    });
    var useThisInToField = emails.join(";");

    Use this variable in the To field in the email like this:

    {var:useThisInToField}

    Alexander

You must be logged in to reply to this topic.