cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to assign variables based on user choice

Jump to solution

Hello Everyone, I have a choice control (radio buttons) that shows person 1, person 2 or your own choice. I couldn't get people picker to be the allow fill-in choices, so I disabled allow fill-in and inserted people picker control just next to the choice:

requestnintex.PNG

So my question is how can I implement this:

If choice = "Manager", {WorlflowVariables:notified} = {WorlflowVariables:Manager}

If choice = "Supervisor", {WorlflowVariables:notified} = {WorlflowVariablesSmiley Frustratedupervisor}

If choice = "Choose yourself:", {WorlflowVariables:notified} = {WorlflowVariablesSmiley TongueeoplePickerBox}

Any help is appreciated. Thank you

P.S. {WorlflowVariables:Manager} and {WorlflowVariablesSmiley Frustratedupervisor} are variables connected to calculated values, I noticed they usually don't get values until form is submitted.

Reply
10 Replies
Workflow Hero

Re: How to assign variables based on user choice

Jump to solution

let's try first to get rid of this

{WorlflowVariables:Manager} and {WorlflowVariablesSmiley Frustratedupervisor} are variables connected to calculated values, I noticed they usually don't get values until form is submitted.

workflow variables on form?

is it task form or should they have been form variables?

can you post/explain how do you set/populate these variables and how do you get/calculate underlying calculated values?

calculated values should recalculate immediately once any dependent reference is changed.

Reply
Not applicable

Re: How to assign variables based on user choice

Jump to solution

They are workflow variables because this form is part of a workflow.

I will explain how they are populated, there is a list of projects and each project has people listed in the mentioned columns (Manager, Supervisor), in the top part of the form, the workflow starter choose a project from the list, then there are 2 calculated values that use lookup method to get the manager and supervisor names from the list:

lookup("List", "ID", ProjectTitle, "Manager")

lookup("List", "ID", ProjectTitle, "Supervisor")

These calculated values are connected to the mentioned workflow variables, when the form saves they get assigned.

The calculated values happen instantly when the referred variable is set, but the other form controls are loaded initially.

Same thing when trying to put these calculated values as options for drop down list (choice control), they don't calculate since the choices were loaded with the form initially, and aren't interactive.

This is how I did for now, but I think this is a very long procedure for a small thing:

switch.PNG

0 Kudos
Reply
Workflow Hero

Re: How to assign variables based on user choice

Jump to solution

Could you set the Default value for the people picker to the current user, and then have a formatting rule that disables the people picker control if Choice != Yourself?

Reply
Workflow Hero

Re: How to assign variables based on user choice

Jump to solution

ok, so we talk about workflow start from.

These calculated values are connected to the mentioned workflow variables, when the form saves they get assigned.

that's ok, that's by design.

The calculated values happen instantly when the referred variable is set, but the other form controls are loaded initially.

that's as well  by design.

if you needed to change 'static' controls on the fly you can do it by javascript, but from your explanation I do not see anything what would you need to change that way

This is how I did for now, but I think this is a very long procedure for a small thing:

if it's enough for you to get 'to be notified person'  populated within workflow then your approach is correct.

if you need to know it already in form then you might rather create from variable (or another calc. control) and with set of nested IFs evaluate the value.

so to be honest, right now I do not know what's exactly your problem, since it seems you have found a solution.

Reply
Not applicable

Re: How to assign variables based on user choice

Jump to solution

That's exactly what I need, using nested Ifs on a form variable, but don't know how to code in JS or how implement this.

The reason I ask for this is to be able to optimize the workflow to execute less code since we had issues with nintex workflows before.

It will also be great if you show me how to get the actual calculated value to be choice options using JS.

Thank you so much

0 Kudos
Reply
Not applicable

Re: How to assign variables based on user choice

Jump to solution

Hi Ryan,

I'm not following up with you. The current user will never be sending the form to himself. What is the use of that rule and default value?

0 Kudos
Reply
Workflow Hero

Re: How to assign variables based on user choice

Jump to solution

Apologies, I misunderstood what your form meant where it says "Choose yourself", I interpreted that as "allocate to yourself".

Reply
Workflow Hero

Re: How to assign variables based on user choice

Jump to solution

something like this should work:

let's assume calculated control are named as follows:

MngrVar = lookup("List", "ID", ProjectTitle, "Manager")

Svisorvar = lookup("List", "ID", ProjectTitle, "Supervisor")

If(choice=='Manager',MngrVar ,If(choice=='Supervisor',Svisorvar ,If(choice=='Choose yourself:',PPbox,'Not defined')))

Reply
Workflow Hero

Re: How to assign variables based on user choice

Jump to solution

and regarding of how to add choice options on the fly, you might get inspired by this post Dynamic multi choice field in Repeating Sections

Reply