Ask a Question

Update an xml tag in an xml file that has been loaded via Directory loading

New Contributor

Update an xml tag in an xml file that has been loaded via Directory loading

Hi all,


So, my project continues. 


I now have 20 xmls in a directory, which I am able to load via a DataSource step, SOAP request, Data loop.


I have realised that I have a fundamental issue with my xml in that the data needs to be relevant for todays date.  Each xml has a field 

<ScheduleDate v="2019-09-06T20:00Z"/>

How the devil do I load each file, and then change the field to be today's date.  


I had hoped I could do it via adding another datasource step and selecting xml as the file format and passing the FileContent from the first step to it, and then parameterize it, and then update the date, and the pass it to the SOAP Request. 

But when I load the file at the datasource step, it appears as a single line of xml and does not let me split out the properties.  This, I think, then stops me having an ability to manipulate the xml date field in the XML datasource step.


Sorry, I appreciate I've probably not explained myself very well 😞  


Thanks in advance,


Community Hero

Hi @Dofus01 



you can use inline/dynamic scripting to sort that to generate today's date.  The value in your post includes a time component - does the time matter or can you just rely on the date?


you can use the following to generate today's date:

${=(new Date().format('yyyy-MM-dd'))}

if you need to add the UTC timezone indicator and time T20:00Z, you can specify

${=(new Date().format('yyyy-MM-dd'))}T20:00Z

the above will work if there isnt any issue having a hard coded time.


I'll have to do some reading to determine a datetime function in groovy - one of the other people on here will almost certainly know it


All you need to do now is in your XML in your datasource, in your ScheduleDate tag instead of a hardcoded date value, input the following:


<ScheduleDate v="${=(new Date().format('yyyy-MM-dd'))}T20:00Z"/>

When the message is injected - it will generate today's date and the hardcoded UTC time - I've just done it on my laptop and it generates:


<ScheduleDate v="2019-09-06T20:00Z"/>

hope this helps!


nice one,




if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
New Contributor



Thank you so much! I got it working 🙂  


Your post saved me many many hours of googling it and hacking it together 🙂


Thanks again,


Showing results for 
Search instead for 
Did you mean: