People Picker in Custom Alert

Forums Dynamic Forms for SharePoint People Picker in Custom Alert

Viewing 1 reply thread
  • Author
    Posts
    • #33994
      Jonathan Stamper
      Participant

      I have a vLookup table of Observations and within each observation is an inline button called “Send Email.” Clicking that button opens the custom alert with a div ID of “userEmails” inside “msg.”

      What I’m trying to do with the DIV is create a custom People Picker field that auto populates from 2 other people picker fields on the main form and also allows the user to add more users to send the email to. When they select send email it will take that list of people send them an email, set a child email flag to yes, and refresh the vLookup table so as to hide the send email button on the table.

      Is something like this possible to do or am I way over my head? I have logic to create a custom people picker but not sure how/if you can execute within the html of the custom alert.

    • #33996
      Jonathan Stamper
      Participant

      Ah, I just figured it out with where to execute the function. It’s just right below the custom alert like this:

      
      
      function doEmailSend(id){
         var htmlDiv=“<div style=‘Width:550px;’> +
                     “<label>Select users to email</label>” +
      “<div id=\”userEmails\”></div></div>”;
      
         spjs.dffs.alert({
             “Title”:”Email Observation”,
             “msg”:htmlDiv
           …
         });
         $(#userEmails”).spPeoplePicker();
      }

      Then the people picker is set up using logic courtesy of https://www.enjoySharePoint.com/client-side-people-picker-in-sharepoint-online-using-javascript/

      I’d still like to check to make sure that’s the best practice and if usable for collecting the email addresses and sending the emails.

      • #34017
        Alexander Bautz
        Keymaster

        If it works for you I’m sure it is OK.

        Please note that you don’t have to load all the scripts associated with the people-picker code as they should already be loaded with your NewForm or EditForm – if you are using this in DispForm however you must load all scripts not already loaded (look at the Network tab to see what is loaded).

        Alexander

      • #34030
        Jonathan Stamper
        Participant

        Thank you and great point and tip. I managed to get the logic working for loading to the custom people picker on the alert.

        Now I just need to work out the configurations on sending the auto emails. First time using it in DFFS and look forward to checking it out.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.