Email body-dynamic values

Hi All,

I have created one in_count(argument)=5 an dnow i wnat to give this as body of outlook
like

“Hi,
Please find below count: in_count
thanks”

i am not able to see my argument while i am creating body…can someone help

hi @hema

you can simply call your variable from the body like that:
image

for your case it would be:
“Hi,
Please find below count: " + yourcounter.ToString + "
thanks”

check if its in the correct scope

best regards!

thanks for the reply but still it is not working getting error as string constants must end with double quote
"Hi Team

totalcount : " + in_count.ToString + "

Thanks,

"

please put it in a single line and use the next code for your new lines

"Hi, "+ Environment.newline + "Please find below count: "+countervariable.toString+ Environment.NewLine + “thanks”

best regards!

Hi,

Another approach:

We can also use String.Format for maintainability, as the following.

img20220317-2

First, prepare template string.

strTemplate ="Hi,
Please find below count: {0}
thanks"

Then

String.Format(strTemplate,in_count.ToString())

{0} will be replaced in_count.ToString().

Regards,

1 Like

Hi ,Thank you for the reply.

I used the approach which you mentioned like

"Hi, "+Environment.NewLine+"Please find below count: "+in_count.toString+ Environment.NewLine+“thanks”

but looks like everything coming as an single line below though used Environment.Newline

Hi, Please find below count: hello thanks

My requirement is like:

Hi Team,

Please find below count:7

Thanks

Could you please help

Hi ,

In this variable str_template:“Hi,
Please find below count: {0}
thanks”

Message box:String.Format(strTemplate,in_count.ToString())

I can see the output of count.

But when i am writing in mail body like below

“Hi,
Please find below count: String.Format(strTemplate,in_count.ToString())
thanks”

I am getting the output as:

“Hi,
Please find below count: {0}
thanks”

Hi,

The following image will help you.

img20220317-3

Regards,

The Body property takes a string. You create it like any other string…

“Some text” + somevariable

If the variable is not a string, then you may have to convert it…

“Some text” + somevariable.tostring

I suggest doing the free online training on UiPath’s web site. It covers basic things like this.

String.format can get unwieldy if you have a lot of variables, but for simpler strings it works fine.

Thank you Yoichi for the prompt reply

Thanks.

I tried this way it did not work.
I got the other solution now.

It’s very basic string concatenation and works fine. I do it all the time. I suggest doing the free online UiPath training so that you’ll understand these basics.

Hi All,

image

Please see above screenshot ,I have mentioned in Log message activity
Loglevel:info
Message: “Hello”

and now i wanted to write this in text file like(Note: I have created one text file and i can use append line to write in text file)But my ask is different here
Info:Hello(i.e the values should come from above log message activity to text file)

Please let me know any thoughts

Hi Postwick and all,

can someone help me with my above request

You can’t. Writing to a file and Log Message are two different, unrelated, unconnected operations.

Now, the Log Message (and other log entries) are written to files on the computer that’s running the Job, but I don’t think this is what you’re looking for. However, you can control where the internal log file is written.

Robot Logs.