Kashif Nizam Qureshi

Leave a comment

People Picker PDP of PWA by Using Script

Use the following script to enable custom field to become people picker.
//Set the following to be an array of fields you would like to change into a people-picker
var targetFields = [‘Project Sponsor’];
//var targetFields = [‘Field 1’, ‘Field 2’];

//safely load JQuery
if (typeof jQuery == ‘undefined’) {
var s = document.createElement(“script”);
s.src = ‘//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js’;
if (s.addEventListener) {
s.addEventListener(“load”, function () { myJQueryCode() }, false);
} else if (s.readyState) {
s.onreadystatechange = function () { myJQueryCode() };
} else {

function myJQueryCode() {
$(document).ready(function () {
var scriptRoot = _spPageContextInfo.siteAbsoluteUrl + ‘/_layouts/15/’;

$.getScript(scriptRoot + “clienttemplates.js”),
$.getScript(scriptRoot + “clientforms.js”),
$.getScript(scriptRoot + “clientpeoplepicker.js”),
$.getScript(scriptRoot + “autofill.js”)
.done(function () {
window.console && console.log(‘Scripts loaded’);
.fail(function (message) {
window.console && console.error(‘Loading scripts failed: ‘ + message);

function renderPeoplePickers() {
for (fieldIndex = 0; fieldIndex < targetFields.length; fieldIndex++) {
$(“input[type=’text’][title='” + targetFields[fieldIndex] + “‘]”).each(function () {
this.style.color = “green”;
window.console && console.log(‘PeoplePicker rendered: ‘ + targetFields[fieldIndex]);

function renderPeoplePicker(targetInput) {
var divPeoplePicker = document.createElement(‘div’);
var idPeoplePicker = targetInput.id + ‘_PeoplePicker’;
var targetValue = $(targetInput).attr(‘value’);

divPeoplePicker.id = idPeoplePicker;

var newPeoplePicker = this.SPClientPeoplePicker.SPClientPeoplePickerDict[idPeoplePicker + ‘_TopSpan’];

if (typeof targetValue !== “undefined”) {
Key: targetValue,
DisplayText: targetValue
}, true);

newPeoplePicker.OnControlResolvedUserChanged = function () {
if (this.TotalUserCount > 0) {
//we have a resolved user
var resolvedUser = this.GetAllUserInfo()[0];

//Set the underlying field value
$(‘input#’ + (this.TopLevelElementId.split(“_PeoplePicker_TopSpan”)[0])).attr(‘value’, resolvedUser.DisplayText);

//If value has changed then mark the PDP dirty to enable save
//Thankyou to Martin Laukkanen (nearbaseline.com) for this fix!
if ($(‘input#’ + (this.TopLevelElementId.split(“_PeoplePicker_TopSpan”)[0])).attr(‘origvalue’) !== $(‘input#’ + (this.TopLevelElementId.split(“_PeoplePicker_TopSpan”)[0])).attr(‘value’)) {
WPDPParts[0].IsDirty = true;
} else {
//we have nothing – so clear out the target field
$(‘input#’ + (this.TopLevelElementId.split(“_PeoplePicker_TopSpan”)[0])).attr(‘value’, ”);


// Render and initialize the client-side People Picker.
function initializePeoplePicker(peoplePickerElementId, defaultValue) {

var users;
if ((defaultValue != undefined) && (defaultValue != “”)) {
users = new Array(1);
var defaultUser = new Object();
defaultUser.AutoFillDisplayText = defaultValue;
defaultUser.AutoFillKey = defaultValue;
//defaultUser.Description = user.get_email();
defaultUser.DisplayText = defaultValue;
defaultUser.EntityType = “User”;
defaultUser.IsResolved = false;
defaultUser.Key = defaultValue;
defaultUser.Resolved = false;
users[0] = defaultUser;
} else {
users = null;

// Create a schema to store picker properties, and set the properties.
var schema = {};
schema[‘PrincipalAccountType’] = ‘User’;
//schema[‘PrincipalAccountType’] = ‘User,DL,SecGroup,SPGroup’;
schema[‘SearchPrincipalSource’] = 15;
schema[‘ResolvePrincipalSource’] = 15;
schema[‘AllowMultipleValues’] = false;
schema[‘MaximumEntitySuggestions’] = 50;
schema[‘Width’] = ‘360px’;

// Render and initialize the picker.
// Pass the ID of the DOM element that contains the picker, an array of initial
// PickerEntity objects to set the picker value, and a schema that defines
// picker properties.
this.SPClientPeoplePicker_InitStandaloneControlWrapper(peoplePickerElementId, users, schema);

Leave a comment

An unhandled exception occurred during the execution of the workflow instance


RequestorId: a6721745-8c82-cf39-0000-000000000000. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ApplicationException: HTTP 404 {“Transfer-Encoding”:[“chunked”],”X-SharePointHealthScore”:[“0″],”SPClientServiceRequestDuration”:[“1443″],”SPRequestGuid”:[“a6721745-8c82-cf39-8e70-854ddb459a48″],”request-id”:[“a6721745-8c82-cf39-8e70-854ddb459a48″],”X-FRAME-OPTIONS”:[“SAMEORIGIN”],”MicrosoftSharePointTeamServices”:[“″],”X-Content-Type-Options”:[“nosniff”],”X-MS-InvokeApp”:[“1; RequireReadOnly”],”Cache-Control”:[“max-age=0, private”],”Date”:[“Fri, 06 May 2016 15:11:16 GMT”],”Server”:[“Microsoft-IIS\/8.5″],”X-AspNet-Version”:[“4.0.30319″],”X-Powered-By”:[“ASP.NET”]} at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)


In an SPD workflow, list item was being updated where it was unable to find the item.


This error seems to be very common and can occure for many reasons. In my case, one of the list’s item was being updated based on title. The item with that title was not there as it was changed and hence this error. So I changes the update to query based on ID rather than name.

Leave a comment

Passing SSRS Parameter Through URL To Report Viewer SharePoint Mode

Following URL is being used to access a page where a Report Viewer web part is placed. Note the URL contains report parameter as well. This won’t work unless we connect the web part with Query String (URL) Filter web part as shown below.



Leave a comment

Passing Parameter to SSRS Reports Through URL

Following is an example of one report being accessed via URL with one paramater as a querystring. Notice rp: is being used just before actual paramater, also parameter is case-sensitive.


Leave a comment

Enabling Remote Error for SSRS Reporting Service


Enable Remote errors for a Reporting Services Service Application
For a SharePoint mode report server installed with SQL Server 2012 or a newer version of Reporting Services, enable the service application setting Enable remote errors. The setting can be configured for each Reporting Services service application.
In SharePoint Central Administration, click Manage service applications in the Application Management group.
Find your Reporting Services service application and click the name of your service application.
Click System Settings.
Click Enable Remote Errors in the Security section.
Click OK.

Enable Remote Errors for a SharePoint Site
For a SharePoint mode report server installed with a version of Reporting Services prior to SQL Server 2012, enable the site setting Enable remote errors in local mode.
In Site Actions click Site Settings for the site you want to modify.
Click Reporting Services Site Settings in the Reporting Services group.
Click Enable remote errors in local mode.
Click OK

Leave a comment

Removing Unnecessary Permission Level Project Server

PWA sync with SharePoint groups, in order to give permission to users to access sites (PWA and/or Project Site). By default users have delete and other unnecessary permissions. Best way is to remove it from Permission Level using task scheduler as PWA revert back permission level whenever you update user’s group. To view whole list of base permission click here.

Following code applies permissions to Project Manager permission level defined in base permissions.

$site=Get-SPSite http://Server/PWA


$contributePermissionLevel=$web.RoleDefinitions["Project Managers (Microsoft Project Web App)"]

$contributePermissionLevel.BasePermissions="ViewListItems, OpenItems, ViewVersions, ManagePersonalViews, ViewFormPages, Open, ViewPages, CreateSSCSite, BrowseDirectories, BrowseUserInfo, AddDelPrivateWebParts, UpdatePersonalWebParts, UseClientIntegration, UseRemoteAPIs, CreateAlerts, EditMyUserInfo"





Get every new post delivered to your Inbox.