First off - TIA for any support!! I'm fairly new to InfoPath and to this forum; I've done alot of reading here and the forums have answered many of my questions and provided me with alot of education.
I have an Infopath 2010 form that I am using to collect information for a process improvement suggestion. The form contains multiple checboxes, each one for a department.
Seperately from the form I have a SP list that contains managers, their address, and the department they are responsible for. Each department may have multiple managers with delegated responsibility. IE:
- John Smith : [email protected] : Department 1, Department 2
- Jane Doe : [email protected] : Department 1
- Bob Smith : [email protected] : Department 1, Department 3, Department 4.
Inside the form I have a data connection that pulls the necessary fields from the list.
What I would like the form to do is to iterate through the Sharepoint list, return all of the emails for the "checked" department, and concatenate them into a text box. IE:
- Form User checks the box for Department 1
- [email protected]; [email protected]; [email protected] is populated into a text box. I then use the string in this text box to populate the "To" field on and email data connection when the form is submitted.
So far I've been pulling my hair out and the closest I can get is by using the double-eval trick. This correctly counts/iterates through the number of managers on the list who are responsible for the selected department but the data connection only returns the first email address, 3 times.
Code:
eval(eval(Title[contains(Delegated_x0020_Departments, "Department 1")], 'concat(xdXDocument:GetDOM("Admin Rights Query - OpEx Leadership List Check")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Title[contains(../d:Delegated_x0020_Departments, "Department 1")], "; ")'), "..")
What the code yields with the above example list:
[email protected]; [email protected]; [email protected]
It is apparent that the code is counting correctly, just not moving down the list from record to record. I realize that this is because I am using an absolute xPath expression instead of a relative one but I cannot get any relative syntax to work.
Unfortnuately my major limitation is that I cannot get access to run code behind or create a workflow. I realize I could set up a second list and have the departments be discrete with multiple email addresses but I'd highly prefer to keep one list and it needs to be organized by the user. Is there a way to codelessly obtain my goal?