Friday, December 15, 2017

Managed Metadata multi-select values in SharePoint Designer Workflow

Scenario
  • You wish to use the values in a multi-select managed metadata field in your SharePoint Designer 2010 or 2013 workflow
Issue
  • Sometimes the workflow will fail when too many items are selected
    • Ex: the term names plus GUIDs exceed 255 characters in the item / fieldname_0 results
  • HTTP 500 Error in Workflow Information screen on 2013 workflows:
    • RequestorId: GUID. Details: System.ApplicationException: HTTP 500 {"Transfer-Encoding":["chunked"],"X-SharePointHealthScore":["0"],"SPClientServiceRequestDuration":["30"],"SPRequestGuid":["GUID"],"request-id":["GUID"],"X-FRAME-OPTIONS":["SAMEORIGIN"],"MicrosoftSharePointTeamServices":["15.0.0.4667"],"X-Content-Type-Options":["nosniff"],"X-MS-InvokeApp":["1; RequireReadOnly"],"Cache-Control":["max-age=0, private"],"Date":["Fri, 15 Dec 2017 22:29:51 GMT"],"Server":["Microsoft-IIS\/8.0"],"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)
Resolution
  • The list item field with _0 after it does support selections over 255 characters, but many Workflow Actions do not support fields larger than 255 characters.
    • You cannot:
      • Log to History List
      • Set Workflow Variable of any types except "Multiple lines of text"
        • "Multiple lines of text" is only available from "Initiation Form" parameters
    • You can:
      • Email text
      • Use "contains" operator in an If statement
    • I have not gone further in my testing than the above, so please comment on any other actions you identify as working or not working.

Monday, November 20, 2017

Deploy JavaScript to a Site Collection or Web in Office 365 or On Premises + Dynamic Navigation Link

Scenario
  • You have some JavaScript you'd like to inject into a page and want the simplest method of deploying it to all pages within a Site Collection or Web.
Issue
  • You can do this via custom master pages, but then you break any future upgrades from Microsoft
  • You can also do this via a Sandbox code solution, SharePoint Framework, or a SharePoint Add-In, but these are all overly complex for this simple task and may not work in some environments due to incorrect environment configurations
Resolution
  • The simplest, fully supported way to do this is via a User Custom Action ScriptLink
  • John Liu has a nice UI tool to simplify registering your code with each site/site collection
Example
  • The following code example injects simple Javascript into each page to add a dynamic link to the left navigation menu (quick launch)
  • I like to put these in Site Assets at the Site Collection root.  If you don't have a Site Assets library, you can create one by opening the site in SharePoint Designer and double clicking the Site Assets link.  You can also do this by enabling any feature that utilizes the Site Assets library.  Otherwise, you can use a different library that everyone can read from.
  • You will need the following 3 files.  These should be saved into the Site Assets library at the site collection root site.
$(document).ready(function(){ 
 //Fixes Chrome Scrolling problem and load of ECMAScript 
 if (typeof(_spBodyOnLoadWrapper) !== 'undefined'){
     _spBodyOnLoadWrapper(); 
     
    console.log('test');
 MenuLastLI = $('#zz14_RootAspMenu li:last');
 MenuLastLI.before('
<li class="static"><a class="static menu-item ms-core-listMenu-item ms-displayInline ms-navedit-linkNode" href="http://www.votematrix.com/"><span class="additional-background ms-navedit-flyoutArrow"><span class="menu-item-text">CUSTOM LINK</span></span></a></li>
');
 }; });
  • Click to open John Liu's configuration page (configure-page.aspx)
  • Configure jQuery as Sequence 900 (so it loads first).  Install Site Collection.
  • Configure JSTest.js as Sequence 2000 (Loads after jQuery)
  • That's it.  The link should show on the left nav.

Tuesday, April 18, 2017

SharePoint 2016 Topology Planning

Scenario
  • You are architecting an on-premises SharePoint 2016 Server Farm infrastructure deployment.
Steps
  • If this is an upgrade, make sure you know what features were depricated
  • Determine your server license requirements
  • Determine if you need a scripted install or wizard install
    • Scripted
      • Utilize AutoSPInstaller (open source project) to create reusable installation scripts for easier re-provisioning of servers for multiple environments and disaster recovery scenarios
      • More time to setup and initially more error-prone with greater possibility of misconfiguration and typos
    • Wizard
      • Simplified interface and best support from MS
      • You should document in OneNote all settings chosen so you can reproduce exactly
  • Determine if you can use MinRoles and decide which roles to use for which servers and how many servers you need
    • MinRoles provide best practice configurations, are better supported by Microsoft, and are easier to redeploy using the wizard
    • MinRoles cannot be used in certain large and specialized farm configurations
    • Decide how many servers you need based on projected load and high availability requirements
    • Decide which roles to use by reviewing them here: Technet - MinRole Planning
  • Design SharePoint server topology using the roles and number of servers decided earlier
  • Design SQL, Workflow Manager, and Office Online (previously Office Web Apps) server configurations