Hi experts,
I will be thankfull for any advice because I didnt find any solution and read lot of topics here:
I have source: excel sheet table like example:
Column 4------Column 5 (cc email)------Column 6(email reciepent)
A -----------AnotherReciever5@emai.com--------Reciever1@email.com
B-----------AnotherReciever6@emai.com---------Reciever1@email.com
C-----------AnotherReciever7@emai.com---------Reciever2@email.com
By bellow WF I grouped data by Column 6 because I need to send data in single email in table: for rows A+B to reciever1@email.com with CC to AnotherReciever5@email.com) ; AnotherReciever6@email.com) and single email in table: for rows C to Reciever2@email.com with CC to AnotherReciever7@emai.com
It is done by bellow WF, where I read range from excel sheet and then group by Column 6
To add CC recievers I create dictCC variabile= I read range from same excel sheet because CC email recievers are in Column 5, so I need to connect/vlookup Column 6 with to Column 5 and add them to dictionary: (this caused a problem, what is explain below) :
Then every item in data table is grouped= For each - currentItem … In- dictGroup and every grouped data are collected to listStrings
after that for each row in DT is appended to list with defined columns, next activity: Generate datatable from text creates a datatable and datatable is convert to HTML text with another activity and attached to email body as table…
In send emai activity in field „TO“ and „CC“ I have defined values:
I GOT TWO ERRORS THAT I AM NOT ABLE TO RESOLVE:
- If in column 6 or column 5 is not any duplicate value, everything works as expected and email for data A is send TO Reciever1@email.com with CC AnotherReciever5@emai.com , but if in Columns 5 or Column6 are duplicate values (like in example below), I get error: „An item with the same key has already been added. Key: reciever1@email.com
A -----------AnotherReciever5@emai.com--------Reciever1@email.com
B-----------AnotherReciever6@emai.com---------Reciever1@email.com
C-----------AnotherReciever7@emai.com---------Reciever2@email.com
- In one excel sheet column is date format which is converted to list of string and attached to email body as table: so it change format from 1.2.2025 to 02/01/2025 00:00:00 , how I can avoid it? Format should be dd/mm/yyyy.
I read another topic that help me partially resolve first issue here:
cc variable works good:
cc = String.Join(“;”, dtGroup.AsEnumerable.Where(function(row) row(6).ToString.Equals(currentItem)).Select(function(row)
row(5).ToString))
is it any way how I can implement it to my WF? I cant use invoke code for datatable to HTML to get table in body email because read range activity cant read headers (duplicate columns names) so columns names are missing then, for me is better firstly append items to list and define the column names.
Thank you.
Simon.