UPDATEPROCESSDATA with javascript

I have an UPDATEPROCESSDATA action that updates data variables using javascript.

It works for TEXT data, but not for DATE or NUMERIC.

Look at this example:
image

The data “TEST_TEXT” works and has the value “Hello World” in it, but the data “TEST_DATE” is empty.

Is this a bug or am I missing something?

Hi @ParadimeWeb,

.NET Date objects are not compatible with JavaScript dates.
The returned JavaScript date in your case is considered as a text string, and since the object is expecting a Date object, it is not maintaining the returned results.

As mentioned in the document, only TEXT process data types support JavaScript expressions:
https://docs.advantys.com/workflowgen-administration-module-reference-guide/workflow/parameters#editing-parameter-expressions

For your case I would use the System.DateTime macro which will return to you the current date.

Regards,
Eddy.

OK, I need to calculate the next Sunday. The workflow above was just an example.

How would you calculate the next Sunday without scripting language?

Hi @ParadimeWeb,

Lucky for you, I’m working on a very similar project where I use a custom application to achieve this.

Here is my simplified code:

DateTime today = DateTime.Today;
int daysTillSunday = 0 - (int)today.DayOfWeek;
if(daysTillSunday  < 0) daysTillSunday  += 7;
return today.AddDays(daysTillSunday);

You can add this code in .NET code behind or using a custom application.

Here is a Microsoft doucmentation that shows the indexes of each day:

Regards,
Eddy.