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

Question

Question

Accessing the Name of Task Step

asked on January 7, 2017

I am using the name of the current task in my form.  Currently I'm doing this via a hidden Single Line field that is set with a default value of {/_current_step_name}.

The problem I'm having is that this form gets reused for multiple task steps, and so the field is only being populated by the first task that used the form, and is not being updated on the subsequent tasks.

Does anyone know how to either:

  • Always update the field to the default value rather than reloading from the previous instances of the form, or
  • Access the current_step_name via Javascript.
2 0

Answer

SELECTED ANSWER
replied on January 10, 2017

You can add a custom HTML field and use the Current Step Name variable ({/_current_step_name}) to get the current step name that match the step. This is due to the value inside custom HTML won't be submitted, it is just for display. For other types of field, only the first time the variable is parsed to match the step name, then it is fixed as the value is submitted.

4 0

Replies

replied on January 9, 2017

Do you have a WF running between the two tasks?  Even if you don't you could add one.  In the workflow all you need to do is use the Set Business Process Variables and push the name you want to the field.  In the activity, pick the name of the process and then your hidden field.

1 0
replied on January 9, 2017

That would definitely work @████████but it's not very clean.  Where this form is reused in four or five different steps, I'd still prefer to have a solution within Forms itself, if at all possible.  Hmm... I need to think on this.

1 0
replied on January 10, 2017

Well that worked beautifully @████████

I added a custom HTML element with CSS Class of getCurrentStepName, and as the HTML content: {/_current_step_name}

Then in my CSS I hid the field from view.

.getCurrentStepName {display: none;}

And to test, I just used this code:

alert($('.getCurrentStepName').text());

Of course an alert isn't my end goal, but it verified that it was returning the correct info at each step of my process.

Thank you so much!

1 0
replied on September 6, 2019

Hi Matt

Beyond the HTML, did you ever figure out how to have a Variable field update with the current step. I'd love to be able to use the Current Step in a rule which cannot be done with an HTML field. Other than that would have to go down the road as laid out by Chris. Thanks

0 0
replied on September 6, 2019

Hey Steve,

You can use Javascript to copy the value from the HTML field into a regular field that includes a variable.

On a lot of my forms, I use a "notes" table on the bottom, and one thing it does is when the form is submitted the note displays which user submitted the form, what the label of the submit button said, and what the namenof the task was - this is done by populating some of that into HTML fields, and using Javascript to copy from the HTML to the actual form fields.

0 0
replied on September 6, 2019 Show version history

Thanks, I got it to work. Fantastic !!

1 0
replied on September 6, 2019

Great!

0 0
replied on September 11, 2019

Based on your information Matt, here is the full solution I was able to implement.

I'm posting this for others who may be looking for the same thing.

One of biggest challenges I’ve had with Forms has been the need to create Multiple Forms for different parts of the process when there is a need to add more information at different steps which usually meant creating additional forms to capture this and switching the form during the process.

Using the following, you can identify the User Task step of the process so it can used with a fields rule to display the appropriate items.

In the sample below you will see 2 fields: (I would suggest they would be hidden). 

  • A Custom HTML Field that contains the HTML variable {/_Current_step_name}  (css class CurrentStepName)
  • A Single Line field BPMStep (css class BPMStep)

When a User Task is opened the Custom HTML field automatically updates with the value of the Current Task Name allowing me to know what step I am at.

Using JS I capture the Custom HTML Text and input it into the BPMStep Field

 

$(document).ready(function() {

  $('.BPMStep input').val($('.CurrentStepName').text());

  $('.BPMStep input').trigger('change');

});

 

I then use the BPMStep field to create Field Rules as to when to show parts of the form

 

Hopefully this simplifies form building a bit to cut down on the number of Forms needed in a business Process.

2 0
replied on October 23, 2019

Very helpful Steve!!! Thanks for sharing!!

0 0
replied on August 17, 2020

Just an Update on this, If you use CurrentStepID instead of the variable CurrentStepName, and you use a Number field for BPMStep, you can then create rules based on the StepID which each task has opposed to the Name of task which would change if you used a Variable in the Task Name and hard to identify.

As the BPMStep field is a number field you have equals, greater than, less than, etc available to you in the rules. To only Show fields after the original form is submitted, the rule would be BMPStep is greater than 1. Or you could set rules such as Show Fields or Sections when BMPStep equals 5 or maybe greater than 4 and less than 6. Lots of options are available this way

Hope this makes things easier for you all.

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

Sign in to reply to this post.