spjs-utility.js v1.17

Change log
January 29. 2014
Added option to clear a people picker in SP 2013 using setFieldValue – specifying an empty string as new value.

November 24. 2013
Added option to pass scope to the function “spjs_QueryItems”. Use “scope”:”Recursive” to search all items without folders.

October 30. 2013
Fixed bug in init_fields_v2() regarding converting HTML formatted text in a calculated column to proper HTML.
getUserInfo_v2: customProp

October 23. 2013
Radio: setFieldValue will clear choices first. This mean you can set a radio choice field to “null” by passing an invalid value – like a blank string.
Calculated html converted in init_fields_v2()

September 13. 2013
In v1.173:

  • Added option to set a single choice Lookup column rendered as a <select> by ID.
  • This affects lookup columns with <20 items in IE, and all lookup columns in other browsers.
  • Changed the method of setting lookup colums to ensure they first try to match by TEXT and them by ID.

August 21. 2013
I had a mixup in the files and uploaded v1.17 in stead of v1.171. You will have to download v1.171 again. Sorry for the inconvenience.

August 20. 2013
In v1.171 i have fixed a typo preventing you from getting the loginName when using it to get the value from a people picker field in SP2013. I have also changed how getFieldValue handles people pickers in SP2013 by using the built in methods to get the field value.

When using getFieldValue to get a people picker value on page load, you must wrap the call like this:

	var myPeoplePickerValue = getFieldValue("MyPeoplePickersFieldInternalName","","; ","loginName");

I have updated spjs-utility.js to v1.17 with these changes:

  • Fixed compatibility issue in SP2013 with RTE fields and people picker fields.
  • Added support for getting and setting “Managed metadata fields” or “SPFieldTaxonomyFieldType” and “SPFieldTaxonomyFieldTypeMulti”.

This file is used in multiple solutions – like this one.


13 thoughts on “spjs-utility.js v1.17”

  1. Hi Alexander,

    I tried the new js file. It is working fine with Multiline text box, but not with the people pikcer.

    var requestor = getFieldValue(‘Requestor’,”,’; ‘,’loginName’);

    the above code give me blank alert, even though there is a value in the people picker called ‘Requestor’.
    ‘Requestor’ is a people pikcer with ‘Allow multiple selection’ = No

    1. Hi,
      I have looked at the code and changed it a bit as I had a typo preventing you from getting the loginName when using it in SP2013.

      When using this code on page load in SP2013 you have to wrap the code like this:

      	var myPeoplePickerValue = getFieldValue("MyPeoplePickersFieldInternalName","","; ","loginName");

      You can also wrap it like this, but it will trigger a tiny bit later:

      	var myPeoplePickerValue = getFieldValue("MyPeoplePickersFieldInternalName","","; ","loginName");

      Please download v1.71

      Sorry for the inconvenience,

    1. REgarding the below post:
      SPJS Upload for SharePoint: Custom upload page for uploading documents to various document libraries in a site collection.
      The File is getting uploaded into the document library, but when i try to open the file, i am not able to do so, IT’s saying the file is corrupt.
      Pls Reply how to resolve this.

      1. Hi,
        Which browser and SharePoint version are you using? Doest it work for other files, or does all files you try to upload end up as corrupted?


  2. Hi All,

    I just recently came across this utility package and hope it will help me with my task. I need to be able to read the value of a Lookup Field on a child list display form in a Parent/Child Relationship. I used the following code:

    fields = init_fields_v2();
    var LookupVal = getFieldValue(“Agreement Parent”,”true”);


    In my alert pop-up, I get a blank result. Without the “true” in the code, I get “undefined” in the alert pop-up. “Agreement Parent is the display name of the Lookup Field. Am I excuting the code correctly?

    Thanks James

      1. Sorry, I miss wrote my question. I tested and verified and it is the internal name. My display name has a space between the two words and that is what returns “undefined”. I am stumped as to why the Look-up field value is not being returned in my alert pop-up…..

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.