Hello,
( sorry if it is too long ).
I would like to create a process which sends an email to all managers belonging to different OBS units in IT Department containing the list of resources who have not completed their timesheet + the related time periods.
First, I wrote a query to select all the managers that I needed and the result is stored in var= "result3".
Then I wrote this:
<core:forEach items="${result3.rowsByIndex}" trim="true" var="mng">
<core:set value="${mng[0]}" var="userid"/>
<core:set value="${mng[1]}" var="ManagerLastName"/>
<core:set value="${mng[2]}" var="ManagerFirstName"/>
<core:set value="${mng[3]}" var="ManagerEmail"/>
<core:set value="${mng[4]}" var="idManager"/>
<gel:log> manager ${mng[1]} </gel:log>
Next I selected all the resources who did not compile their timesheet and the result is stored in result2.
and this is the last part:
<core:forEach items="${result2.rowsByIndex}" trim="true" var="tms">
<core:set value="${tms[0]}" var="id_risorse"/>
<core:set value="${tms[1]}" var="Full_Name"/>
<core:set value="${tms[2]}" var="Email"/>
<core:set value="${tms[3]}" var="Time_Period"/>
<core:set value="${tms[4]}" var="Prid"/>
<core:set value="${tms[5]}" var="MANAGER_ID"/>
<gel:log> Risorsa: ${tms[1]} periodo: "${tms[3]}"</gel:log>
<gel:email from="clarity@mediobanca.it"
subject="MISSING TIMESHEET: ${tms[3]}"
to="${mng[3]}">
( Here is the CONTENT OF EMAIL: Here is the list of resources who .......
Resource: ${tms[1]}, id= "${tms[0]}"
</gel:email>
</core:forEach>
</core:forEach>
</core:forEach>
</gel:script>
Here, the problem is that in this way, each manager receives lots of email related to each resource or each time period, while each manager must receive ONLY 1 email containing the LIST OF RESOURCES ..
I tried also putting the last two </core:forEach> that are in line 20 ,21 after <gel:log.. and before <gel:email.... (put them in line 10) , in this way each manager receives ONLY 1 email, but the problem is that now Resource: ${tms[1]}, refer to the last resource only.
I do not know how can I refer to the list of resources inside <gel:email....
I do appreciate if someone knows if it is possible to refer to the list of resources inside gel:email? if yes, how? or is it possible to write loop inside gel:email ?
Any answer or idea is highly appreciated.
Manhy thanks,
Mona