The service “SetFieldProperties” is used to set or update properties of the any field. This could be accomplished by determining the value in a datasource and dynamically setting the field from the field on the webpart canvas, but it can be helpful to this in a process canvas and with the SetFieldProperties service since it gives you access to a process canvas before setting the property. This service can be used where we are required to hide fields, change CSS, change verbiage, etc. A single SetFieldProperties service can set multiple field properties by adding additional fields.
SetFieldProperties Use Examples
Basic SetFieldProperties Use
In this webpage we have a button called “Save”. This button has a process which uses the “SetFieldProperties” service to Disable the fields after updating them in database.
Here’s a closer look at the “SetFieldProperties” service inputs. In this example we are using “SetFieldProperties” to disable the fields after on clicking the save button.
We can right click on fields tab to add multiple fields to set their properties. Once we add a field, we should pass field’s name into “FieldName” input, the property we would like to set into “PropertyName” input, and the value we would like to set into “PropertyValue” input.
We can use the recommended values at the side to help select a field. This list is populated from the fields on the webpart canvas.
Once clicked into the PropertyName, and after a FieldName has been entered, the properties should populate based on the field chosen.
On the left side we have the fields disabled (Grayed out) after the service ran. On the right side we have output logs. In the output we have field name, property name, property value and row index of the field. Notice that we get separate nodes for each of the fields we added in inputs.
Using SetFieldProperties Service to Set Error Message After Validating Login Credentials
In this example, users can turn on the edit mode by logging in with their credentials and clicking the “Turn on edit mode” button. On the page, we have a field for “User Name”, “Password”, and there is another field named “Message”. Initially the “Message” fields’ text is set to blank. In the button process we are validating the credentials using the “Binary Decision” service. If the credentials are wrong and the Binary Decision service fails, we set error message as “Message” fields’ text.
Here’s what the SetFieldProperties service in this process looks like:
Notice that the “Property Value” is a static message. We could have set this to be a variable referencing another service output from the process canvas, but in this case it is not needed.
When we add any field in the SetFieldProperties service, and click on the “PropertyName” input, we can see the properties that we can set using this service under Recommended Values section on the right side. Also, we can drag and drop these into “PropertyName” input area.
In the example above we used a Label field. Therefore we can see all the properties associated with Label field on the right side
This is how it looks on the page once the setFieldProperty runs.
SetFieldProperties with Child WebParts
In this example we have two child webparts “WebPart’” and “WebPart1” with fields Name, Email and phone in both of them. In the “SetUsers” button we have a process which uses the service “SetFieldProperties” to set the field values in child webparts. Here’s a closer look at the service inputs.
Note: If the input “WebPartId” is left blank, the service looks for the field in the main webpart and sets the property.
SetFieldProperties with a List Section
SetFieldProperties has an input called RowIndex which allows us to target specific row in a list section to set its property. If there is a list section and a specific line on that list section needs a value changed, that can be accomplished by finding out the row index of the desired line. EASYProcess List Section Rows index starts at 0.
If the row index is left blank and the field we are trying to set is in a list section, by default the service sets value to all the rows.
This feature can be used for more complex examples, but below we are going to create a test list section and using this feature change a value on the desired row.
In this example we have created a list section of users for the site. Above the list section is a text box where we can type the row we wish to target. We will be changing the “Active” column to either “Yes” or “No” by selecting a value from the radio button.
The row number entered corresponds to a row in the list section. Clicking the “Set User” button targets that row of the list section and changes the “Active/Inactive” status of the row. Here is the process canvas for this action:
If we take a closer look at the SetFieldProperties service configuration, you can see the inputs which are accomplishing this.
Since EASYProcess List Section Rows index starts at 0, the first row is represented by 0. We are using “$EP_Field_Row - 1” to target the correct row. If we want to change the second row, the user will type in “2”. The button process will take the “2” and subtract 1 to give us the value “1”. The 1 row index will then target the second row in the list section.
If the row index were left blank, since the field we are trying to set property is in a list section, by default the service sets value to all the rows.
When we type in the value “1”, the our button process will set the value in the first row with index “0”. Here are the SetFieldProperties service logs for this:
Notice that we have left the input “WebpartId” blank and we can see that it defaults to the webpartId of the Webpart from which we’re running this service.