How to send a datetime into xaml using invoke workflow

I’m trying to get the data after specific date. So I sent a datetime argument to filering xaml file like below

I set the value like this : DateTime.ParseExact(in_Config(“Filtered_Date”).ToString, “yyyy-MM-dd”, CultureInfo.InvariantCulture)
of course, I also set Filtered_Date in config file as well. but it didn’t work.

it shows this error
“Invoke Workflow File: String was not recognized as a valid DateTime.”

how can I solve this errors? plz let me know :smiley:
Additionally, if I have to use another expression or something, could you explain more how to compare the date with others?

Thx in advance

maybe try changing the type to string? coz uipath does not allow you to pass anything other than strings through invoke workflow file activity.

@MythicGold uiPath allows you to use arguments of other types than String, eg. Int, DataTable…
what is the excact string that you are trying to parse. Go for debugging to find out
Have a look on this demo statement: DateTime.ParseExact(“22.09.2019”, “dd.MM.yyyy”,new CultureInfo(“en-US”) )

her variable type is datetime and what she is trying to pass is a string


@Chris_Kim is it working now? I replicated your error message by e.g a correct date string but a space on the end. Maybe a trim will help: in_Config(“Filtered_Date”).ToString.Trim

Hi @ppr
I’m really grateful for your answers. I tried all the thing what you mentioned. like changed Cultureinfo and add trim end of the ToString. but it doesn’t work. all of those occurs same error. what did I wrong?

Hi @MythicGold
I’m really thanks to your answer
I also have tried pass the string to xaml. and then tried change it. it also came same errors out.

what I sent an arguments of string

what I tried to change string to date

1 Like

In that phase it is recommended to isolate the issue

First of all run on .Net Fiddle or on a separate XAML the statement with hardcoded date
DateTime.ParseExact(“01.09.2019”, “yyyy-MM-dd”, CultureInfo.InvariantCulture)

  • then add a space after 2019 to reproduce your error
  • then go back to your workflow and test the invoke same with hardcoded date
    Once this is working then log out in_Config(“Filtered_Date”).ToString before invoke or inspect while debugging in the locals panel

Keep in mind if date string is not valid, the error message from above is thrown. DataType is DateTime.
It would also be a good check to click on import arguments (invoke activity) and recheck the arguments

Can you post the datevalue configured in the Config.xlsx?

Hi @Chris_Kim
Just try to Change the format of date time In the Expression. give the format according to to the date format of date you are getting.

Hi @ppr @jitendra_123
Very thx for helping me and you guys dedication. Actually, I solved it. but I was too busy to comment this post yesterday.
What I have done is that I just check and change excel cell format in Config file. it was set as a date. after changing as a text. it works very well.

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