= getdistinctusers(topeople(cons!IP_GRP_ALERTS)), a!queryRecordType( recordType: 'recordType!{3a27d5e6-31ce-4fe1-995f-821c7e573c8a}IP Add Details.fields.{7340349a-5cf6-4b92-a093-9d1d261d7be2}candidateMail', fields: 'recordType!{3a27d5e6-31ce-4fe1-995f-821c7e573c8a}IP Add Details.fields.{7340349a-5cf6-4b92-a093-9d1d261d7be2}candidateMail', filters: a!queryFilter( field: 'recordType!{3a27d5e6-31ce-4fe1-995f-821c7e573c8a}IP Add Details.fields.{7340349a-5cf6-4b92-a093-9d1d261d7be2}candidateMail', operator: "=", value: true ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 500) ).data
I am using the send email smart service and i used the "topeople" function to send the email to the group members first and then again i used the "user()" function to return a specific info from a field. Is this the correct way ?
Discussion posts and replies are publicly visible
What do you want to achieve? You are sending an email to a member of the alerts group. Do you also need to include the output of the queryRecord type?
i also want to send an email to a person who is related to the user of the alerts group.
Like to put it short, i have a select candidate button and when i click on it, the recruiter who added the candidate details and the candidate need to get a mail.
so i used the group function in the first line and then i used the user function to retrieve the candidate data.I think i might be doing it wrong so just wanted to verify it.
skzahed_09 said: recruiter who added the candidate details and the candidate need to get a mail.
Just to clarify more,You need to send an email to recruiter and candidate only?Where are you storing recruiter and candidate information?
I would recommend you to use toUser() in both places and combine the result and use that in email recipient.
Shubham Aware said:Where are you storing recruiter and candidate information?
Iam storing the recruiter and candidate value in a record table field and i have separate and unique ID's given to them so i am retrieving the data of the candidates and recruiter from the record table.
I see few issues with this expression. There are two outputs here
1. from expression getdistinctusers(topeople(cons!IP_GRP_ALERTS)),
2. from the query record type
An expression should have one output so you need to concat the results.
Another issue is your field "candidateMail". You are filtering to find records where this field has value as true(). The output of this queryrecord() will be true or null only depending on data. It won't return any username or email address.
So check the query record expression in a separate expression and tweak it until it returns the data you need here. Secondly put a concat outside the two expressions (getdistinctusers() as well as query record output).
Also, if you are passing the constant containing group in it you don't need a topeople() function. getdistinctuser will give the expected output.
As you are sending email to recruiter and candidate we need userId of those or direct emailId of those.Which one do you have?
So i am using this code to retrieve the candidate mail from the candidatemail field so that, the email is sent to the mail address mentioned in the candidatemail field. But i think maybe i might've been wrong so do i need to do something else or add any more code because i am not getting any mail for right now.
Yes there are some issues here! Try to change the code like below and verify what sort of data is in candidateId as well as candidateMail field.
recordtype: should be just the record without any field reference. So update it till 'IP App Details' only.
filters: you are telling the system to query records where candidate is true(). Now by the name I think this field should have the Ids and not boolean values like true() and false(). So instead of true() pass a candidateId here - put any test value from the record here just to verify. later using rule inputs you can pass the candidate ifd from the process into this one. If you have a pv!recruiterId and another pv!candidate id then you can customise the code like below. If you have this expression within process model then use pv variables only else make sure to pass those pv data as rule input in the expression rule configured.
a!queryRecordType( recordType:recordtype!IP Add Details, filters:a!queryfilter( field:recordtype!recordName.candidateId, operator:"in", value:{ri!recruiterId,ri!candidateId} ), pagingInfo:a!pagingInfo(1,5000) ).data
I would suggest to test this expression first in an expression rule until you get desired mail ids as output. Then only related or use it in process model.
So iam a little confused about where am i supposed to create these rule inputs. Should it be in the interface of the select candidate or from where iam retrieving the candidate details ?