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 branch is irrelevant here
def functionName = "Build APEX Application";
LOG.info("Running function: ${functionName}");
if ("Build Application(s)".equals(PAYLOAD.actionName))
{
for (def application in PAYLOAD.properties["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";
LOG.info("Running function: ${functionName}");
if ('Export ORDS Module'.equals(PAYLOAD.actionName))
{
def moduleNames = PAYLOAD.properties['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);
}
OIC - Export Integrations
import flexagon.fd.model.pojos.workflowrequest.ExecuteOptions;
import flexagon.fd.model2.pojo.CodeValueInputPOJO;
def functionName = "Export OIC Extensions";
LOG.info("Running function: ${functionName}");
// make sure to name your action this, or to change what's its checking for here.
if ("Export OIC".equals(PAYLOAD.actionName))
{
// find all the given IDs and put them into comma-separated list
def builder = new StringBuilder();
def integrationIds = PAYLOAD.properties["Integration IDs"].findAll()[0];
for (def integration in integrationIds)
{
builder.append(integration);
builder.append(",");
}
// Give the list as a workflow input
ExecuteOptions eo = new ExecuteOptions();
def integrationListInput = new CodeValueInputPOJO("INTEGRATION_LIST", builder.toString());
eo.setWorkflowInputs([integrationListInput]);
// execute the utility project that will export the integrations and save them to SCM. Project ID is hardcoded here, since there is only 1 project.
FLEXDEPLOY.executeUtility(24945992, "DEV", eo);
}
Salesforce - Commit Files and Build Package
OTBI - Download WebCatalog Items
Use the below sample code for the incoming webhooks from Browser Extension to call the Utility project to download OTBI objects and commit to git.
Use the sample workflow from Automate check-in of development OTBI catalog items to SCM
OBI - Download WebCatalog Items
Use the below sample code for the incoming webhooks from Browser Extension to call the Utility project to download OBI objects and commit to git.
Use the sample workflow from Automate check-in of development catalog items to SCM
BI - Export WebCatalog Items Using Package Project
The project id can be OTBI/OBI or OAC projects.
- style