Email for a single Role

Discussions about the LSPS expression language.
Forum rules
Make sure every topic contains information about your LSPS version and if relevant also your server OS, client OS, database name and version, and application server name and version.
eric.graham
 
Posts: 58
Joined: Tue May 13, 2014 12:20 pm

Email for a single Role

Wed Dec 31, 2014 11:26 pm

Hello - I have a need where I have a drop down box that populates an list of emails (Role specific). Seeing this is a combo box, and it requires a binding, I am not sure on a couple of things.
I am trying to email one specific email address that is selected in the drop down. (The current way emails all the persons in one specific Role, and does not have the option of choosing an email address). I need instead, to email ONLY the chosen email selected in the drop down box, and then have that be the only person/email, emailed, v.s. the entire Role (meaning everyone that is in that specific Role emailed).

The combo box Binds a Reference<Object>, and the .gobpmn flow has a performer : Set<Performer>. - Currently I am populating the combo box with a:
toList(collect(personsWith(Assigned_Rep()), { p:Person -> new Option(value -> p.email, label -> p.email) })) :: In the Options (List<ui::Option>)

This part is working fine. - The .gobpmn flow was using a {'Assigned_Rep'()} in the performers : Set<Performers> (that is defined in the common.orgmodel). That emails everyone in that Role. - What I need instead is to email ONLY the email selected in the combo box. - I have tried various castings, but unsuccessful. (I may have not cast it properly). - How would I go about this process to email a single email v.s. the entire Role?

Not sure the best way to approach this. I keep getting "Incompatible TypeError" when I am trying to cast to get a specific.email.

Thanks for help in advance!!

Giovanni Rimassa
 
Posts: 7
Joined: Mon Feb 27, 2012 2:52 pm

Re: Email for a single Role

Mon Jan 05, 2015 3:26 pm

Hi Eric,

what you want to achieve is clear, and the expressions you posted make sense, but there are a couple of details missing so that I cannot write an exact solution here:

  • The actual content of the combo box Binding property. What is the referenced object? What type is it?
  • How are you sending the email? Are you using the Standard Library Send Email task? The Standard Library sendEmail() function? Some custom way in your application?
A general comment I can make is to use the person p as a value for the combo box option, and use the email only in the label part (or even a combination of full name and email address, depending on screen real estate):
Code: Select all
toList(collect(personsWith(Assigned_Rep()), { p : Person -> new Option(value -> p, label -> getPersonFullName(p) + #" <" + p.email + #">") }))

This requires that you define a variable as recipient of type Person and set the combo box Binding property to &recipient

I hope this helps: I can also upload a complete example using the Send Email task or sendEmail() function if you want.

Return to Expression language

Who is online

Users browsing this forum: No registered users and 1 guest