Requirement is I will be entering emailaddresses on UI and it will be passed to the integration and the integration will return the emailAddresses with GUIDs . If any emailaddress is missing from the response which we entered then it must show that emailaddress on UI. Suppose I have passed test@test.com and test2@test.com and In repsonsed I get only GUID of only one emailaddress then it has to show the 2nd emailaddress on the UI as invalid error . How Can I achieve it
Discussion posts and replies are publicly visible
a!forEach( pv!jsonPv, if( contains(pv!emailPv, fv!item.emailAddress), {}, "This one is invalid: " & fv!item.emailAddress ) )
Seems like integration type is "get". If Yes, i don't think you need extra process instance. you can call the integration in your interface and you can do the similar calculation as Mike mentioned above to search the output.
Mike Schmitt It is filtering correct emailaddress instead id incorrect emails .In API response i will get GUIDs of correct emailaddress . I need to show the one's without GUIDs on UI
Then you can replace the code in line 4 to check for any condition you need. I'm not exactly sure what you're saying you need, without some more detailed context and/or example outputs and logic, but it should be pretty simple to check each return line item for any condition you want and filter what you need it to.
So in this case you simply need to adjust where and how you filter. Assuming you have access to the original list of email addresses as well as the API response, you simply iterate through all original email addresses and check whether that address was mentioned in the API response values, and if not, return it as an "invalid" one.
a!localVariables( local!initialEmailAddressList: { "test1@test.com", "test2@test.com", "testInvalid@test.com", "test3@test.com" }, local!simulatedApiFeedback: { a!map( email: "test1@test.com", uuid: "asdf1234QWER" ), a!map( email: "test2@test.com", uuid: "asdf1234QWER" ), a!map( email: "test3@test.com", uuid: "asdf1234QWER" ) }, /* get any invalid email addresses by comparing the original list with the API feedback list */ a!flatten(a!forEach( local!initialEmailAddressList, if( contains( local!simulatedApiFeedback.email, fv!item ), {}, fv!item ) )) )
a!flatten(a!forEach( pv!EmailPV, ---TEXT FIELD if( contains( pv!JsonPv, fv!item ), --JSONPV -- MAP {}, fv!item )))
Getting the below error in script task .can you please help
ZAINAB said:contains( pv!JsonPv, fv!item ),
Why would "pv!JsonPv" contain the email address? pv!JsonPv is a map, not a string. Did you try "contains(pv!JsonPv.emailAddress, fv!item)"? My example code above clearly showed that the "contains()" call should check the list of map properties, not the map itself.
I tried it but it is showing correct emails also in invalidemails
You should create it as an Expression Rule (that you will then call from your process script task) and recreate the inputs and test it - that's far easier than trying it directly in a process and struggling to understand why it fails in a running process.
Feel free to post the code and your test input values here if you have a hard time getting it working.