​​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:

  1. Open the form in design mode.
  2. Press on Auto Populate icon in the View Group in the Form Ribbon.
  3. Add the following to the form design workspace:
    How to add item to another list1.jpg
  4. Select btnAddState control.
  5. In the Rules pane, click on the Add icon to add a new rule, the Rule Manager dialog will open.
    How to auto-shifting Panel control in a form2.jpg
  6. 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.
  7. Publish the form by clicking on the Publish button in Publishing Group in the Form Ribbon.
  8. Test the form by clicking on an existing item in the list.

Related Resources:
These resources may not reflect the same exact case steps.