Nintex form validation for a choice field where multiple choices can be made – resulting in a required field

This will make it where if any of the three options are chosen with any other option it will make that field required.

Replace Options with the name control of the field. Use this rule on the field you want to be validated.

Nintex Forms for Office 365

or(contains(Options, ‘Option 1’), or(contains(Options, ‘Option 2’), contains(Options, ‘Option 3’))) && {Self} ==””
Advertisements
Nintex form validation for a choice field where multiple choices can be made – resulting in a required field

Require a user to view an attachment before submitting a Nintex Form

 

This is based off a solution I answered on Nintex’s community site. This is just one way of doing it, I’m sure there are others.

 

  • Make a hidden field and give it a JS variable name of “Read”
  • Create a validation rule that it cannot be empty, if empty “You must read the attachment above before submitting”
  • On the hidden field, add custom CSS to hide it, you can’t set the field visible = no in Field settings, the JS wont work if it’s hidden that way. Must use CSS.
    • To do this, open form settings – custom CSS – add code below. Then on the hidden field, put “nf-hidden” as the CSS class
    • .nf-hidden{        visibility: hidden !important;}
  • Create a JS button hyperlink (or really any will work, depends how you want it to look)
    1. Give it a label of “Must Read this Attachment Before Submitting”
    2. Under advanced section, add the following JS to the Client Click Replace google with the link to your attachment
      NWF$(document).ready(function(){      AttachmentRead();  }); window.open(“https://www.google.com“);

      This will call the custom JS in the form setting and also open a link to your attachment

  • In the custom JS under form settings add this codeNintex Forms for Office 365

    This is the custom function that adds “Read” to the hidden field allowing the form to be submitted after the link opens.

    function AttachmentRead () {
    NWF$(‘#’ + Read).val(“Read”);
    }

     

 

Require a user to view an attachment before submitting a Nintex Form

Link a Nintex Task URL to a SharePoint List

I’ve seen this question asked multiple times on Nintex’s community site. From my experience working with On Prem Nintex, I knew that this could be done… but I was curious if it was possible in o365 Nintex. With the addtion of Task IDs being added from a recent update, it now is! It’s also really easy. Here’s how to do it.

  • In your target list, create a Hyperlink column and name it whatever you’d like.
  • Create an int variable for the Task ID (This is at the bottom of the Assign a Task Action

  • Create a build string action and use the static URL to tasks on the task list.

Change “Workflow%20Tasks” if you’ve renamed it to something else, but that one is default. Set the ID = to the name of the variable above. Add a “,” after and whatever you put next will be the name of the link

  • Use a “Create List Item” Or an “Update List item” action to write the URL (varTaskLink above) to the target list

  • Target list now has URL to task

Link a Nintex Task URL to a SharePoint List

Remove Duplicate and/or Orphaned Workflow Menu Items

This is another one of those posts that I just have to blog about because I feel like I will run into this same issue again sometime. I created a workflow using Nintex Workflow Enterprise. There’s an option in the workflow settings to “Enable workflow to start from the item menu” This is very useful because users can manually run this workflow from the item menu when they want to accomplish something. Examples that I have used this for are:

  • End all workflows and delete current item from the list
  • Archive a document

In the case of the Archive Document workflow that I created, which just moves a document to a separate doc library and deletes the original.When I enabled the option to have the custom workflow action in the menu, it somehow created a duplicate… so I now had two options called “Archive Document” when I only needed one.

How could this happen to me!? Of course it happened to me… Okay, so why did this happen?

Nintex listed two potential possibilities:

  1. Duplicate item: The workflow was imported from another environment/site/list multiple times with the menu item enabled.
  2. Orphaned item: The workflow was deleted without first disabling the menu item in Workflow Settings.

The weird part is that neither one of these actually applied to me. The duplication occurred as soon as I published the workflow for the first time. This was an original workflow on it’s own list with no other workflows present.

Let’s fix this thing!

From the research I’ve gathered over at Nintex it seems that there are two main ways to resolve this.

  1. PowerShell (of course!)
  2. SharePoint Designer (of course!)

I actually had a lot of trouble finding this option in SPD.. mainly because my SPD was opening this list in 2010 as opposed to 2013? Uhhhh… This is a new one (will have to figure this one out later) So let’s use the method our best friend would use.. PowerShell

Here is the code from Nintex

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

$($($(New-Object -TypeName Microsoft.SharePoint.SPSite('http://WebURL')).OpenWeb()).lists['ListTitle'].UserCustomActions)

Once you have run the above script, you can target the menu item by its index and delete it by running the below snippet:

$($($(New-Object -TypeName Microsoft.SharePoint.SPSite('http://WebURL')).OpenWeb()).lists['ListTitle'].UserCustomActions[0]).Delete()

I ran into a weird issue with this code. Pulling the custom action wasn’t a problem, it shows the one custom action that I had on this list with a sequence of [0] (and I say one, because I removed one entry from the duplicates by disabling the workflow settings option)

OrphanedItemsPowershell1

The problem came when I tried to the delete it…

OrphanedItemsPowershell2

Null? It’s right there! So since it was the only custom action item showing… I removed the [0] and told it to delete them all (just the one)

OrphanedItemsPowershell

I then reran the original code to see if the custom action would show… nothing showed up! So I checked my list and sure enough it was gone. AHHHHHHHHHHHH Yeah!

 

I hope this helps someone else! Happy Nintexing

Remove Duplicate and/or Orphaned Workflow Menu Items

Formatting an HTML Email with List Items using Nintex “Call web service”

There are a few to many different ways to accomplish this, and I assume as long as you know how to use a Web Service, you can somewhat figure out how to do the same thing as what I’m about to show you even if you don’t own Nintex. I’ve always wanted to be able to do this and had some requirements given to me that required it. It took a lot of research and I combined a few different ways noted by other bloggers. I also had to research and find some specifics for myself. Hopefully this will help someone out.

Call web service

So, what you are going to want to do is…

  • Create a site workflow in Nintex.
  • Add a “Call web service” action
  • In the URL add, “Web URL/_vti_bin/Lists.asmx”
  • For the UN and PW – Use an account that has administrative rights and a non-expiring pw/account
  • Click “Refresh”
  • Web method drop down should’ve populated. Select – “GetListItems”
  • Change the editor mode to “SOAP editor” – I haven’t had much luck with the “SOAP Builder”
  • Copy/Paste this into the SOAP Editor (minus the “1.”)
    1. <?xml version=”1.0″ encoding=”utf-8″?>
      <soap:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/&#8221; xmlns:m=”http://schemas.microsoft.com/sharepoint/soap/”&gt;
      <soap:Header>
      </soap:Header>
      <soap:Body>
      <m:GetListItems>
      <m:listName></m:listName>
      <m:viewName></m:viewName>
      <m:query></m:query>
      <m:viewFields>
      <ViewFields />
      </m:viewFields>
      <m:rowLimit>0</m:rowLimit>
      <m:queryOptions>
      <QueryOptions />
      </m:queryOptions>
      <m:webID></m:webID>
      </m:GetListItems>
      </soap:Body>
      </soap:Envelope>
  • Get the List GUID and View GUID (very important to use the view guid, I’ll explain why later) – add the List GUID to “<m:listName></m:listName>” and the View GUID to “<m:viewName></m:viewName>”
    1. You can get the List GUID by going to https://yoursite/subsite/_layouts/15/mcontent.aspx and copy the link to the list. The GUID will look something like this – {566B8721-4A1F-4824-A74F-63AF34B81D0A}
    2. You can get the View GUID by using an awesome View ID “decryptor” – follow the instructions at this site. – the View ID is in the same format as the List ID
  • Now that we all all of that in place, lets select Run Now at the top and see if we can pull some results.

RunNow

c1

  • Awesome! We have results returned! Now we need to create a Multi-line Variable and name it whatever you want. This is where we are going to store the XML we just asked for. (Hint : In the results portion, copy the XML to Notepad++ (set to XML) so we can reference it later)
  • Now we are going to transform it! The fun part, right!? Go back to the main window for the Call Web Service and at the bottom is a section for Web service output. For “Store result in” click the drop-down and select your newly created Multi-line Variable. In my case it’s “testResult” – Make sure you also select “Force top level XML node” this will surround the results with root node XML.

XMLOutput

So this next part was taken by a Nintex blogger that I reference a lot, http://www.vadimtabakman.com – His site is currently down, so I can’t link directly to the post I referenced, but it’s an amazing source for cool Nintex things you want to do.

  • In the XSL transform section. Add this : (Remove anything in red)
  • <?xml version=”1.0″?>
    <xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSL/Transform&#8221; version=”1.0″>
    <xsl:output indent=”no” method=”html”/><xsl:template match=”/” name=”ShowVariables”>
    <html>
    <body>
    <h2>Monthly Draw Donations</h2> Table header, change to whatever you want
    <table border=”1″>
    <tr bgcolor=”#4da6ff”>
    <th>Name</th> Columns for your table, name them to reflect the xsl:value below
    <th>Staff Title</th> Columns for your table, name them to reflect the xsl:value below
    <th>Contribution Option</th> Columns for your table, name them to reflect the xsl:value below (to created)
    <th>Payroll Deduction Option</th>
    <th>Monthly Amount</th>
    <th>US Citizen?</th>
    <th>Authorized?</th>
    <th>Created</th>
    </tr>
    <xsl:for-each select=”//*[name()=’z:row’]”> This will select every row in the VIEW
    <xsl:sort select=”@ows_Created_x0020_Date” order=”descending”/> Sorts list items (needs to be before xsl:if statement)
    <xsl:if test=”@ows_DrawChoice = ‘Monthly'”> xsl:if test = (this is filtering the table data to only show users who selected Monthly as their draw choice)
    <tr>
    <td>
    <xsl:value-of select=”@ows_ReportName”/> The @ows_ comes for the XML we queried and copied to NP++
    </td>
    <td>
    <xsl:value-of select=”@ows_StaffTitle”/>
    </td>
    <td>
    <xsl:value-of select=”@ows_ContributionOption”/>
    </td>
    <td>
    <xsl:value-of select=”@ows_DrawChoice”/>
    </td>
    <td>$<xsl:value-of select=”format-number(@ows_DrawDeduction,’#,###.00′)”/></td> Formats to show as $0,000.00
    <td>
    <xsl:value-of select=”@ows_ReportCitizen”/>
    </td>
    <td>
    <xsl:value-of select=”@ows_ReportAuthorize”/>
    </td>
    <td>
    <xsl:value-of select=”@ows_ReportCreated”/>
    </td>
    </tr>
    </xsl:if> End of if
    </xsl:for-each> End of for-each
    </table>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

final

I spent forever trying to figure out how to format the output to only show data from the last week. I browsed everything I could related to xslt – xsl:choose/xsl:if – I couldn’t find anything! Then it hit me… the web service asks for a view ID – it’s easy to only show a weeks worth of data in SharePoint! I’ll filter the view! So I edit the view and change the filter for the “Created” field to be “is greater than or equal to” “[Today]-7” – AWWWWW YEAH! The view is only showing today – 7 days. But will the HTML table show only the data from the view? You bet it does! The query will only pull what it can see on the view. Damn… that was easy.

Ok back to the tutorial…

  • Now that your view is set up and you have your HTML/XSLT formatted. Let’s add the output variable to a notification. Obviously replace “me” with whomever needs the report. But that’s all you need, just add the variable. You can also make new/separate calls and put them in their own variables. Just add those to the email as well and it will create multiple tables.

notification

Here is an example of the email report with multiple web calls used(sorry I had to block some of the stuff out… probably took me longer to do this than to make dummy data) Looks stupid, but you get the idea! :

c2

Let me know if you have any questions or find a better way to do something!

Formatting an HTML Email with List Items using Nintex “Call web service”

Find out if a field is being used anywhere in your farm

Hello World!

I was recently tasked with a weird one. When trying to enable the “Video and Rich Media” site collection feature, I got this error :

Sorry

This error can occur when you migrate data from one location (that has Video and Rich Media enabled) to another location (that does not have Video and Rich Media enabled). I would assume that this can occur when any site collection feature.

When you enable a site collection feature, you are adding extra content to that site collection (i.e. document libraries, content types, site columns, etc). So when you move a site from one location to another, you bring that extra content with it, because it thinks it needs it in order to function. SharePoint obviously doesn’t like that. It would be nice if SharePoint would throw an error during the migration, letting you know you can import a site because a feature is missing. In our case, it didn’t do this.

 

The Discovery!

I was curious if any other site collection had this issue as well, so instead of trying to go to each HNSC and try to enable Video and Rich Media, I came up with this script to check for it.

foreach($site in Get-SPWebApplication “WEB App URL” | Get-SPSite -Limit All)
{
Echo $site.URL
($site | get-spweb -limit all).fields | ? {$_.ID -eq “2de1df7b-48e1-4c8e-be0f-f00e504b9948”} | ft id, scope
}

This is how the output looks

VaRMPS

If you look at the “Scope” column, if you only see “/ ” – this means that the feature is not being used anywhere in that site collection. If you see a subsite, such as /fst/pd and /TAAR like you see here, this means that both of these sites use it.

 

The Fix!

You must :

  1. export the site fully
  2. delete the site
  3. enable Video and Rich Media at the site collection level
  4. then import the site back

After that, you should be able to freely enable/disable the site collection feature.

Good luck!

Find out if a field is being used anywhere in your farm

Custom Bginfo for SharePoint Admins

So recently I found myself needing to check each of my servers to remember the hardware specs we were using for those environments. I remembered in the past that I used an awesome application that displays this information on the desktop. Bginfo.exe. It’s a must use tool for any administrator, you can customize a lot of things! It also really helps to distinguish between the different environments you are logging into… that way we don’t accidentally apply something to the wrong environment. I know first hand this can happen when you have so many servers open and you’re switching between them.

Now, in this post, I won’t show you how to install/use Bginfo, as there are plenty of guides online. I will show you some custom WMI queries that I use to show some important SharePoint information that I’m looking for, and I hope this will help you.

 

Here is an example of how mine is set up. I’ve had to block out some information

 

Bginfo2Bginfo

Default Bginfo Fields

  • Host Name
  • User Name
  • Boot Time
  • IP Address
  • CPU
  • Memory
  • Free Space

SharePoint 2013 Registry Fields

  • CA URL

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS\CentralAdministrationURL

  • SP Build Version

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\15.0\BuildVersion

SharePoint 2013 WMI Queries

When I login to a server, I want to know right away whether these services are running or not. This is an APP server, so Search runs on this one, but AppFabric Cache does not.

  • SPTimerV4

SELECT State FROM Win32_Service Where Name =’SPTimerV4′

  • SPAdminV4

SELECT State FROM Win32_Service Where Name =’SPAdminV4′

  • SPSearch

SELECT State FROM Win32_Service Where Name =’OSearch15′

  • SPSearchHost

SELECT State FROM Win32_Service Where Name =’SPSearchHostController’

  • UPS

SELECT State FROM Win32_Service Where Name =’ProfSvc’

  • W3SVC

SELECT State FROM Win32_Service Where Name =’W3SVC’

 

And there you have it! I also color code each of my different environments

  • Development = Green
  • User Acceptance Testing = Yellow
  • Production = Red

Fairly simple stuff, let me know if you have any other useful ones!

Custom Bginfo for SharePoint Admins