Internal function to get current logged in user

Forums Dynamic Forms for SharePoint Internal function to get current logged in user

Tagged: 

Viewing 1 reply thread
  • Author
    Posts
    • #17573
      Keith Hudson
      Participant

      I frequently want to grab the name of the current logged in user in order to create a record of who added a comment in a log field. I have accomplished this in the past by adding a column to my list called CurrentLoggedInUser (single line of text), then creating a rule to populate it each time the form loads by setting its value to {currentUser}, but I’m sure I can do it more directly. Is there an internal DFFS function I can use in my custom javascript to grab the current user’s display name?

    • #17577
      Alexander Bautz
      Keymaster

      You can use this in the Custom JS:

      var userInfo = spjs.utility.userInfo(spjs.dffs.data.currUserID);
      // userInfo is an object with multiple properties - use console.log(userInfo) to see all
      // Here is the title
      alert(userInfo.Title);

      Alexander

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