Automatic field value update every week in Lotus Notes - field

I want to capture the scheduled time of an agent in a field in form. The agent is running on every Friday evening. When the agent runs, the field will update its value as the running time of the agent. How can I do it? For example, this Friday the field value will be 04.03.2016 and next Friday its value will be 11.03.2016.

And in LotusScript it would look like this.
set DateTime = new NotesDateTime(now)
call DateTime.AdJustDays(7)
DateTime.DateOnly=true
call NotesDocument.replaceItemValue("Field",DateTime)

Or, for those of us who prefer one-liners:
Call NotesDocument.ReplaceItemValue("Field",Evaluate("#Adjust(#Today; 0; 0; 7; 0; 0; 0)"))

Related

Cron that runs on first Sunday after the first Friday of the month has passed

We work on a product whose software development team applies patch on every 1st Friday of the month. We have written some tests that we run on the Sunday after the patch is applied. So to automate the same on Jenkins, we would need a cron that runs on 1st Sunday after the 1st Friday of the month has passed.
Right now we just update our Jenkins each month considering dates, but can we automate this?
Thanks
Naively, one would suppose that 0 3 1-7 * fri would be "3am on the Friday that falls inside the first week of each month", and then we could use the similar logic to construct 0 3 3-9 * sun, for the Sunday that follows two days after such a Friday.
Unfortunately, this does not work, because day of week and day of month are taken as a disjunction by the cron specification; which means, the above would trigger not on the Sunday following the first Friday in a month, but on every Sunday, and also every day from 3rd to 9th.
Due to this twist in cron spec, what you ask is not possible by cron alone. The easiest way to untangle this is to separate the two requirements, ask the cron to track one of them, and manually test the other: either use 0 3 3-9 * * and then manually test in your script whether the day is Sunday and exit without performing your task if it is not, or use 0 3 * * sun and manually make sure the date is between 3rd and 9th.

How to mark a delay of 2 *working days* (or more) in a task?

We're using the following rule to mark work items that delay 2 days or more:
Changed Date <= #Today - 2
Work Item Type = Task
State = In Progress
(Then, color the task in red)
The problem is that when a task gets started on Friday, on Monday it will be red, even though only one working day has passed.
Is there a way around this?
This is not available to do this. For Changed Date field:
Change Date
The date and time when a work item was modified.
Reference name=System.ChangedDate, Data type=DateTime.
Since using data time type, it's not able to auto exclude weekends, this is by designed for now.
State Change DateThe date and time when the value of the State field changed.
DateTime
= , <> , > , < , >= , <= , =[Field], <>[Field], >[Field], <[Field], >=[Field], <=[Field], In, Not In, Was Ever Macros: #StartOfDay, #StartOfWeek, #StartOfMonth, #StartOfYear, and #Today; each of these
macros can be specified with a +/- n interger.
There has also been a related feature request:
Add option to exclude weekends when setting up Styling rules using the 'Changed Date' field rule criteria
https://developercommunity.visualstudio.com/idea/376310/add-option-to-exclude-weekends-when-setting-up-a-s.html
You could vote up it and our PM will kindly review it. Unfortunately, we do not have any perfect solution/workaround, you may have to manually change/update the colored task based on those tasks which get started on Friday.

Automatically change cells value at specific dates

I want to achieve following on the google spreadsheet :
Let's say I want some of my cells to take the value of another cell at specific dates and times.
The value is actually just a background color, but if that's a problem, it could be some text, even if I prefer the background color.
For example in this sheet :
https://docs.google.com/spreadsheets/d/15icn5bi-wZY1HZeLwpoM2Z_XrKOqydUH1BgdDGEEqLM/edit?usp=sharing
Let's say I want my cells A3, A5 and A6 to become like the cell F1 every monday, wednesday and friday at 6:30 am GMT+1.
Then the user can modify it but every Monday, Wednesday and Friday at 6:30 am GMT+1 the value is reset to the value of F1.
You can do this with this code and a time based trigger.
function colorCells() {
var ss=SpreadsheetApp.getActiveSpreadsheet()
var s=ss.getSheetByName("Feuille 1")
var c1=s.getRange("F1").getBackground()
s.getRange("A3").setBackground(c1)
s.getRange("A5").setBackground(c1)
s.getRange("A6").setBackground(c1)
}
On the scrips menu, select Edit>Current project's triggers.
Click to add a new one. Select the colorCells function, Time-driven,
Week timer, Every Monday, 6pm to 7pm. Select add new trigger and
repeat for Wed and Fri. You can't specify exactly the minute it will
run, but it will run in the selected hour. Here is an example you can copy and try.
https://docs.google.com/spreadsheets/d/1y-YP7AckNCRZO9w_dc43ZpGbFrfZh-zBKiuC_bEiDdI/edit?usp=sharing
I would try to accomplish this by:
First, I would create a script to change the background of the desired cells using SpreadsheetApp;
Second, I would create a script using Selenium WebDriver to open the spreadsheet and execute the function;
Finally, schedule the selenium script to run at specific dates (cron);

Change database record's value at a specific date and time

I have a Jobs table with a datetime column 'Expiration' and a string column 'Status'. When the record is created, I set the expiration value to next week date and when that day arrives, I want to change the status value.
I'm using SQLite in a Rails application.
You will need to create a scheduled task or cron job to run once a day to check for jobs which expire on that given day, and if any jobs are found then update their status.
expired_jobs = Job.where('expiration < ?', DateTime.now).where.not(:status => 'Expired')
expired_jobs.update_all(:status => 'Expired') if expired_jobs.present?
You may like the whenever gem.

evaluate difference between 2 dates to make a transition possible

Is this possible to evaluate the duration between a specified date on a form of a workflow, and the system date ? that what I want to do, in order to show (if this possible too) a short message if 1 day occurs since the specified date above, forbidding the transition of the status Closed to Reopened...
Thanks a lot,
Christophe
I think the Script Runner has a validator that does something like this but I can't find it. Then you could write a post function with the Script Runner. Otherwise it's back to creating a custom validator, as described in my book Practical JIRA Plugins (O'Reilly)
You can use the ScriptRunner plugin in addition with the following script in the validator section for the Reopened transition:
Date now = new Date()
Date cfDate = new Date(cfValues['YourCustomField'].getTime())
new Date(now.getYear(), now.getMonth(), now.getDate()).compareTo(cfDate) <= 0
Replace YourCustomField with the name of your custom field. This will ensure that the transition will check whether the current date is beyond the date set in the custom field, and blocks it if it is.
First of all, thank you for your answer.
It works to allow transition when dates are similar, but my purpose was modified by my responsible. He would like to allow the transition if dates are similar or if the duration between them is only 1 day or less.
Example :
System date is 09/07/2013 (Paris)
My date (dd/mm/yyyy format) Transition allowed Why
07/07/2013 NO my date is former to system date
08/07/2013 NO my date is former to system date
09/07/2013 YES my date and system date equals
10/07/2013 YES only 1 day occur between 2 dates
11/07/2013 NO 2 days occur between 2 dates
Here is the code I wrote in order to do that, but it does'nt work (maybe a Java syntax error?) :
Date now = new Date()
Date cfDate = new Date(cfValues['Date de clôture réelle de la demande'].getTime())
new Boolean(((now.getTime() - cfDate) / 86400000) <= 1) && (now.getTime() >= cfDate ))
Excuse me for my english. I'm french, and I try to improve my English.
Thanks a lot.

Resources