Solved

changing the status field client side

  • 5 February 2017
  • 9 replies
  • 12 views

Badge +5

Hi Guys,

I need to change the status of a field upon submitting form based on multiple choice filed.

when an employee submits the form , the status should be "Manager", and when the Line manager approves the status should change to   "Department Head" and so on.

 

I know there are no action rule in Nintex and we have to make use of either calculated fields, JavaScript or "Set field in current item" of work flow.

 

1)I tried calculated field may not be the right way to go for the above scenario ( correct me if I am wrong).

2)I am currently making use of "Set field in current item" which gives me allsorts of problems I am using "Wait for Event in List Item" and the event fires when the item is set . I created some conditions to make it work.

3)JavaScript (which I am not very good at) seems to be the best option from reading through the post.

I have set client id for javascript for ClientLineManagerApproval,ClientDepartmentHead,ClientHR,ClientPayroll from the setting "Client ID JavaScript variable name"

now upon submit I need to create a condition.

how do I do that? can you provide some sample code?

icon

Best answer by cju 6 February 2017, 14:19

View original

9 replies

Userlevel 5
Badge +12

Hello,

In my opinion number 2 is actually the most realistic/best approach.   Your workflow will be controlling the flow of logic, which should determine the stage/status, so using the set field or update item action within the workflow makes sense, and is a very common approach.  The only way I could see a more client side approach being the right way would be if there were no workflow controlling the business logic.

Thanks,
Mike

Badge +5

Hi Mike,

Thanks for reply. As I mentioned before that is how I did it. I faced some problems with regards to the "Wait for Event in List Item". I soon as I set some values using the workflow it fires. I have made some changes to the workflow and made it work though and I am not sure it is the best practice. I have attached the workflow.

I have been looking at the JavaScript option. As I am currently evaluating the product there will be instances where you are not using workflow and needs this feature. Do you have any reference I can have a look at ? . I am pretty basic when it comes to JavaScript.

I would like to request for considering an action rule similar to that of InfoPath. Because for most of us who looks for an alternative for InfoPath (which is almost a non coding solution) and for those with a non programming background this will be beneficial.

Regards

Kannan

Userlevel 5
Badge +9

Hi Kannan,

I've seen that you don't assign any task to approve/reject the request instead you wait for an approver to change the correct field in the list item, is that correct? If it's correct, I think you'd better assign tasks to approvers for each step of your workflow (using "assign a task" action) so that you won't have to use the "Wait for event in list item" action and won't have problems any more when updating fields in the list item. When a task is assigned in a workflow, the workflow will automatically wait for the task to be finished to execute next actions. Also, you won't have to add Javascript to the form to correctly manage each approval. In the approval task form, you can display fields from the list item and you can build a form that exactly looks like the one for the list item.

Hope this helps

Badge +5

Hi Caroline,

Thanks for looking into it.

1)I've seen that you don't assign any task to approve/reject the request instead you wait for an approver to change the correct field in the list item, is that correct?

yes it is, I had been working with InfoPath for sometime now and got into the habit of looking at things in its perspective.

2)In the approval task form, you can display fields from the list item and you can build a form that exactly looks like the one for the list item.

When I played around with the task as advised, I got to know that you can show the details from the list directly into the Task mail (was a bit messy with the alignment and all). There is a related item link with the title of the current item field when clicked will be able to edit the fields. Once done we can go ahead and approve/reject the task by clicking the task title in the email. is this how it normally works. I am a trial with nintex is it how it normally works ?

The  disadvantage of the above method I have to go and fill/edit each form separately  (both task and list forms).May be this is a stupid question, is there any way edit both at once?

also if you can show a sample JavaScript it will useful for future references.

Regards

Kannan

Userlevel 5
Badge +9

Hi Kannan,

You can edit the "Assign a task" action in the Nintex Workflow designer and in the ribbon there's a "Edit Task Form" button. Once you click on this button, you can arrange fields as you like and you can also configure the list item's fields to be editable so that they can be modified in the approval task form. To do that, select one of the list item's field, then click on "Control Settings" in the ribbon, then in "Advanced" tab, select "Edit" in the "Control Mode" field.

Normally, you should only go to the task form to edit the item properties (if necessary) and approve/reject the task.

If the links in the email sent when a task is assigned are not clear, you can edit the body of this email in the Nintex Workflow designer, "Assign a task" action configuration screen and in "Initial email options" tab.

Regarding Javascript, here are some examples and references :

If you need more help regarding Javascript, just tell me what kind of examples you'd like (updating textbox field or dropdown list...)

Hope this helps 

Badge +5

I have set client id for JavaScript for ClientLineManagerApproval,ClientDepartmentHead,ClientHR,ClientPayroll from the setting "Client ID JavaScript variable name"

now upon submit it checks the ClientLineManagerApproval if true and change the "status"  to "LineManager" and so on,

Userlevel 5
Badge +9

Great, so you've finally managed to solve your problem ?

Badge +5

Yes and give me a better idea of how to move forward with Nintex ☺️.

I will be using this technique in lots of our projects.

Appreciate your help on this.

Userlevel 5
Badge +9

I'm glad that I could help you

Reply