Current User / Assigned To

Discussions about Forms Designer for SharePoint 2010.
Locked
User avatar
Sebastian Haugland
Posts: 43
Joined: Fri Sep 19, 2014
Contact:

25 Mar 2015

How can I get the name of the person in the Assigned To field? (people picker)?

I thought could just get it like this fd.field('AssignedTo').value()

But don't get any value, so I tried the script below - but its only showing the domain\userloginnumber - I need the full name. Can I change the .AccountName to something else like .Display Name etc?

(tried a lot of diferent ....)

My working script on a button click:

var hh = fd.field('AssignedTo').value().dictionaryEntries[0].AccountName;
alert(hh);

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

26 Mar 2015

Please, use the following code to get the display name of the selected user:

fd.field('AssignedTo').value().text

User avatar
Sebastian Haugland
Posts: 43
Joined: Fri Sep 19, 2014
Contact:

26 Mar 2015

Thanks! , with bit truncation I now have the missing part for my dynamic hyperlink so the user can all his tasks other taks. Again thanks a lot! :)

marcwenger
Posts: 17
Joined: Tue Dec 17, 2013

17 Feb 2016

Hello, what if I wanted to get the username instead of the display name?


thanks

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

18 Feb 2016

Hello,

Check this page for a reference on how to set/get various values from various fields: http://formsdesigner.blogspot.com/2013/ ... -form.html

If you have a multi-value people picker field, for example, you'd do this:

Code: Select all

var logins = '';
$.each(fd.field('person').value()
  .dictionaryEntries,
  function() {
    logins += this.AccountName + '; ';
  });

console.log(logins);

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 13 guests