How to pass value from one interface to another interface ?

Hi,

I have imported interface-1 in interface-2, Interface-1 contains a form with one paragraph box and a submit button (already working, I can put some text in there and hit submit it gets written in the DB), I am trying to pass text from Interface-2 (where I have imported it) and expecting it to save the text in DB as it is already working independently

Please help me with it.

  Discussion posts and replies are publicly visible

Parents Reply
  • You will likely need to map the rule inputs together from the child interface to the parent. For example, suppose you have a rule input for ri!case on the child interface. You will need to create a second rule input to match that on the parent interface and map them together like this:

    rule!ChildInterface(case: ri!case)

    Then, any changes you make in the child interface will also be saved to the parent.

    If this still does not address your question, can you post samples of the two interfaces you have? That can help us understand your scenario and provide the best solution.

Children
  • Here is Interface-2 SAIL :

    a!columnsLayout(
      columns: {
        a!columnLayout(
          contents: {
            a!paragraphField(
              label: "",
              labelPosition: if(ri!readOnly, "ADJACENT", "ABOVE"),
              value: ri!notes.notesMessage,
              saveInto: ri!notes.notesMessage,
              height: "MEDIUM",
              validations: if(
                len(ri!notes.notesMessage) > 2000,
                "Value may not be longer than 2000 characters. You have entered " & len(ri!notes.notesMessage) & " characters.",
                null
              )
            ),
            a!buttonArrayLayout(
              buttons: {
                a!buttonWidget(
                  label: "Submit",
                  icon: "check",
                  saveInto: {
                    a!save(
                      target: ri!notes,
                      value: append(
                        'type!{urn:com:appian:types}Notes'(
                          date: now(),
                          createdBy: loggedInUser(),
                          notesMessageBody: ri!notes.notesMessage
                        )
                      )
                    )
                  },
                  submit: true
                )
              },
              align: "END"
            )
          }
        )
      }
    )

    Interface-1 SAIL:

    {
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!textField(
                label: "INTERFACE - 1",
                labelPosition: "ABOVE",
                saveInto: {},
                refreshAfter: "UNFOCUS",
                required: false,
                readOnly: true,
                disabled: false,
                validations: {}
              ),
              a!paragraphField(
                label: "Interface-1 Content Here...",
                labelPosition: "ABOVE",
                saveInto: {},
                refreshAfter: "UNFOCUS",
                height: "MEDIUM",
                readOnly: true,
                disabled: true,
                validations: {}
              )
            }
          ),
          a!columnLayout(
            contents: {
              a!textField(
                label: "INTERFACE - 2",
                labelPosition: "ABOVE",
                saveInto: {},
                refreshAfter: "UNFOCUS",
                readOnly: true,
                disabled: false,
                validations: {}
              ),
              rule!notes(
                null,null,null
              )
            }
          )
        }
      )
    }

     

  • Hi Shamim,

    As mentioned before, you will need to have the same rule inputs of your child interface in your parent interface in order to be able to do what you want. Once you create those rule inputs in your parent interface, you will need to change the way you call the child interface to use those new variables.

    In Interface 1, you will need to change this

    ...
    rule!notes(
                null,null,null
              )

    to something like this

    ...
    rule!notes(
                ri!notes,ri!readOnly,...
              )

  • I am trying this way :

    rule!notes(
          notes: 'type!{urn:com:appian:types}Notes'(
            date: now(),
            createdBy: loggedInUser(),
            notesMessage: "Sample Input"
          ),
          cancel: ri!cancel,
          readOnly: ri!readOnly
        )

    But it doesn't seem to be working.

    Edit:

    Also, when I move out of paragpaph and press on submit button, text in the paragraph disapears. 

  • Shamim,

    With that approach, you're creating an instance of the Notes CDT and not actually creating a variable in your interface to hold that data for you.

    You'll need to associate your notes parameter to an actual variable: a rule input or a local variable.

  • I tried it with rule input as well, but no luck.

    rule!notes(
          notes: ri!mNotes,
          cancel: ri!cancel,
          readOnly: ri!readOnly
        )

  • Can you elaborate on what isn't working? Is it throwing an error, or is it not saving the data, etc? Also, FWIW I don't believe your button is configured correctly in interface 2 - you have an append() function, but you have only provided one parameter to it. The append requires both the array you'd like to append to and the value to append.

    I would also recommend against using a submit button in a child interface. Usually it's good practice to have your buttons at the top level interface, since then you can set up saving behavior from any part of the interface (or child interfaces). Plus, it will make the form look better to have the buttons at the top level.