How to add item to another list?
Last Update: June 22, 2018
In this scenario, we will describe how to add item to a list named "States" from within "Countries" list. Here are the steps on how to do that:
- Open the form in
design mode.
- Press on Auto Populate icon in the View Group in the Form Ribbon.
- Add the following to the form design workspace:

- Select btnAddState control.
- In the
Rules pane, click on the Add icon to add a new rule, the
Rule Manager dialog will open.

- Add a new rule as follows:
A. Update the
Rule Name as desired.
B. Change the
Rule Type to Action.
C. Change the
Event Type to onClick.
D. In the
Action section, type the following script:
var status = newListItem('/', 'State', ['StateCode', 'StateName', 'CountryCode'],
[getValue(txtStateCode1), getValue(txtStateName1), getValue(txtSCountryCode)])
if (status == true){
alert('The item has been added successfully')
}
//where StateCode, StateName and CountryCode are the internal names in the States list
E. Click on the
Save button to save the rule.
Note: You can use
Assistance Panel to help you adding functions and related parameters, form variables and form controls to
Conditions and/or
Actions sections. - Publish the form by clicking on the Publish button in Publishing Group in the Form Ribbon.
- Test the form by clicking on an existing item in the list.
Related Resources:
These resources may not reflect the same exact case steps.
https://www.youtube.com/embed/8ckDRORV3gQ