Hi,
You can add this code to the Custom JS in your DispForm:
function addMeToPP(){
var item, currPP, newPP, uItem;
item = spjs.utility.getItemByID({"listName":_spPageContextInfo.pageListId,"id":spjs.dffs.data.thisItemID,"viewFields":["PeoplePicker2"]});
currPP = item.PeoplePicker2;
if(currPP.indexOf(_spPageContextInfo.userId+";#") === 0 || currPP.indexOf(";#"+_spPageContextInfo.userId+";#") > -1){
alert("Your have already been added to this field.");
}else{
newPP = currPP+";#"+_spPageContextInfo.userId+";#";
uItem = spjs.utility.updateItem({"listName":_spPageContextInfo.pageListId,"id":spjs.dffs.data.thisItemID,"data":{"PeoplePicker2":newPP}});
if(uItem.success){
location.reload();
}else{
alert(uItem.errorText);
}
}
}
You must change “PeoplePicker2” with the field internal name of your field.
Then add this code to a “HTML section” in one of your tabs:
<input type="button" value="Add me to the PP" onclick="addMeToPP()" />
Let me know how this works out.
Alexander