Tuesday, March 22, 2016

Re-purposing the Title Field of a list

A posting on LinkedIn discussing what to do with the Title Field when it's not needed inspired this post.  Once I find the discussion again on LinkedIn, I will post :)

I have a love/hate relationship with the Title field.  It's great in views because it can link directly to the list item.  It's a pain because every time you create a list, you have a title field and it may not be necessary.  Some people choose to hide the field, others re-purpose it.  I fall into the latter category for a couple reasons, but in particular one big reason:  my end users love having the Title field linked to the edit menu on most views.

If I really have no reason for the Title field, I will do one of two things:

  1. Give the Title field a default value of "View Item".  This looks great in views, but when a user goes to edit the item or create a new item, they can edit the Title.
  2. Give the Title field a default value of "New Item" and create a workflow to assign a new title based off the Item's ID number.  For example, for a list of task items, I might have a workflow assign a Title of TASK:25, where 25 is the item's ID.  Again, this looks great in views, but users can modify the Title still.
So, what to do?  What I have laid out is an okay solution, but not really complete.  We can use JavaScript to make the field read-only!

If you haven't used JSLinks before, there are a number of great tutorials out there.  Here is a link to a number of great examples.

Here is the Script I typically use and should work with any list.  In my code below, the script makes the Title Field read only and displays the field in bold text.  Feel free to use this code and modify as you see fit!

(function () {
    var ctx = {};
    ctx.Templates = {};
    ctx.Templates.Fields = {
        "Title": {
            "NewForm": readOnlyFieldBold,
            "EditForm": readOnlyFieldBold,
            "DisplayForm": titleFieldTemplate
        }
    };
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(ctx);
})();

function readOnlyFieldBold(ctx) {
    var formCtx = SPClientTemplates.Utility.GetFormContextForCurrentField(ctx);
     
    return "<b>" + formCtx.fieldValue + "</b>";
}

function readOnlyField(ctx) {
    var formCtx = SPClientTemplates.Utility.GetFormContextForCurrentField(ctx);

    return formCtx.fieldValue;
}

function titleFieldTemplate(ctx) {
    var titleField = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];

    return "<b>" +titleField + "</b>";
}

Thursday, April 17, 2014

Run as workflow owner

The Action Set action in Nintex Workflow is helpful not only from an organizational stand point but because it allows the workflow to run a set of actions as the workflow owner (the user who published the workflow, often the site admin).

Rather than giving a user contribute access to a list that they don't really need that access to or don't the workflow to fail and stop running because of a permissions issue, the actions can be placed inside the Action Set and the workflow owner will run the actions each time the workflow is ran.

The Action Set action be found under Logic and Flow.


To set the Action to run as workflow owner, configure the action and go to the Settings > Common.  Select the checkbox for run as workflow owner.






Tuesday, March 4, 2014

This workbook is larger than the maximum workbook size allowed to be opened in the browser

This is the error message that is displayed when a user tries to view an Excel workbook in the browser that is larger than the maximum size allowed in Excel Services.

To update Excel Services, do the following:

  1. Log into Central Administration
  2. Under the Application Management heading, click Manage service applications
  3. Click the link that says Excel Services Application (the blue text)
  4. Click Trusted File Locations
  5. Hover over the Trusted File Location name and use the drop down to select Edit
  6. Scroll down until you reach Workbook Properties and update the value for Maximum Workbook Size.



Friday, February 21, 2014

Lists: Resource Throttling


