From c11ce016fa9025c5eee14ee76e9ea131e1279238 Mon Sep 17 00:00:00 2001 From: Geeta Mandakini Ayyalasomayajula <45559635+gmandakini@users.noreply.github.com> Date: Tue, 12 Nov 2019 19:20:49 +0000 Subject: [PATCH] added the method to retrieve the processInstanceId based on the process instance name. (#5238) --- .../src/lib/core/actions/identity/query.service.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/testing/src/lib/core/actions/identity/query.service.ts b/lib/testing/src/lib/core/actions/identity/query.service.ts index 4ac0156c3b..676f136430 100644 --- a/lib/testing/src/lib/core/actions/identity/query.service.ts +++ b/lib/testing/src/lib/core/actions/identity/query.service.ts @@ -83,4 +83,18 @@ export class QueryService { } } + async getProcessInstanceId(processName: string, appName: string): Promise { + try { + const path = '/' + appName + '/query/v1/process-instances'; + const method = 'GET'; + + const queryParams = { name: processName }, postBody = {}; + + const data = await this.api.performBpmOperation(path, method, queryParams, postBody); + return data.list.entries && data.list.entries.length > 0 ? data.list.entries[0].entry.id : null; + } catch (error) { + Logger.error('Get Process Instance Id - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text); + } + } + }