How can we make an RTC script (Js/Dojo) run periodically and let it set a specific attribute value directly (with out need to open a work item, change a specific value and save it)?
I have a script which gets the difference between Current Date and Due Date. The script returns the number of days and it only runs if the Due Date has changed manually in the work item.
I need to let it run every day automatically (for example at 12:00 AM).
I also need to let the script save the returned value (the number of days) to a specific attribute directly when the script runs (without need to open the work item and changing the due date manually, then saving it).
Accepted answer
Basically you can't and you also should not even try.
As explained in How should I ask a question in the Forum if I want to receive useful answers? you describe a solution for some problem and ask how to implement that solution. You should however state the requirement/the business problem and not your considered implementation of a solution.
I would be very concerned about a solution that has to update a lot of work items every day. Especially if it to only compute the difference between a due date and the current date and potentially do something (e.g. send an e-mail). This sounds like a terrible idea and I would not even suggest ways to implement it, unless I know the business case. This is likely rather something that needs to be implemented in reporting or maybe some other mechanism that does NOT update the work items.
Comments
One other answer
I suggest to use client side extension to calculate the difference and export it as a runnable jar file then run it using a windows task scheduler everyday @12 am.
BTW , a lot of Client side extensions example provided by JAZZ.net you can get as an example HERE