johns
Design Dabbler

StartsWith in SharePoint 2013

Jump to solution

I'm trying to create a validation rule for an input field for a Nintex form and can't figure out how to do it. 

 

Basically, I need the form to validate that the entry either starts with IS0, IS1, GP or BU (for 4 different types of projects). If it doesn't, I want to get an error

 

I've tried to even get a basic StartsWith working as a validation rule, but I can't seem to get it to work. 

I've tried this as a starting point, but it didn't work. 

not(or(startsWith("IS0", {Self})))

Anybody any idea what could be wrong here, and how to extend it out to include the other ID's as above? 

Thanks for your help. 

0 Kudos
Reply
2 Replies
MegaJerk
Automation Master
Automation Master

Re: StartsWith in SharePoint 2013

Jump to solution

As far as I am aware, the 'startsWith' function requires the first argument to be the source text (the text that you wanna check), and the second argument is set to the text you'd like to find

https://help.nintex.com/en-US/nwc/Content/Designer/Functions/startsWith.htm

 

Your formula should look something like:

not((startsWith({Self}, "IS0") || startsWith({Self}, "IS1") || startsWith({Self}, "GP")  || startsWith({Self}, "BU")))

(note: if you're not familiar with the "||" (double pipe) symbol, it just means "or" in javascript and is slightly easier to write out than using the built in or() function provided in the Nintex Form inline functions tab)

To make that slightly more clear, here is each line separated out:

not(
    (
        startsWith({Self}, "IS0") || 
        startsWith({Self}, "IS1") || 
        startsWith({Self}, "GP")  || 
        startsWith({Self}, "BU")
    )
)

 

I hope this helps!

 

 

View solution in original post

0 Kudos
Reply
johns
Design Dabbler

Re: StartsWith in SharePoint 2013

Jump to solution
Thanks for your help - it worked! Interestingly, the SharePoint guide has the 2 the other way around, i.e. "Element" and "String", which was why it wasn't working for me!
0 Kudos
Reply