Scribe Jobs: how to get the current date and compare it? - jobs

Honesty I'm very new in terms of Scribe Jobs, but I have been trying to develop a Job that get the current date and compare it against one field from the source (CRM input Date).
This is the code in the formula editor of the Pre-Operation Step Control:
IF(S146 =TODAY( ), GOTOSTEP ( ),FAILROW( ))
I'm trying to allow the migration only for records inserted today, the rest will just generate error.
Can somebody help me?

Try this:
if( DATEDIFF ("d", GETCURRENTUTCTIME, S146) < 1 )
Here's a great place to look for more information:
http://help.scribesoft.com/scribeonline/en/sol/formulas/datefunctions.htm

Related

How to handle to a certain Date scenario in Selenium script

i have a scenario where on opening the calendar three dates are enabled for the current week lets' say '21,22,23' and then the next day '21' gets disabled and the next dates shown are 22 ,23 ,24 so i would like to handle this in a way so that it would pick the next date automatically the next day. I don"t want to hard code it as the script will fail next day. How should i handle this?Any suggestions. Thanks
Sounds like you need to know the current date, and then the date of tomorrow.
This has been addressed many many times already on Stack Overflow, so search for more details. Also, this seems to be completely unrelated to Selenium, so please edit your Question and its title to correct and clarify.
ZoneId z = ZoneId.of( "Pacific/Auckland" );
LocalDate today = LocalDate.now( z );
LocalDate tomorrow = today.plusDays( 1 );

Extract incident details from Service Now in Excel

I am trying to extract ticket details from Service Now. Is there a way to extract the details without ODBC ? I have also tried the solution mentioned in [1]: https://community.servicenow.com/docs/DOC-3844, but I am receiving an error 9 -subscript out of range.
Is there a better way to extract details efficiently? I tried asking this in the service now forum but I thought I might get other opinions from here.
It's been a while since this question is asked. Hopefully following is still useful.
I am extracting change data (not incident) , but the process still should be same. You will need to gather incident table and column information. Then there are couple of ways to approach the problem.
1) If the data you are extracting has fixed parameters , such as fixed period or fixed column or group etc., then you can create a report within servicenow and then use REST/SOAP API to get the data in text/csv format. You can use different python modules to convert from csv to xls or xlsx depending on you need. I used openpyXL ,csv , xlsreader ,xlswriter etc.
See here for a example
ServiceNow - How to use SOAP to download reports
2) If the data has dynmaic parameters where you need to change columns, dates or filter etc, you can still use soap / REST API but form query within python scripts instead of having static report. This way you can change it based on your requirement on the fly.
Here is an example query for DB. you can use example for above. Just switch url with following.
table_name = 'u_change_table_name' #SN DB holding change/INCIDENT info
table_limit = 800
table_query = 'active=true&sysparm_display_value=true&planned_start_date=today'
date_query = 'chg_start_date>=javascript:gs.daysAgoStart(1)^active=true^chg_type=normal'
table_fields = 'chg_number,chg_start_date,chg_duration,chg_end_date' #Actual column names from DB and not from SN report.
url= (
'https://yourcompany.service-now.com/api/now/table/' +table_name +\
'?sysparm_query=' + date_query + '&sysparm_fields=' \
+ table_fields + '&sysparm_limit=' + str(table_limit)
)

System Date as a Clause

I'm using Oracle Business Intelligence, and creating a custom report. I've been able to create and have everything work except there's an issue in using parameters on scheduled reports.
This is forcing me to hard code the auto-updating dates in the Data model. Is anyone able to assist with the best way to replace my parameters below?
Essentially, I'm looking for START_DATE_PARAMETER to be replaced with the System Date MINUS 15, and END_DATE_PARAMETER to be replaces with System Date PLUS 1.
AND table1.EFFECTIVE_START_DATE >= :START_DATE_PARAMETER
AND table1.EFFECTIVE_START_DATE <= :END_DATE_PARAMETER
AND table2.EFFECTIVE_END_DATE >= :START_DATE_PARAMETER
AND table2.EFFECTIVE_END_DATE <= :END_DATE_PARAMETER
I appreciate everyone's feedback. I am fairly new to SQL, and am trying to develop my skills so all of the input is much appreciated.
Because my parameters are meant to include more than I'll actually need, I can potentially use either the 'CURRENT_TIMESTAMP' or 'SYSDATE' solution. The one piece of the puzzle that I was missing was the inclusion of 'TRUNC('
AND table1.EFFECTIVE_START_DATE >= (TRUNC(CURRENT_TIMESTAMP) - 15)
AND table1.EFFECTIVE_START_DATE <= (TRUNC(CURRENT_TIMESTAMP) + 1)
AND table2.EFFECTIVE_END_DATE >= (TRUNC(CURRENT_TIMESTAMP) - 15)
AND table2.EFFECTIVE_END_DATE <= (TRUNC(CURRENT_TIMESTAMP) + 1)

Time.now.beginning_of_year does not start at the beginning of the year

Trying to get records that were created this year, I stumbled upon this great question. The second answer says you get all records from a model that were created today by saying:
Model.where("created_at >= ?", Time.now.beginning_of_day)
So, naturally, I tried the same thing with Time.now.beginning_of_year, and it works just fine.
However, what struck me as interesting is that the outputted query (I tried it in the console) is
SELECT COUNT(*) FROM `invoices` WHERE (created_at >= '2012-12-31 23:00:00')
I wasn't aware that 2013 already began at 2012-12-31 23:00:00? How's that?
If you haven't set it yet, you should set your timezone in the config/application.rb file. Look for the line that begins with config.time_zone. (If you aren't sure what value to give, you can run rake time:zones:all to get a list of all available timezones.)
Once you've set your timezone, you should use Time.zone.now, as opposed to Time.now. This will properly "scope" your times to your timezone.
Check the API for more details on TimeWithZone.

Rally web service API: Retrieve Test Cases base on Iteration or WorkProduct attributes

I try to retrieve test cases from rally using XML URL such as
https://rally1.rallydev.com/slm/webservice/1.37/testcase?query = ...
I want to retrieve only test cases of WorkProducts those are accepted from day x to day y so I build the query like this:
https://rally1.rallydev.com/slm/webservice/1.37/testcase?query=((WorkProduct.AcceptedDate >= "yyyy-mm-dd") AND (WorkProduct.AcceptedDate <= "yyyy-mm-dd"))
The result is: Could not traverse to "AcceptedDate"
The funny thing is I can do something like:
https://rally1.rallydev.com/slm/webservice/1.37/testcase?query=(WorkProduct.LastUpdateDate <= "2012-06-26")
which is the same concept.
Is there anyone can say why LastUpdate information is query-able and AcceptedDate is not?
Thanks,
Minh Tue
The reason this doesn't work is because the WorkProduct field on TestCase is an Artifact. Artifact does have a LastUpdateDate field but does not have an AcceptedDate field. You should still be able to get the data you want but it will take a few extra queries.
You'll have to query for defects and stories whose AcceptedDate is in the desired range and include TestCases in the fetch.