Get operator email addresses in record extension point script

Any issue about Cyclos 4 scripting and Webservices

Moderators: rmvanarkel, hugo, alexandre

Post Reply
CreditCircuit
Posts: 11
Joined: Wed May 09, 2018 4:45 pm

Get operator email addresses in record extension point script

Post by CreditCircuit »

Dear Cyclos team,

We're writing an extension point script that sends an email to a user and all its operators upon creating certain records. Which class/method can we use to access a user account's operator's email addresses?

We access user account and user email as follows from within record extension point script:

UserRecord userRecord = entityManagerHandler.find(UserRecord, record.id)
Set<UserAccount> accounts = userRecord.getUser().getAccounts()
Iterator<UserAccount> iterator = accounts.iterator()
UserAccount element = iterator.next()
def toEmail = element.getBasicUser().getEmail()


Many thanks.

Kind Regards
Roan
CreditCircuit
Posts: 11
Joined: Wed May 09, 2018 4:45 pm

Re: Get operator email addresses in record extension point script

Post by CreditCircuit »

We solved this using operatorService:

List<Operator> list = operatorService.list(user)

list.each { oper ->

toEmail = oper.getEmail()

}
Post Reply