Solved

How to use parameter for projection in Workflow

  • 10 May 2023
  • 5 replies
  • 324 views

Userlevel 7
Badge +21

I'm working on a workflow that involves approval steps. At this moment I want to use the approval steps that one can setup per DocMan/Approval Template. I have no problem in the workflow to get the information on an approval template: [myServer]/main/ifsapplications/projection/v1/ApprovalTemplateHandling.svc/ApprovalProfileSet(ProfileId='[myProfileId]')

However what I want to retrieve is the list of steps that are connected to the approval template. This is retrievable, when one tries via the URL as follows:

[myServer]/main/ifsapplications/projection/v1/ApprovalTemplateHandling.svc/ApprovalProfileSet(ProfileId='[myProfileId]')/TemplateArray

At that moment I notice all the steps that are connected to the approval template ‘header'.

My question is: How to I use an IFS Projection to read the set of data in task in BPA/Workflow with the /TemplateArray as hardcoded list retriever?

icon

Best answer by eqbstal 11 May 2023, 11:54

View original

5 replies

Userlevel 5
Badge +15

Hi @eqbstal 

I would suggest fetching and looping through a collection in your workflow. You can do this by checking that box at the end of your read projection task that’s labelled “Read Collection”. This will give you a collection you can loop through, but to filter it down even more, you can add a filter to that read projection task like so (I’m using a workflow that I already did this before on, so the projection and the fields are going to be different)

You can see that I limited the search to only doc_class values of 140 or 150. 

From there, you have to loop through the collection, which I’ve done in this script and subtask.

The arrow labelled “yes” has this condition “execution.getVariable('documentsRemaining') == true”.

Like I mentioned, looping through the collection requires a subtask, but you need to set it to a collection subtask, which is defined by those 3 bars

From there, you can do whatever you want with each iteration of the collection.

I hope this helps.

Thanks,
Bryan

Userlevel 7
Badge +21

@bdoucette Thanks for your extensive explanation. I'm in the middle of trying just that. But there doesn't seem to be a set (in your example 'DocReferenceObjectSet’. I try to use the URL as defined in the API document browser and only with TemplateArray I get the correct results.

Also when using the debug console, when updating the approval step line, I see the usage of the TemplateArray. I have the idea that this has been set up in a less standard way.

Userlevel 7
Badge +21

Noticed that I used the wrong Entity Set Name. It had to be Reference_ApprovalTemplate. Solved this/my problem.

Userlevel 1
Badge +5

Hi @eqbstal , How did you set the keys for the Reference_ApprovalTemplate ? I believe this was the reference of the array object TemplateArray.

I am working on a similar requirement and the required items are in an array and I don’t have the key to the array elements until I fetch the array. When I tried with the reference the workflow engine looks to be complaining of a missing key. I  had set a filter but not key items as I don’t have them.

 

Userlevel 1
Badge +5

@eqbstal Please ignore my query. I found the issue. It was a missing key value in another block.

Reply