<img height="1" width="1" src="https://www.facebook.com/tr?id=730305433807073&amp;ev=PageView &amp;noscript=1">
Book a Demo

Dynamic Forms - Part 7: Setting the “Category” value based on the lead’s position


The last requirement we have in this small use case is to set the “Category” field value to “A – Premium lead” if the “Position” field contains the phrase “CEO.” This makes sense: if we encounter a CEO at a SharePoint conference, we want to make sure to follow up with that lead.

For that purpose, we will use so-called Dynamic values. These are JavaScript-based expressions that are evaluated each time a field on a SharePoint form loses focus.

In our case, we want to set the value of the SharePoint choice field “Category” dynamically. In order to do that, we will use the “Dynamic value expression” setting in the “Values” section of the “Category” field:




Setting the dynamic value of Category field


The expression we are entering here is JavaScript based, with skybow placeholders (values in the double square brackets). It evaluates the value of the “Position” field, converts it to upper case, and checks to see if it contains the expression “CEO.” If it does, it simply returns the value of the choice field we want to set (in our case, “A – Premium lead”).

if ([[Position]].toUpperCase().indexOf('CEO') !== -1) { " A - Premium lead " }

After the changes are saved and the form has been reloaded, each time the phrase “CEO” is entered into the “Position” field, the “Category” choice field is set to “A - Premium lead,” just as our customer wanted:




Behavior of Category field




We have seen how some of the most common customer requirements around forms and fields in SharePoint can be implemented within minutes with skybow Solution Accelerators. This powerful mixture of server and client side configuration options, combined with the skybow expression language, can provide you with a powerful toolset for creating form scenarios whose capacity reaches far beyond standard SharePoint features.  

Wishing you a lot of success in your SharePoint projects!


You want to read the whole story? Click here to get the eBook!

Rich Forms eBook

Adis Jugo

Written by Adis Jugo

is Director of Product Technology at skybow, and a software architect with over 20 years of experience. Adis is double Microsoft MVP (Most Valuable Professional) for Office Development and for Office Servers and Services. He first met SharePoint (and Microsoft CMS server) back in 2002, and since 2006 his focus was completely shifted towards architecture and development of productivity solutions, now based on the Azure, Office 365 and SharePoint technologies. Adis is an internationally recognized speaker with over 15 years of speaker experience, speaking at various Microsoft, Community and SharePoint/Office 365/Azure conferences worldwide.