- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2019 10:03 AM
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