I recently came across an issue where I had an Infopath form that needed access to a list that had over 10,000 items (Don't worry the form used a web service to filter the number of items returned).  When I opened the form, I received a message complaining  I was trying to query a list with more items than my list threshold, even though I was technically only returning only about 100 items.

There were a couple options.

Option 1: Increase the Resource Throttling through Central Administration.
  1. Go to Central Administration > Application Management > Manage Web Applications
  2. Select your site in the list, and in the ribbon click the drop down arrow for General Settings and select Resource Throttling.
  3. Adjust List View Threshold.
Option 2: User Power shell to increase Resource Throttling for just the list.

$Site = Get-SPWeb http://siteurl
$List = $Site.List["List Name"]
$List.EnableThrottling = $false
$List.Update()

I didn't need to increase the throttling amount for all of my environment, so I opted for Option 2 as most of our list and libraries have well below 10,000 items.  In most cases, I would recommend Option 2.

Wednesday, February 19, 2014

Nintex: Setting Up Lazy Approval

Lazy Approval is awesome.  I love it, and perhaps more importantly end users love it.  Lazy approval allows someone to approve or reject a task by e-mail.  Managers generally do not like to click and navigate to several different areas.  By having your notification messages include the relevant details and enabling lazy approvals, managers only need to read the e-mail and respond with text as simple as Yes or No to approve.


So, how is this awesome feature enabled?

Step 1: Install SMTP Service

Installing SMTP is pretty straight forward and I don't really want to go through it, but I will provide a couple articles for those unfamiliar with the process.
  1. Go to Central Administration.
  2. Under Nintex Workflow Management, click Global Settings.
  3. Enter your Outbound SMTP Server, a From Address, a Reply To Address.  This may already be configured if Nintex is sending notifications through workflows.
  4. Perform an IIS Reset.
Step 3: Enabling Lazy Approval
  1. Go to Central Administration.
  2. Click Nintex Workflow Management.
  3. Click Lazy Approval Settings.
  4. Click Enable / Disable Lazy Approval.
  5. Select Yes for Enable Lazy Approval via E-mail.
  6. Provide an e-mail alias.
  7. Perform an IIS Reset or wait about 15 minutes for the changes to go into effect.
Step 4: Manage Lazy Approval Terms
Adding New Terms
  1. Go to Central Administration.
  2. Click Nintex Workflow Management.
  3. Click Lazy Approval Settings.
  4. Click Create a new LazyApproval term for the current server farm.
  5. Provide the phrase and outcome and click OK
Adding New Terms to Ignore
These terms must appear in the e-mail subjects line to be ignored.
  1. Go to Central Administration.
  2. Click Nintex Workflow Management.
  3. Click Lazy Approval Settings.
  4. Click Create a term to ignore.
  5. Enter term, click OK.


Saturday, February 1, 2014

PowerShell Script to Mask User

SharePoint Survey Lists have the option to mask the Created By and Modified By fields, but unfortunately no other lists have this option.

If you need to mask the Created By and Modified By names on a SharePoint list, use the script below:

#Get Web and List objects
$spweb = Get-SPWeb http://SiteUrl
$splist = $web.Lists["List Name"]
#Mask Created By/Modified By
$splist.ShowUser = $false
$splist.Update()
$spweb.Dispose()


You could also modify the view to not show the Created By/Modified By fields and customize the template to not display those fields, however, if you use mobile SharePoint apps on a tablet or SmartPhone, the fields may still appear.  Using this script, however, the fields' values are either masked or the fields are not shown (at least in the apps I have tried).

Nintex Call Web Service Action is Cool, Part 1.

Nintex'x Call Web Service Action is an incredible powerful tool and helps build an integration between your SharePoint environment and with external systems.  Not only that, it can be used to call SharePoint's web services, which makes it possible for a workflow to add a user to a SharePoint group, start a workflow on another document library, etc.

This post will explain how to configure the workflow action to add a user to a SharePoint group.  I hope this entry will be the first part of many as the Call Web Service Action is a powerful action that I use frequently.

The web service needed is located at http://spsite/_vti_bin/UserGroup.asmx.

 If you are new to web services and SharePoint, go ahead and copy and paste the url into your browser, replacing spsite with your SharePoint site url.  You should see a nice summary of the operations available under the UserGroup webservice.


Below is a screenshot of how I have configured the Call Web Service Action. I will go through how to configure each field.

URL: The location of the web service.  I used my farm account as the user, however you should be okay with any account that has full control over the site.  

Web Method: After the username is entered, you will need to click refresh.  Assuming the account has the correct permissions, the Web method drop down should be enabled allowing you to select AddUserToGroup.

If you leave the editor set to SOAP Builder, you should see a nice list of fields under Web service input.

groupName: The group name that the user is being added to.  I used the inline function fn-XmlEncode to ensure the string will not cause the workflow to error.  For example, the function should change ampersands (&) to the xml code of &amp.

userName:  This is the account ID of the user.  Do not include the domain name.

userLoginName: This is the account ID, but with the prefix of the domain name.

userEmail: The user's email address.

Nintex has a Query User Profile action that can be used to acquire a user's e-mail address.  You'll need to provide the action with the username and you will be able to acquire a number of different attributes stored within the user profile.