Page 1 of 1

Get data from URL based sysdate-1

Posted: Tue Aug 22, 2017 8:50 am
by Vrisha
I am able to pull the date from URL if 'https://dart.service-now.com/api/now/ta ... _value=all' using Hierarchical stage.

Now the requirement is to get previous day data from the url

"https://dart.service-now.com/api/now/ta ... 2017-08-01[/b]^ORDERBYsys_updated_on&sysparm_display_value=all"

If today is 22nd August, I need to pull 21st August data.( Rule is Sysdate -1)

How to store the current date in job parameter. Please let me know

Posted: Tue Aug 22, 2017 11:04 am
by chulett
How are your launching / triggering this job? Is there a Sequence job in the mix or if not, can there be? It can set the parameter for you. If there is a script involved, it can do it as well.

Posted: Tue Aug 22, 2017 11:47 am
by Vrisha
Thanks for your response,Craig.

Yes , sequencer is involved to run the job.

As I am giving the url 'https://dart.service-now.com/api/now/ta ... d_on%3E=[b] 2017-08-01 [/b]^ORDERBYsys_updated_on&sysparm_display_value=all" in the Hierarchical stage -->EditAssembly-->REST step--> General-->URL, I want to pass the 'sysdate -1' as a parameter in the job.

Can we set the (sysdate-1) in the job parameter for the job or we need to do only using User variable activity in sequencer. Please let me know.

Posted: Tue Aug 22, 2017 12:34 pm
by chulett
If you are asking if you can set something in the parameter's value to automatically set itself to "sysdate-1" the answer is no. There are different ways off the top of my head to get that date and yes, the User Variables stage would probably be the most "proper" place to do it. Technically an Execute Command stage could do something at the O/S level to pass back that date for the Execute Job stage or if you feel like writing a custom routine, you could leverage a Routine Activity stage. The Sequence job could then pass the output of either directly to that job parameter before it launches the job.

Another way would be to use a parameter set leveraging a value file where you write yesterday's date to the file (using your tool of choice) and then it gets automatically consumed by the job.

Posted: Tue Aug 22, 2017 12:39 pm
by chulett
To add to this, the system variable @DATE gives you the date that the job started in internal format. You could then use OConv to convert it to "external" format, a string in whatever shape you need it to be after you subtract one from it.

Posted: Tue Aug 22, 2017 12:40 pm
by Vrisha
Thank you, Craig.

I will try with User Variable activity and get back to you.

Posted: Wed Sep 27, 2017 10:54 am
by Vrisha
Used the UserVariable activity stage in Sequencer to get the current date as
Oconv(@DATE,'D-MDY[2,2,4]'). Called this Current Date as a parameter in the job to retrieve the data from URL.

The problem is solved.