Get current user

Alex, I need to set a people picker field to the current logged in user using custom code, rather than a trigger. I can do it using SPServices, but do you have an internal custom function I can use instead?

You can use something like this (requires spjs-utility.js):

var currentUser = getUserInfo_v2(_spPageContextInfo.userId);
Change “PeoplePicker” for your fieldinternalname. Please note that the use of _spPageContextInfo.userId requires SP2010 or 2013. If you are using SP2007 you must use _spUserId.


Custom functions: getFieldValue, setFieldValue

The following custom functions are available in DFFS. Although you can accomplish the same thing using jQuery, these functions can save some time, especially for those unfamiliar with jQuery.



What is Dynamic Forms for SharePoint?

Alexander Bautz of Norway has created a free add-on for SharePoint that simplifies development in SharePoint 2007, 2010 and 2013.

Alex calls his add-on “Dynamic Forms For SharePoint” (DFFS for short). The purpose of this blog is to help anyone interested in DFFS learn how to get started with it, how to use it, and to share ideas of the kinds of ultra-rapid development it allows.

Alex’s blog about DFFS is located here (opens in new window).

For those already familiar with DFFS who just want to get to Alex’s file library, go here.

Happy SharePointing!!
Keith Hudson
GroovePoint Consulting