cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Values to and from a Javascript rule - Agentry

Former Member
0 Kudos

Hi;

I am working on determining the first day and last day of the week using a javascript rule, so this can be in turn passed to an Agentry date and time property. When I debug in the ATE, it seems my javascript rule is always returning zero. What could I be missing, please see below the rule implementation. I am using this rule on a transaction property, under the "Initial Value" attribute - before data entry:

What could my rule be missing, How could I implement this correctly?

Much appreciated!

Sizo Ndlovu

Tags edited by: Michael Appleby

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

On your lines with a braket (ie { or } ) pleased include the other one, just Commented out like:

{ /* } */

and

/* { */ }

Stephen

Former Member
0 Kudos

Hi Stephen;

I have done as you advised, but I seem to be still getting a zero returned, please see below:

The Javascript method return variable (curUnixTime -: as shown on the first screenshot), is it automatically returned onto the WeekEnd property or there is extra code/steps that I need to add?

Thanks and Regards;

Sizo Ndlovu

Former Member
0 Kudos

Stephen;

Quick question, the commented curly brackets, are they so agentry can see the start and end of the Javascript or what?

Regards;

Sizo Ndlovu

Former Member
0 Kudos

No, the brakets are to get around how Agentry handles rules.   Each line if has an open, then it also has to have a close (even if it comment out and ignored).

Message was edited by: Stephen Streeter

Former Member
0 Kudos

Stephen;

Do you perhaps see anything wrong with my rule implementation, that would cause it to return a zero?

Thanks;

Sizo Ndlovu

Former Member
0 Kudos

Hi;

I have managed to get the Javascript portion working and calculating the current week end dates, the day and month are correct, except for the year. When I debug the rule via the ATE, I am getting the right week start and week end dates, only with the year 2045 instead of 2014. Please see the screenshot below:

Suprisingly, when I take the epoch values from the debug.log file and convert these to actual date and time, the return value has the correct day, time and year (2014), unlike what is being returned by the rule in the ATE. What could possibly be causing this?

Thanks and Regards;

Sizo Ndlovu