Sample Webhook Functions

Here’s some sample webhook functions that would be executed once the webhook sent by the extension is received in FlexDeploy. These examples are specific to the context of the browser extension, but check out the incoming webhook function samples for more general ideas of what’s possible with incoming webhook functions. Also, see the reference page for the context variables and methods available.

APEX - Build Application

This script builds each APEX application passed in the payload against a set environment. The project is sourced from App Builder, so the stream is irrelevant here

def functionName = "Build APEX Application";"Running function: ${functionName}");

if ("Build Application(s)".equals(PAYLOAD.actionName))
  for (def application in["Application Names"])
    def projectId = FLEXDEPLOY.findProjectId(application);
    def streamId = FLEXDEPLOY.findStreamId(projectId, "main");
    FLEXDEPLOY.buildProject(streamId, projectId, "DEV")

ORDS - Export Module

def functionName = "ORDS Export Module";"Running function: ${functionName}");

if ('Export ORDS Module'.equals(PAYLOAD.actionName))
  def moduleNames =['Module Names'];
  def module = moduleNames[0];
  def projectId = FLEXDEPLOY.findProjectId(module[0].concat(' REST'));
  def streamId = FLEXDEPLOY.findStreamId(projectId, 'trunk');
  LOG.setMessage('Building project ${projectId}');
  FLEXDEPLOY.buildProject(streamId, projectId);