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 ) } ) ) )
Discussion posts and replies are publicly visible
Hi ZAINAB 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.
How can I pass emailaddresses as "test@test.com test2@test.com ....." to the integration because we are entering emailaddresses in single line
ZAINAB said: in the " "
does this mean the integration expects a slightly different value from what the local variable holds? can you post some screenshots of the interface's current exact value and the value you're entering in the integration that's working?
Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error [evaluation ID = ab535:440c6] : 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 this error sometime
In case this makes any difference to your integration, these values are separated by a comma but not a space. The values you're created in local!formattedString are separated by a comman AND a space. This could easily make a difference if the integration is not expecting to clean extra spaces between emails.
It is not making any difference .There is some issue calling the integration from the rule .is this correct way to pass the body of the integration? a!save( local!integrationResult, rule!ASR_bulkgetemployees(Emails:local!formattedEmailString), ),with this code i get warning as invalid parameter.
a!save(local!integrationResult,rule!ASR_bulkgetemployees({"Emails":local!formattedEmailString}),),with this code it says Missing keyword syntax
ZAINAB said:is this correct way to pass the body of the integration?
From your screenshot of the integration it looks like it's expecting a JSON object with the property "Emails" followed by the concatenated list of emails. You're just passing in the email list itself. You might wanna verify exaclty what the integration is expecting to consume. You haven't shown what the actual code of the integration is doing so it's, still, hard for me to guess.
integration is expecting list of emails "test1@test.com ,test2@test.com" . when i pass in the mail addresses it return the employee ID of those mails that's it
Please try it with this definition of local!formattedEmailString instead. Here we're preparing your concatted list of email addresses, but then putting it in a dictionary at the "emails" property, and wrapping that up into a JSON string, which it looks like the integration expects (guessing based on your screenshot).
local!formattedEmailString: a!toJson( { emails: joinarray(local!individualEmails, ",") } ),
Modified the code as below and getting the error as Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error [evaluation ID = 307dc:00441] : An error occurred while executing a save: Expression evaluation error at function rule!ASR_bulkgetemployees [line 147]: Rule 'asr_bulkgetemployees' has 2 parameters, but instead passed 1 parameters.
code
a!save( local!integrationResult, rule!ASR_bulkgetemployees(local!formattedEmailString), ),
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).