i created cut off setup Period. example,
january first cut off Period(start date is 1 and end date is 15).
january second cut off Period(start date is 16 and end date is 30).
february first cut off Period(start date is 1 and end date is 15).'
february second cut off Period(start date is 16 and end date is 28).
march first cut off Period(start date is 1 and end date is 15).
march second cut off Period(start date is 16 and end date is 30).
april first cut off Period(start date is 1 and end date is 15).
april second cut off Period(start date is 16 and end date is 30).
these setup is created early this year.
may question is, when the current date and current month is met the start date and month of any cut off periiod. it automatically create a cut off transactions record.
THanks,
Hi Marcelo,
You want to run a trigger when the current date falls on a cutoff date? Is this your question?
Regards,
Godfrey
Reply by Godfrey SoritaHi Marcelo,
You want to run a trigger when the current date falls on a cutoff date? Is this your question?
Regards,
GodfreyStop receiving emails on this subject.Flag this post as spam/abuse.
Exactly sir..
[collapse]On 8 April 2015 at 21:26, Godfrey Sorita <bounce-gsorita@community.progress.com> wrote:Reply by Godfrey SoritaHi Marcelo,
You want to run a trigger when the current date falls on a cutoff date? Is this your question?
Regards,
GodfreyStop receiving emails on this subject.Flag this post as spam/abuse.
You can use "Create New Record trigger" for your case. You can use trigger condition formula to evaluate if current date matches or falls below the cut off period. Use recursion option to run this trigger every day or week or month.
Please see this link for details documentation.progress.com/.../RB_User_Guide.pdf
Reply by Pradeep KagithalagudemYou can use "Create New Record trigger" for your case. You can use trigger condition formula to evaluate if current date matches or falls below the cut off period. Use recursion option to run this trigger every day or week or month.
Please see this link for details documentation.progress.com/.../RB_User_Guide.pdf
Stop receiving emails on this subject.Flag this post as spam/abuse.
What you can do is the following. (Workaround)
1. Create an Object. Lets call it "Cron Job"
2. Make sure it has one record with Name "Date based Cutoff Trigger"
3. Now Create a Data Maintenance Batch Job for this Object and make sure it is set to repeat every Day/Week/Month" as needed.
4. Now in "Object Script" of this job, you can write your cut off logic.
5. You can make sure your logic is run only if current record Name is "Date based Cutoff Trigger" thus avoiding multiple runs if someone creates another entry for your "Cron Job"
6. You can use this to add more such jobs in future.
[quote user="clga29261"]
[/quote]
Here's a sample batch job code for your reference:
var currentDate = new Date(); var cutoffDate = new Date("{!Cutoff_Date}"); rbv_api.println("CurrentDate:"+ currentDate); rbv_api.println("CurrentDate:"+ new Date(currentDate.setHours(0,0,0,0))); rbv_api.println("cutoffDate:"+ cutoffDate); rbv_api.println("cutoffDate:"+ new Date(cutoffDate.setHours(0,0,0,0))); if (currentDate.setHours(0,0,0,0) == cutoffDate.setHours(0,0,0,0)) { //Execute code here }
Reply by Godfrey Soritaclga29261If the current date is equal to the start date of that Cut off, if will run a trigger.Here's a sample batch job code for your reference:
var currentDate = new Date(); var cutoffDate = new Date("{!Cutoff_Date}"); rbv_api.println("CurrentDate:"+ currentDate); rbv_api.println("CurrentDate:"+ new Date(currentDate.setHours(0,0,0,0))); rbv_api.println("cutoffDate:"+ cutoffDate); rbv_api.println("cutoffDate:"+ new Date(cutoffDate.setHours(0,0,0,0))); if (currentDate.setHours(0,0,0,0) == cutoffDate.setHours(0,0,0,0)) { //Execute code here }Stop receiving emails on this subject.Flag this post as spam/abuse.
The code looks good! BTW, you can check the value of JavaScript variables using rbv_api.println().
Reply by Godfrey SoritaThe code looks good! BTW, you can check the value of JavaScript variables using rbv_api.println().Stop receiving emails on this subject.Flag this post as spam/abuse.
As mentioned in my previous comment, you can use rbv_api.println() to debug the code.
var fromCut = new Date(svalueOfMonth+' '+scodeOfDate+', '+preYear); rbv_api.println("Year:"+ preYear); rbv_api.println("Day:"+ scodeOfDate); rbv_api.println("Month:"+ svalueOfMonth); rbv_api.println("Date:"+ fromCut);
You need to add .getTime() to your dates..
arrCodeOfDate['cut_off_from_trans'] = fromCut.getTime();
arrCodeOfDate['cut_off_to_trans'] = toCut();
(Sorted this same issue out with Dates yesterday..)
Buried on p828 of the current User Guide documentation:
As the return type of a formula: return the full value of the JavaScript getTime() method.
For example:
return myDate.getTime();
Hope this helps..
fyi:
var x = new Array();
x["amount"]=1000;
x["R477842"]={!id};
x["name"]="API Created";
The Javascript recommended way is the following:
var x = {amount : 1000 , R477842 : {!id} , name : “API Created”};
In your case:
var arrCodeOfDate = {cut_off_from_trans:fromCut.getTime(), cut_off_to_trans:toCut.getTime(), R3565703:'Regular'};