Cant use Now as an expression

so I got this error but it just popped up I ran this process many times no problem and out of nowhere it popped up what do I do?

Cheers!

Please try Now.ToString

1 Like

@SowmyaLeo Thanks!

But i already tried it and it didn’t work

In the email template.txt there should be a {0} which will get replaced with this.

Example: String.Format(“Hello {0}”, Now.ToString)

1 Like

There is the {0} but its not working it worked yesterdat but today i got the error but i didn’t even touch anything i didn’t change anything!

Please can you share the Email template.txt.

2 Likes

Here it is!

@BjrnUitenbroek
Give a try on using Datetime.now
And ensure that Datetime is available related to the imports

1 Like

Looks fine and works fine for me. What is the error you are getting?

1 Like

the “Now is a type and can not be used as an expression error”

and now i am getting this error as soon as i open my project

image
In the screenshot please refer to the line String.Format(template, Now.ToString)

2 Likes

now i fixed it apperently the .tostring is working propperly now but as i said now i am getting this error/

and by the way @SowmyaLeo thank you so much for helping me out!

1 Like

No problem.
Which line of code is causing the error above? Can you try running it in debug mode.

yeah its happening without me starting the process its when i open it it appears! and how exactly do i run a single file in debug mode couse i am working wit REF.

its in the String.Format(template, Now) line i am getting this error “an object reference is required for reference to non-shared suffering”

I think may be restarting UiPath will fix the problem , but I’m not sure.

And for testing the code I generally break up the process into simpler blocks, test them out individually and then add them into the Framework.

1 Like

@SowmyaLeo okay will test it tommorrow i am in bed now writing you back on my phone but how do you devide it into part cause I can only debug project and that starts debugging at the main.xaml

Cheers! And again thank you so much for helping!

Can you check and see if you’ve added a duplicate reference in imports?
image