You are viewing limited content. For full access, please sign in.

Question

Question

Previous submitter process variable in filter

asked on August 13, 2018

Hi, I have a requirement to assign a task to same team member who submitted previous task step. Using dynamic team filter, I have written below script.

 

var APSubmitter;

APSubmitter=team.findTeamMembersByUserName($util.getValue('AP_Submitter'));
if (Object.keys(APSubmitter).length == 0)
       $result=team.getAllMembers();
else
       $result=APSubmitter;

 

Where 'AP_Submitter' is a hidden field on form that I set by invoking a workflow every time a task is submitted in order to catch last submitter. Is there a way to use Process Variables instead within a dynamic filter javascript to get previous task step submitter?

 

I mean the below process variables to get the Previous Submission or Previous User Submission, which are not available in dynamic filter to pick.

 

Kindly note that I don't want to use findTaskLastSubmitters(StepID) method because there are multiple tasks based on conditions within a flow and I can't hard code the StepID.

1 0

Replies

replied on August 13, 2018 Show version history

I don't think you need to rely on filters to make this work. You should be able to use either the Previous Submitter or Previous User Submitter process variable in the user assignment field of the user task.

Forms tracks the submitter for each user task internally and passes that information along to the next task, so I don't think the hidden field/Workflow approach is necessary for what you are trying to accomplish; I believe it should still work even if there is another non-user task between the two tasks.

0 0
replied on August 14, 2018

I still need to assign a task to a dynamic team based on conditions as the task need to be managed within a team. The idea is to assign a task to same member within a team who has submitted in last step.

0 0
replied on August 14, 2018

I see, that does complicate things since the previous submitter variables are not available within the filter.

Out of curiosity, what is the use case here? I'm just curious why it is split into two separate steps if it is meant to be handled by the same user.

0 0
replied on August 14, 2018

As per the process, there are different teams and the tasks are assigned to teams based on conditions.

 

These are two different steps in different stages because condition may vary based on forms variables and the task may get assigned to different teams in next stage. Else the task is assigned to the same team and member to proceed further.

1 0
replied on May 5, 2021 Show version history

Here's how I did it:

1. Place a field on your form for BP_Step_ID with a default value {/_current_step_id}.
Use field rules to hide it, being sure to save it.

2. Write some javascript so that the field resets to it's default value every time the page loads:

$(document).ready(function () {
	let bps = $('[attr="BP_Step_ID"] [type=text]');
	bps.val(bps.attr('default-val')).change();
});

3. Stick that BP_Step_ID in your filter:
Note the parseInt in there! team.findTaskLastSubmitters throws an error if you hand it a string.

var assignedTo;
assignedTo=team.findTaskLastSubmitters(parseInt($util.getValue('BP_Step_ID')))
if (Object.keys(assignedTo).length == 0)
    $result=team.findMembersByRole('Primary');
else
    $result=assignedTo;

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.