This sample script demonstrates how to extract the BPMS_Activities ID from the BPMSProcessInfoString field using an SQL query. This can be useful when you need to retrieve the current state of an object within a process (domainObject.CurrentState).

Applicability

This method is applicable when you need to retrieve an object by its current state.

Code Sample

The BPMSProcessInfoString field contains XML content, making it challenging to extract the Activities ID. You can achieve this by using the following query:

To achieve this, use the following query:

SELECT	CAST(B.[BPMSProcessInfoString] AS XML).value('/BPMInfos[1]/ProcessInfosList[1]/ProcessInfos[1]/Activities[1]/ActivityInfo[1]/Id[1]', 'NVARCHAR(36)') AS BPMS_ActivitiesId
FROM	ray.BPMAPP_BCM_BCP B


To retrieve the CurrentState and CurrentState_FaTitle, you can pass the result to the following query:

SELECT	Name AS CurrentState, FaTitle AS CurrentState_FaTitle 
FROM	ray.BPMS_Activities
WHERE	Id = @BPMS_ActivitiesId