Internal function to get current logged in user

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

Tagged: 

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

  • 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

You must be logged in to reply to this topic.