Ability to get deployment resources' IDs without resource bytes? Java API (using scripting)

using scripting execution variable:
I want to get IDs of the resources. Preference to getting a keyValue pair of resource Names and Record IDs.


and also looked at using:
execution.getProcessEngineServices().getRepositoryService(). getDeploymentResourceNames(deploymentId)

Is there a way to filter out the fields in the methods? Or is there another method from another service that can be used? The core of the problem seems to be that getDeploymentResources returns the bytes. If we can restrict the method from returning that information that would be great!

(I know we can filter out the bytes field after it is received from the method. But then we still have to process all of that data in memory. Please correct me if i am wrong about this)

Current workaround is to be build a new resource object:

var obj = new Object();
obj.process = {};
obj.deployment = {};
obj.deployment.resources = [];

obj.process.processDefinitionId = execution.getProcessDefinitionId();

obj.process.processInstanceId = execution.getProcessInstanceId();

obj.deployment.deploymentId = execution.getProcessEngineServices().getRepositoryService().getProcessDefinition(obj.process.processDefinitionId).getDeploymentId();

obj.deployment.deploymentVersionTag = execution.getProcessEngineServices().getRepositoryService().getProcessDefinition(obj.process.processDefinitionId).getVersionTag();

obj.deployment.deploymentVersion = execution.getProcessEngineServices().getRepositoryService().getProcessDefinition(obj.process.processDefinitionId).getVersion();

var resources = execution.getProcessEngineServices().getRepositoryService().getDeploymentResources(obj.deployment.deploymentId);

for each (var resource in resources){
   var resourceObj = new Object();
   resourceObj.id = resource.getId()
   resourceObj.name = resource.getName();



@StephenOTT, you are right, right now there is no way to get deployment resources without byte payload. I’ve created a feature request ticket to change that https://app.camunda.com/jira/browse/CAM-6435. It will stay in our backlog for now. If you want you can always contribute and implementation.

1 Like

@aakhmerov great thanks!