<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.


Posted by Adis Jugo - 08 September, 2016


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

Topics: Dynamic Forms

Recent Posts

9 Hidden Costs of Power Platform

read more

Do you already work modern? (Part 5 of 5)

read more

5 years skybow - what a journey

read more