Migrating from Windows legacy is breaking a script

The following script was working fine in windows legacy, but is breaking in the version I’m trying to migrate:
New datetime(now.Date.Year, now.Date.AddMonths(1).Month,1).ToString

It only fails at compilation and doesn’t trigger any validation errors before the script is run. Afterwards, it says

Sequence: Expression Activity type ‘VisualBasicValue`1’ requires compilation in order to run. Please ensure that the workflow has been compiled.

Is there a difference between windows and windows legacy that makes this not work? how would I rewrite this?

Hi,

Can you share screenshot of the activity?

Regards,


This help?

HI,

Is there any activity which is red highlighted when error occurs?

Regards,

None, and I know it’s this script just by process of elimination. When this is directly input, it works, when it is input via this code it breaks. and the validators don’t catch it. someone was having similiar problems with the double quote " symbol having two different versions and one didn’t work in windows, while working in windows legacy.

Hi,

For now, can you try to change current double quote to " in default value of LocationPath in variable panel? Please copy and paste this " if necessary.

Regards,

oh no no no, that was someone else’s problem, this one is different, I don’t have a quote in my script but a lot of the errors are the same as in their issue

Hi,

If possible, can you share your xaml file?

Regards,

Main.xaml (48.2 KB)
there’s a path here that leads to a location on my computer so you might need to alter that to make it work, apologies I haven’t shared these before

Hi,

It’s same matter.

Current default value of MonthName use not " but

DateTime.Now.AddMonths(-1).ToString(“MMMM”)

Can you try to use the following expression in MonthName?

DateTime.Now.AddMonths(-1).ToString("MMMM")

Regards,

1 Like

christ I didn’t see that, I was focused elsewhere in the script.

I’m a dummy, you’re amazing, MVP well deserved. Gonna go hide in shame

1 Like

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