How to create a calendar entry using workflows?

ragz
Tera Expert

I am working on service catalog , Once user request an item in the catalog and it has go through the approval process .

Once the request is approved then a calendar has to create about schedule to pick up in the users calendar and the technician calendar .

How to achieve this ?

1 ACCEPTED SOLUTION

Hi ragz,

In your Workflow, after the approval, I would create a "Run Script" activity that we will create the calendar events in.

The calendar events exist in the following table: user_calendar_event

So we'll create two new records on that table using the GlideRecord API in our Run Script activity. I'm assuming the User, Technician, and Start and End Date of the appointment are variables in your Catalog Item? Let's pretend like they are for this example and call the variables "user", "technician", "start_date", and "end_date".

The code would look something like this then, but you'll have to replace the variable names and any of the other fields you'd like to change to fit your process.

var user = new GlideRecord('user_calendar_event');
user.newRecord();
user.user = current.variables.user;
user.name = 'Technician Appointment';
user.type = 'task_work';
user.task = current.getUniqueValue();
user.start_date_time = current.variables.start_date;
user.end_date_time = current.variables.end_date;
user.insert();

var tech = new GlideRecord('user_calendar_event');
tech.newRecord();
tech.user = current.variables.technician;
tech.name = 'Technician Appointment';
tech.type = 'task_work';
tech.task = current.getUniqueValue();
tech.start_date_time = current.variables.start_date;
tech.end_date_time = current.variables.end_date;
tech.insert();

You can read more about GlideRecord API here: GlideRecord API

Thanks!

Josh

View solution in original post

6 REPLIES 6

Hi Josh,

I do not see this table anywhere "user_calendar_event"  has this table been deprecated?

 

Thanks,

-Erik

In case anyone comes across this in the future as I did, the user_calendar_event table is included with Resource Management and does not appear to be a part of the standard Now platform.