Hello,
I would like to create the PAD flow, which takes current DateTime, converts it to string in format DDMMYYYY_HHMMSS and creates the folder and file which will be using this string as a suffix eg. folder with name "Data created on 03022021_123821" should be created.
PAD contains action for running JS (Run JavaScript), so I used this action to create this suffix. Code below:
var curDateTime = new Date();
var dateStringArray = [];
dateStringArray.push((curDateTime.getDate()<10?"0":"")+curDateTime.getDate());
dateStringArray.push((curDateTime.getMonth()+1<10?"0":"")+(curDateTime.getMonth()+1));
dateStringArray.push("" + curDateTime.getFullYear());
dateStringArray.push("_");
dateStringArray.push((curDateTime.getHours()<10?"0":"")+curDateTime.getHours());
dateStringArray.push((curDateTime.getMinutes()<10?"0":"")+curDateTime.getMinutes());
dateStringArray.push((curDateTime.getSeconds()<10?"0":"")+curDateTime.getSeconds());
var dateString = dateStringArray.join('');
WScript.echo(dateString);
This JS provides correct dateString and is exported from action to JavascriptOutput variable. However when this output is used in actions to create/rename file/folder, an error is displayed. I tried to remove the time and leave just date part of the suffix, but the result is the same:
Robin.Core.ActionException: Can't create folder Data created on 03022021
into C:\Users\powerplatform003\Documents\DUMMY_FI Team. ---> System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.Combine(String path1, String path2)
at Robin.Modules.Folder.Actions.FolderActions.CreateFolder(Variant newFolderPath, Variant newFolderName, Variant& newFolder)
--- End of inner exception stack trace ---
at Robin.Modules.Folder.Actions.CreateFolder.Execute(ActionContext context)
at Robin.Runtime.Engine.ActionRunner.RunAction(String action, Dictionary`2 inputArguments, Dictionary`2 outputArguments, IActionStatement statement)
Now, when we use 03022021 suffix directly (not as a result from JavaScript), the above error is not happening.
Did anybody else have simillar situation?
Regards,
ML