How to use a date variable to create a Google calendar entry

Hello everybody,

this should be easy, but somehow I can´t get it to work. I would like to take a date from a data entry field in a form and create an event in Google calendar via a service task with an attached connector. It works perfectly fine with a fixed date but when I run the process with a script it makes no calendar entry at all. When I test the connector the following error message appears:

"Unsupported expression type for testing:

  • Input parameter ‘startTime’ use an expression containing an unreachable reference
  • Input parameter ‘endTime’ use an expression containing an unreachable reference"

For the script, I selected the data entry variable from the 'Select a variable…"-dropdown-menu (type: java.util.date ) and put quotation marks around it.

Thanks everyone for your help!

PS I´m using BPMCommunity-6.3.1!

Hi,
the script you put in the Start/End time (groovy script) should return a String.
You can use something like that:

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

DateFormat df = new SimpleDateFormat(“yyyy-MM-dd”);
Date date = new Date();
int hour = 21;
return df.format(date)+“T”+hour+“:00:00+01:00”;

Here I create a java Date object in the script directly (and the hour), you can make a reference to a java date variable created in the form for example.
Hope it helps
Cheers

What is thee versión you use calendar google.

Thank you for your answer, works fine!