luisapmesquita
I'm new here

script to execute schedule entry from content creator

Jump to solution

Hello,

Is there a script to execute a schedule entry from content creator?

I need to create an workflow for the script or is any other way to run ir from content creator?

thanks

Luisa

1 Solution

Accepted Solutions

Hi Luisa,

yes, you can use a script with 'scope = menu' for this.

Here is an example code you can use as starting point:

import de.espirit.firstspirit.access.AdminService;

import de.espirit.firstspirit.access.ServicesBroker;

import de.espirit.firstspirit.agency.OperationAgent;

import de.espirit.firstspirit.ui.operations.RequestOperation;

SCHEDULE_NAME = "fill in the name here";

scheduleStorage = context.requireSpecialist(ServicesBroker.TYPE).getService(AdminService.class).getScheduleStorage();

scheduleEntry = scheduleStorage.getScheduleEntry(context.project, SCHEDULE_NAME);

control = scheduleEntry.execute();

control.awaitTermination();

runState = control.getState().getState().toString().replace('_', ' ');

message = context.requireSpecialist(OperationAgent.TYPE).getOperation(RequestOperation.TYPE);

message.setTitle(runState);

message.setKind(RequestOperation.Kind.INFO);

message.perform(SCHEDULE_NAME + " finished with state " + runState);

Also you should use a custom display logic to restrict the acess to the action. E.g. only to project administrators like this:

connection = context.userService.connection;

return connection.user.isProjectAdmin(connection.project);

The Script is than accessible through the menu point "Actions" in the Content Creator.

Peter

View solution in original post

3 Replies
bIT_sosswald
Returning Responder

Hi Lusia,

I think you have to create a script or workflow or you can trigger it using a FS_Button or some additional Button / Extension in the ContentCreator. An "out of the box" way to start schedule entries IMHO is not available.

See also the comments: Projektgenerierung im Content Creator

Greetings

Sandro

0 Kudos

Hi Luisa,

yes, you can use a script with 'scope = menu' for this.

Here is an example code you can use as starting point:

import de.espirit.firstspirit.access.AdminService;

import de.espirit.firstspirit.access.ServicesBroker;

import de.espirit.firstspirit.agency.OperationAgent;

import de.espirit.firstspirit.ui.operations.RequestOperation;

SCHEDULE_NAME = "fill in the name here";

scheduleStorage = context.requireSpecialist(ServicesBroker.TYPE).getService(AdminService.class).getScheduleStorage();

scheduleEntry = scheduleStorage.getScheduleEntry(context.project, SCHEDULE_NAME);

control = scheduleEntry.execute();

control.awaitTermination();

runState = control.getState().getState().toString().replace('_', ' ');

message = context.requireSpecialist(OperationAgent.TYPE).getOperation(RequestOperation.TYPE);

message.setTitle(runState);

message.setKind(RequestOperation.Kind.INFO);

message.perform(SCHEDULE_NAME + " finished with state " + runState);

Also you should use a custom display logic to restrict the acess to the action. E.g. only to project administrators like this:

connection = context.userService.connection;

return connection.user.isProjectAdmin(connection.project);

The Script is than accessible through the menu point "Actions" in the Content Creator.

Peter

thanks, worked Smiley Happy

0 Kudos