How do I list multiple objects in Log Message

I created some “counters” in my automations. At the end of the entire process I want to log a message that references all my 5 objects
start time
end time
Total Emails
Good Emails
Bad Emails
I need my message to log as "This report begun at “start time” and ended at “endtime”. There was a total of “total emails” in the inbox. “good emails” were moved to lead folder and “bad emails” were moved to exception folder"

Does anyone have any ideas? Any assistance will be appreciated.

Hi,

I assume you already having the values for the variables you mentioned above like start time and end time etc.

you can use like below expression in your log message and set to info type.

"This report begun at “+start time+” and ended at “+endtime+”. There was a total of “+total emails+” in the inbox. “+good emails+” were moved to lead folder and “+bad emails+” were moved to exception folder"

or you want the logic for all the objects/variables you mentioned. please confirm. thanks.

We can use String.Format Like:

String.Format("This report begun at {0} and ended at {1}. There was a total of {2} in the inbox. {3} were moved to lead folder and {4} were moved to exception folder", strStart, strEnd, strTotal, strGood, strBad)

all strXXX are string Variables or statements producing a string like intCount.ToString and were placed on the corresponding position, expressed with the {X} syntax within the string Template text

It worked! thank you

1 Like

I’m going to try yours next. please stand by if it works

grafik

you recommendation worked. Thanks for your help!

Good morning. I was hoping you can assist me with this inquiry. I attempted to email the same log message, but my output did not come out the same. What am I doing wrong?

image

Hi,

could you check for the isBodyHtml option in the send outlook email activity is unchecked since we are using only text format for the email body. thanks.

It is unchecked
image

If possible could you pls share the expression you are using for email body.thanks.

here is the expression I’m using:

“This report begun at “+StartTime.tostring+” and ended at “+EndTime.tostring+”. There was a total of “+TotalEmails.tostring+” in the inbox. “+GoodEmail.tostring+” were moved to lead folder and “+BadEmail.tostring+” were moved to exception folder”

I was under the impression I was able to use the same expression as I did on the log message

Hi,

Yeah we have to follow different way to display message on the email body.

i am attaching the text file please copy paste into your Project data folder.

and follow the below steps before send outlook email message activity.

  1. Use Read text file activity to get the whole body formatted text (which i have attached). output should be in string. - Stringoutput

  2. Use assign activity and use sample below expression to frame the body content

EmailBodytext = String.Format(Stringoutput,StartTime.tostring,EndTime.tostring,TotalEmails.tostring,GoodEmail.tostring,BadEmail.tostring)

  1. Use the above output EmailBodyText in your body section of sendoutlook email message instead of the whole string you mentioned. I hope it will resolve your issue. thanks.

EmailBody.txt (205 Bytes)

You are the man!! it worked. thank you so much for your help.

1 Like

Your most welcome.

Good morning Sir. So sorry to bother you, but you have been so helpful. can I ask for one more favor? How can I add a png image to this email? Again, any assistance will be greatly appreciated

image
image

Hi,

You have to delete with the alt name of the image and content id and you have to create html content to attach the image in the email body. please refer the below thread . thanks.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.