Skip to main content

Search

Sub-list Person Group Issue

Answered

Comments

3 comments

  • okachmar

    Hello @Sandra Huntley,

     

    Thank you for the question with a great example.

     

    You can't get the same list of options of person/group column on a sub-list, because here you have not one item(subscriber), but a list of items(subscribers), which are related to you main list item(editor). So that's why you have aggregated options in the column of sub-list.

     

    What do you like to do with emails?

    Maybe you need to have a list of emails of the subscribers which are related to some editor. This can be achieved in another way using Rich Forms app.

     

    Best Regards,

    Oleg Kachmar

    0
  • sangel40

    Hi Oleg,

     

    Because all I needed were the names and email addresses of the subscribers, I have created a column in my Newsletter list of a person/group type allowing multiple entries to get around this problem.

     

    How would I validate that I didn't get any duplicates in that column, validating on email address? I also need to ensure that the editor is not included in that list either?

     

    Thanks

    Sandy

    0
  • AndrewBerezovskyy2

    Hello Sandra Huntley

     

    We prepared solution for you . Using this script you can retrieve from sublist all user email addresses without duplicates and then for example send emails on that addresses.

     

    Step 1: Add FormLoadAction type execute scipt on your form where you added a sublist with the following script:

    var oldNormalize = window["Ardevia"].RichForms.Render.DisplayFormFieldElements.SubListValuesProvider.NormalizeValue;
    window["Ardevia"].RichForms.Render.DisplayFormFieldElements.SubListValuesProvider.NormalizeValue = function (fieldSchema, val) {
      var normalizedValue; 
      if(fieldSchema.FieldType == "User"){  
        if(val){  
          val.toString = function(){return val.localized;};   
          val.toLocaleString = function(){return val.localized;}; 
        }  
        normalizedValue = val; 
      }else{  
        normalizedValue = oldNormalize(fieldSchema, val);
      } 
      return normalizedValue;
    };

     

    Step 2: Then you can retrieve that emails addresses from sublist  using next code:

    ( for example you want send letter to that email addresses so you must create send email action and past next code into "To" field . Code will return string with emails in format : "email1;email2;")

    var emails = [];
    var getEmail = function(obj){
         emails.push(obj["data"].email);
    };
    [[@SubLists.YOUR_SUBLIST_NAME.SUBLIST_FIELDNAME]].forEach(getEmail);
    var emailsList = emails.join(';');
    return emailsList;

     

    Hope this will help you.

     

    Kind Regards
    Andriy Berezovsky

    0

Please sign in to leave a comment.