+44(0)1908 545 770
YOUR EXPERT RPA PARTNER

Team up with our RPA strategy and tech specialists for maximum automation impact

Find out more
Harness the power of UiPath in your business.
WATCH NOW

Save money and spend more time on priority work.

Book consultation
READY, SET, AUTOMATE

Let's choose, design and deploy a process automation solution for your business.

Find out more
TRANSFORM YOUR BUSINESS

Let's analyse your business to discover opportunities for innovation and automation.

Find out more

Begin your business transformation journey

Book consultation
AUTOMATE EVERY FUNCTION

Automate where it matters most. Scale to solve challenges in every area

Find out more
GIVE EVERY TEAM THE TOOLS FOR SUCCESS

Equip people with user-friendly solutions that save time and make work easier

Find out more

Which business problem
can we solve first?

Book consultation
04 December 2014

Using different save techniques on a K2 SmartForms List Display

When using a list display and giving the user the functionality to add multiple entries, deciding whether to save the data on add or execute a batch save depends mainly on a combination of business rules and personal preference of the developer. With K2 SmartForms these two approaches differ only in the rule specification.

Once you have created your K2 SmartObject, make sure you have at least one list method associated with this SmartObject. It can either be the default list method created by K2 or your own custom SQL Stored Procedure returning a selection of data.

Now, create a new K2 SmartForms View. Give it a descriptive name and choose “List View” under the “View Type” section. Next choose your SmartObject and select your chosen list method from the dropdown selection.

K2 Automated Testing Software

BenchQA allows full test automation of K2, including fully automated K2 SmartForms and K2 Workflow testing. It promotes test driven development for K2 and ensures continued quality assurance for K2 solutions. Easily apply changes to test cases to accommodate changes to K2 apps and ensure all apps are regression tested to avoid defects and assure continuous quality.

 

Free K2 Five Upgrade Review

K2 SmartForm List - Save Techniques K2 List - 1

K2 SmartForm List – Save Techniques K2 List – 1

To generate your list, click on the “Generate Labels and Controls” link and choose the fields from your K2 SmartObject you want displayed. If you scroll down to the “Edit Options” section, enable list editing and set your preferences.

K2 SmartForm List - Save Techniques - Create Labels and Controls - 2

K2 SmartForm List – Save Techniques – Create Labels and Controls – 2

To save the data on add, you need to add an additional rule to the default “List item added” rule generated by K2. Add the “Execute a method for items that have been changed” action and set up the action to execute the “Create” method for all items that have been added. In the rule configuration use your original K2 SmartObject properties for the input mappings.

K2 SmartForm List - Save Techniques - Rule configuration - 3

K2 SmartForm List – Save Techniques – Rule configuration – 3

To do a batch save for all rows added to the list, you need to add an action after your save event (eg. button click). Then, exactly like the action added for the save on add scenario, select the “Execute a method for items that have been changed” action and set up the rule to execute the create method for all items that have been added. In the rule configuration use your original K2 SmartObject properties for the input mappings.

K2 SmartForm List - Save Techniques - Save configuration - 4

K2 SmartForm List – Save Techniques – Save configuration – 4

The create method you choose when setting up your action can, like the list method, be the default method supplied by K2 or your own custom SQL Stored Procedure.

The exact same approach can be used to update and save entries that have been edited by adding the same actions and setting it up to execute the update method for all items that have been edited.

Need further technical advice or support?