Hi @bagwanpankaj,
If you're launching the workflow programmatically (e.g., via servlet, form, or workflow package), you can add validation logic in your custom code:
if (payloadPath.startsWith("/content/xyz/")) {
workflowSession.startWorkflow(model, workflowData);
} else {
throw new IllegalArgumentException("Payload must be under /content/xyz/");
}
This is the safest and most maintainable approach if you control how workflows are triggered.
If users launch the workflow manually via the UI, you can enforce the restriction at runtime by adding a custom WorkflowProcess as the first step in your workflow:
public class PayloadPathValidatorProcess implements WorkflowProcess {
public void execute(WorkItem item, WorkflowSession session, MetaDataMap args) {
String payloadPath = item.getWorkflowData().getPayload().toString();
if (!payloadPath.startsWith("/content/xyz/")) {
throw new WorkflowException("Invalid payload path: must be under /content/xyz/");
}
}
}
This will fail fast if someone tries to run it on an invalid path, but the workflow will still be listed and selectable.
Santosh Sai

