Add Custom Hook to Step Manually
- Last Updated: April 5, 2026
- 2 minute read
Add a Custom Hook to a Step Manually
Before you begin
You need:
- a custom hook module
- a flow definition with the step to which the hook would be added
About this task
After creating a custom hook module, you must refer to it from a custom hook node in your step.
Procedure
-
In a text editor, open the flow definition file.
The following is an example of a flow definition with an ingestion step.
{
"name": "your-flow-name",
"description": "",
"batchSize": 100,
"threadCount": 4,
"options": {
"sourceQuery": null
},
"steps": {
"1": {
"name" : "your-step-name",
"stepDefinitionName" : "your-ingestion-step-def-name",
"description" : null,
"stepDefinitionType" : "INGESTION",
"options" : {
"collections" : [ "your-ingestion-step-name" ],
"outputFormat" : "json",
"targetDatabase" : "data-hub-STAGING"
},
"customHook" : { },
"retryLimit" : 0,
"batchSize" : 100,
"threadCount" : 4,
"fileLocations" : {
"inputFilePath" : "",
"outputURIReplacement" : "",
"inputFileType" : ""
}
}
}
}
-
Under the
stepsnode, search for thestepto which to add the hook. -
Inside the
stepnode, fill in thecustomhooknode."customHook" : { "module" : "/custom-modules/your-step-type/your-hook-directory/your-hook-module-name.sjs", "parameters" : { // Add parameters as key-value pairs to pass to your custom hook module. }, "user" : "flow-operator", "runBefore" : false },Field Description moduleThe path to your custom hook module. parametersParameters, as key-value pairs, to pass to your custom hook module. userThe user account to use to run the module. Default is the user running the flow; e.g., flow-operator.runBeforeFor a pre-step hook, set to true. For a post-step hook, set to false. -
Save your file.
What to do next
Run your flow locally to test it. When ready, deploy your flows and custom modules to your MarkLogic Server.
See Also
Previous topic: Mastering: Matching and Merging
Next topic: Manage Flows Table
Related concepts
Related tasks