Skip to main content
 

Question

 

There might come a time that you don't need to use a workflow and instead just want to create List Items from Smartforms. There are a couple of ways to do this.

 

 




 

Answer

 

#1. Auto Generate Smartforms for the List you are working with. 

 

This is very simple and can be done with a couple click on the K2 Artifact Page. This will generate Views and Forms for the SharePoint list, and you can actually look at how this form is setup to get a better idea of how everything works together. 

 

 

 

12507i9C4BD1D8F3B46544.png

 

 

 

#2. Create the rules yourself using View Method or SmartObject method.

 

Now when we do not want to auto generate forms, we can use a couple of simple rules to Create the List Item. 

 

 

 

A. We need to create a View for the SmartObject. From the Artifact Page select New > View.

 

 

 

B. Make sure we will want to select Item View and that the correct SharePoint List SmartObject is selected for our Data Source. Click Next and this should take us to a blank Layout Designer with Create Labels and Controls and Create Layout Table Only Options. (Selecting the Create Labels and Controls option will automatcially set up rules and controls for the View.)

 

 

 

C. Select Create Layout Table Only.  (For simplicity, we are going to create a very view with minimal details.) 

 

Drag and Drop Fields from the top right Fields box to add these controls. 

 

 

 

13203i553888459E799D31.png

 

 

 

 

 

D. Once we have our fields added, we need to add a button to trigger our save. Click Controls under the Fields quadrant and drag a Button control onto the Canvas. We now have our layout setup correctly.

 

 

 

E. Next, we need to look at rules. Go to the Rules tab and select Add Rule.  This opens the Rule Designer.

 

Event - When a Control on the View raises and Event. (Select our Button for the control.)

 

Action - Then execute a method on the View. (Select the Create List Item Method.)

 

 

 

Now we need to pass our values into the Create List item method. This is as simple as dragging and dropping the controls on the view holding the value into the Input Mappings.

 

 

 

16206i14D78C190E9F4996.png

 

 

 

There might be a reason to return the ID of the List Item in the Output mappings, let's say if you need to use this List ID in a workflow or another form. 

 

 

 

Also, this same behavior can be accomplished on a View not associated with the List by using the Execute a SmartObject Method and selecting our SmartObject. 



 
Be the first to reply!

Reply