Skip to main content
April 29, 2025
Question

How to call integration in interface

  • April 29, 2025
  • 27 replies
  • 0 views

 


t

= a!localVariables(
  local!data: ri!_Requests,
  local!errorMessage: "test",
  local!result,
  local!emails: ri!_Requests.emailAddresses,
  local!integration,
  local!individualMail: if(
    a!isNullOrEmpty(local!emails),
    {},
    reject(
      fn!isnull(_),
      split(local!emails, char(10))
    )
  ),
  local!invalidEmails: substitute(
    tostring(
      reject(
        fn!isnull(_),
        a!forEach(
          items: local!individualMail,
          expression: if(
            regexmatch(
              pattern: "^s[A-Z0-9\_-]+(\.{0,1}[A-Z0-9\+_-]+)*[@]{1}[A-Z0-9.-]*[A-Z0-9-]+[.]{1}[A-Z]{2,6}$",
              searchString: fv!item,
              regexFlags: "si"
            ),
            null,
            fv!index
          )
        )
      )
    ),
    ";",
    ","
  ),
  local!validation: if(
    isnull(local!invalidEmails),
    {},
    "Emails must be in a valid format, and each email must be on a new line. "
  ),
  a!formLayout(
    label: "Request",
    contents: {
      a!sectionLayout(
        contents: {
          a!columnsLayout(
            columns: {
              a!columnLayout(
                contents: {
                  a!boxLayout(
                    label: "",
                    labelSize: "SMALL",
                    contents: {
                   
                      a!paragraphField(
                        label: "Email Addresses",
                        labelPosition: "JUSTIFIED",
                        placeholder: "Email Addresses should be one per line (can be pasted from Excel)",
                        value: local!data.emailAddresses,
                        saveInto: {
                         rule!_bulkgetemployees(
                            "Emails":"test@test.com",
                          ),
                          a!save(local!data.emailAddresses, save!value),
                          a!save(
                            ri!_Requests.emailAddresses,
                            save!value
                          )
                        },
                        refreshAfter: "KEYPRESS",
                        height: "TALL",
                        required: true,
                        requiredMessage: "Email Address is Required",
                        validations:if(
                          (a!isNotNullOrEmpty(local!invalidEmails)),
                          "Emails must be in a valid format, and each email must be on a new line. ",
                          {}
                        )
                      )
                     
                    },
                    style: "#134f5c",
                    marginBelow: "STANDARD"
                  )
                }
              )
            }
          )
        }
      )
    },
    buttons: a!buttonLayout(
      primaryButtons: {
        a!buttonWidget_23r3(
          label: "Submit",
          style: "PRIMARY",
          submit: true,
          validate: true(),
          saveInto: {
            a!save(
              ri!_Requests.requestorName,
              rule!GBL_displayUserFirstLast(loggedInUser())
            ),
            a!save(
              ri!_Requests.requestorEmail,
              loggedInUser()
            ),
            a!save(ri!_Requests.createdOn, now()),
            a!save(
              ri!_Requests.requestStatus,
              cons!_AUDIT_STATUS_TYPES[1]
            ),
            a!save(
              ri!_Requests.requestType,
              cons!_REQUEST_TYPE
            ),
            a!save(ri!_Requests.isActive, true()),
           
          },
          loadingIndicator: true()
        )
      },
      secondaryButtons: {
        a!buttonWidget_23r3(
          label: "Cancel",
          style: "NORMAL",
          submit: true,
          validate: false,
          value: true,
          saveInto: ri!cancel
        )
      }
    )
  )
)




I need validation in such a way that it validates each mail address is in mail format and one mail address per line.
example : "test@test.com"
"test2@test.com"

If there are any errors then throw validation error ,if all email addresses are in mail format then how to pass these mailaddresses to integration where body is

"emails": "test@test.com, test@test.com" and save the response of this mailsaddress in DB 

    27 replies

    yashwantha0914
    April 29, 2025

    Hi [mention:85ca6a2722324ac4b08c9eda0b5e1851:e9ed411860ed4f2ba0265705b8793d05] 

    1) you can call integration object in to the interface using "rule!", example : rule!INT_InterationObject, and pass the data what you want into it, same like working with expression rules.
     
    2) you can use the "People Functions" plugin and use "validateemailaddress" function to validate the email address instead of regex. 

    sabat0002Author
    April 29, 2025

    How can I pass  emailaddresses as  "test@test.com test2@test.com  ....." to the integration because we are entering emailaddresses in single line

    mikes0011
    Brainy
    April 29, 2025
    How can I pass  emailaddresses as  "test@test.com test2@test.com  ....." to the integration

    why not just concat them together with joinArray and a separator of " "?

    konduruc733182
    May 7, 2025

    Hello [mention:85ca6a2722324ac4b08c9eda0b5e1851:e9ed411860ed4f2ba0265705b8793d05] ,

    Could you please check the type of the Rule input that you have configured in the integrations. Does it match to take the inputs that you are passing.

    sabat0002Author
    May 7, 2025

    Hi [mention:2df2892a4df7486f9775b4d2f0e405fd:e9ed411860ed4f2ba0265705b8793d05]  , i will be passing emails like this to the integration . How do I need to pass the interface result to integration in integration obj?








    Getting the below error when trying to type mailaddress in paragraph field .can you please help 

    Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error [evaluation ID = d891f:89f97] : An error occurred while executing a save: Expression evaluation error : An error occurred when creating local!integrationResult. a!save() and smart service functions cannot be used in a local variable unless "refreshAlways" is true for that local variable using the a!refreshVariable() function.


    Getting the below error as well
    Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error [evaluation ID = 288a6:536a3] : An error occurred while executing a save: Expression evaluation error at function a!save [line 145]: Incorrect number of parameters for function; expected 2 parameters, but found 1 parameters.

    konduruc733182
    May 7, 2025

    At the right side you would see an option to configure rule inputs

    docs.appian.com/.../Integration_Object.html