How to call integration in interface

 


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 

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to ZAINAB

    You still need to call the integration rule with parameterized naming.

    this is how you had it before (correct):

    this is what you're trying now (which will fail for any rule that doesn't have exactly 1 parameter, hence the error message you're getting)

    The fact that we're wrapping the "emails" value in a JSON string that also has the property of "emails" doesn't mean you don't have to use the named parameter when calling the integration rule.  Whether or not the integration is set up to use this or not, is up to its internal code (which you still haven't shared here, but would help a lot if possible).

Children
No Data