Aller au contenu principal

script to execute schedule entry from content creator

Commentaires

3 commentaires

  • Zendesk API User
    Author: bIT_sosswald - 5/7/2020 8:26

    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
  • Zendesk API User
    Author: Peter_Jodeleit - 5/11/2020 16:23

    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.

    0
  • Zendesk API User
    Author: luisapmesquita - 5/11/2020 17:37

    thanks, worked :smileyhappy:

    0

Vous devez vous connecter pour laisser un commentaire.