Hello,
I would just like to say this is a great tool! There is just this one issue I have found.
Basically, I query the UserInfo list to get all the employees under X manager. Then I put each user name into a semi-colon separated string for use of the SPFindPeoplePicker function (valueToSet). The issue is that if the string is longer than 256 characters, an alert pops up saying the 'item length cannot be longer than 256 characters' and will not do the checkNames part of the function. I was wondering if it is possible to update this. I would like to see a way to append to the field rather than clearing it, or have the function handle the 256 character length issue internally.
Note: This is for Sharepoint 2010
Here is the code I am using that the error occurs
```
var userList = ""
$().SPServices({
operation: "GetListItems",
async: false,
listName: "UserInfo",
CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
CAMLQuery: "<Query><Where><Or><Eq><FieldRef Name='Supervisor'/><Value Type='Text'>" + managerName + "</Value></Eq><Eq><FieldRef Name='Title'/><Value Type='Text'>" + managerName + "</Value></Eq></Or></Where></Query>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
user = $(this).attr("ows_Title");
userList = userList + user + ";";
});
}
});
//add users to field
//currently, if userList > 256 chars, alert, does not checkNames
$().SPServices.SPFindPeoplePicker({
peoplePickerDisplayName: "Employees",
valueToSet: userList,
checkNames: true
});
```
Comments: Programmatically? Yes, but the problem is the check names takes too long and by the time the check goes through, the program has already added the rest of the users. This also had to be done manually, because the valueToSet parameter will overwrite any items previously inside the person field. As an update for this, I did find a way __around__ the problem. Simply put, I just added all of the names into the multiple person field, but did not do a check names. Simply submitting the form without having the names checked will yield the same outcome, minus the ability to see the person objects before you submit the item. You still get the alert, but that was minor compared to the worry of the names not being checked.
I would just like to say this is a great tool! There is just this one issue I have found.
Basically, I query the UserInfo list to get all the employees under X manager. Then I put each user name into a semi-colon separated string for use of the SPFindPeoplePicker function (valueToSet). The issue is that if the string is longer than 256 characters, an alert pops up saying the 'item length cannot be longer than 256 characters' and will not do the checkNames part of the function. I was wondering if it is possible to update this. I would like to see a way to append to the field rather than clearing it, or have the function handle the 256 character length issue internally.
Note: This is for Sharepoint 2010
Here is the code I am using that the error occurs
```
var userList = ""
$().SPServices({
operation: "GetListItems",
async: false,
listName: "UserInfo",
CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
CAMLQuery: "<Query><Where><Or><Eq><FieldRef Name='Supervisor'/><Value Type='Text'>" + managerName + "</Value></Eq><Eq><FieldRef Name='Title'/><Value Type='Text'>" + managerName + "</Value></Eq></Or></Where></Query>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
user = $(this).attr("ows_Title");
userList = userList + user + ";";
});
}
});
//add users to field
//currently, if userList > 256 chars, alert, does not checkNames
$().SPServices.SPFindPeoplePicker({
peoplePickerDisplayName: "Employees",
valueToSet: userList,
checkNames: true
});
```
Comments: Programmatically? Yes, but the problem is the check names takes too long and by the time the check goes through, the program has already added the rest of the users. This also had to be done manually, because the valueToSet parameter will overwrite any items previously inside the person field. As an update for this, I did find a way __around__ the problem. Simply put, I just added all of the names into the multiple person field, but did not do a check names. Simply submitting the form without having the names checked will yield the same outcome, minus the ability to see the person objects before you submit the item. You still get the alert, but that was minor compared to the worry of the names not being checked.