Vb expression inside of html

I have the body of an email in html inside my config file. I can’t figure out how to add today’s date as an expression inside the sentence of html. I’ve tried multiple ways to separate out including using <%= %> format. Below is the format of my html as it shows up when i send the email:

Greeting,

My name Is Chris DEASE and today's date is now.ToString("MM-dd-yyyy"). I am doing a TEST On what HTML looks Like When i add To uipath. I hope i can Get this thing To 'Work' today.

Regards,

Chris Dease

if i use the <%= %> format, it removes the expression completely and no date appears.

Any suggestion on how to separate the expression inside the html? below is a screenshot of what my html looks like right now with nothing separating the expression from the rest of the html.

Hi chris.dease,
Please check this workflow.
Main.xaml (14.5 KB)

Cheers!

@chris.dease

You can add a placeholder and replace that with actual value in you code

eg: in config give <p> Hi, Todays date is <DATE> </p>

inside code use in_config("Key").ToString.Replace("<DATE>",Now.ToString("MM-dd-yyyy"))

Or second way

in config give <p> Hi, Todays date is {0} </p>

inside code use String.Format(in_config("Key").ToString,Now.ToString("MM-dd-yyyy"))

Both of the above methods would work

we have more methods as well which use today function in excel and it will daily replace with the current date by default

Hope this helps

cheers

can you clarify what you mean by “inside code”? Where would i use this expression?
in_config(“Key”).ToString.Replace(“”,Now.ToString(“MM-dd-yyyy”))

@chris.dease

in the send mail activity…

basically in the UiPath studio where ever you are referencing the config value there you need to use a replace function as above to replace

cheers

so here’s my sequence, i’m still not sure where i need to add the replace value. somewhere in the properties pane?

@chris.dease

in assign activity where you are assigning config value to in_email_body is the place where you need to assign replace

and <DATE> in the config file where you need the date

cheers

Thanks! That did it!

1 Like

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