cancel
Showing results for 
Search instead for 
Did you mean: 

[SPA Build PA] - How to set the business key?

kai-raschke
Explorer
0 Kudos

Hi,

I am using SPA Build Process Automation and trying to set the businessKey attribute of an instance.
The metadata the API can access is kind of this

{
	"id": "2747e24d-7af2-11ed-a965-eeee0a8569dc",
	"subject": "TextInput",
	"businessKey": "2747e24d-7af2-11ed-a965-eeee0a8569dc",
	"completedAt": null
	...
}<br>

The business key is initialized with the internal process instance id.
But this does not reflect a handy way for process participants, customer or colleagues to refer to a specific instance (e.g. in support cases).

Workflow for CF had at least the possibility to access the meta data through {$.info} expression variables (but read-only).

What I tried so far:

1. Access and write the metadata/property

=> Not working, there is no access to metadata through SPA custom script function (irpa_core), neither write nor read in runtime.

2. Access and write the business key through API call (PATCH v1/workflow-instances/{instanceId}) - but only when I already know the instance ID.

=> API documentation says "Modifies the properties of a given workflow instance, for example [...]". But it seems it only supports changing the status an instance, no other property (at least not the businessKey) = HTTP 422 Error

Does someone know a different approach for changing the business key or has a different idea of dealing with a human-readable reference for process instances?

Accepted Solutions (1)

Accepted Solutions (1)

Archana
Product and Topic Expert
Product and Topic Expert

Hello Kai,

I want to take my earlier response back :). With SAP Build Process Automation, you can now set a business key to any value of the process start context which means coming either from trigger form or trigger API input fields. Later you can use them to search in Monitor application or Process VIsibility application.

kai-raschke
Explorer
0 Kudos

Thank you! That's exactly what I was looking for.

I did not notice that setting by now and haven't read about it the manual or any other search.

JuanDK78
Participant
0 Kudos

The business key mapping from a context does not seem to work if you start the workflow by and an API call.

If you have a Form trigger or a parent process, the business key is populated, but if I try to start the process with and API the business key is null.

See below in my api call I have tried everything I could think off.

Answers (1)

Answers (1)

Archana
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Kai,

In SAP Build Process Automation you cannot set business key. If you let me know for what purpose you need business key I can suggest you on how you can achieve that.

kai-raschke
Explorer
0 Kudos

Hi Archana,

thanks for the reply.

I have the following use cases in mind:

- Reference for self-service portal

- Reference for human support

This could be something like this:
- Start the automation (form or api)
- User will receive a mail that his/her process was received and will be handled by the automation
- Two examples cases:
a) If it is a long running process (e.g. multiple approval steps) the user could ask me after two weeks for the progress of his/her process instance.
b) Something done by the automation was not done right (e.g. wrong API call). The user calls first/second level for help.
- If the user talks to me, I need a reference for the asked process instance and see what happened. I could look in the SPA backend for that process.
- A short and good way would be a human read- and writable identifier as the business key (aka. internal number, incident or ticket number, reference, you name it).

Currently I can search for the instance by it's ID (which is also the business key). But that's a little inconvenient.
The SPA API also supports search for business key (as filter) which could be handy in other backend processes.

I would appreciate if you have an advice for this.