Skip to main content

I'm trying to do some runtime calculations and lookups which is causing me some problems on mobile form.

I have a form which displays employee name (read only) upon item creation. The form needs to automatically lookup the name from another list to get kilometers travelled in the current year. so the lookup needs to be based on 2 conditions where the Employee Name = formEmployeeName and the Year = current year. 

Then I have 2 needs for the returned Kilometers value.

1. the KM needs to be displayed on desktop and mobile (which I'm finding that lookups are not supported for Mobile), so I can get away with not displaying it on mobile, but if there is a way. That would be great.

2ndly which I cannot skip is I need the value to be able to pass it to a form variable in runtime. So based on the range of the kilometers, I need to pass a certain mileage factor and do runtime calculations.

I first tried to use a lookup, where the user have to select their Employee ID from a list and then display the KM. which is very non-user friendly, can show other users ID's and also doesn't work on Nintex mobile and is causing the form to break. Totally wrong solution.

I found this article https://community.nintex.com/community/tech-blog/blog/2016/02/10/nintex-form-runtime-function-as-parameter-to-javascript… which explains how to use Javascript to pass a value from a calculated field, then display on a single line of text on the form.

I haven't written Javascript before and this seems more complicated than what I'm trying to do, and was wondering if someone can give me a quick hand... 

Here is what I did: 

- I created a list column (single line of text) called "KMTravelled" 

- I have a form variable called mileage-factor that should take the KMTravelled and checks the value and returns a certain decimal number. Currently it's getting the information manually.

- I created a calculated field that has the runtime lookup function as below. (Note that this function only looks up based on name but I still need it to check the year as well because this might bring in a previous year's cumulative KM)

lookup("Cumulative KM List", "ID", EmployeeNamePerson, "Cumulative KM")

- I changed the Employee Name field settings (which is in display only mode and defaulted to created by user). to have a Javascript

196156_pastedImage_3.png

- I also adjusted the settings of the KMTravelled field to be as above with Client Javascript variable name = 

196166_pastedImage_4.png

- Then it comes to creating the Javascript function according to the article, and I have no idea how to do that!! Not even sure if that's will solve my problem or should I try a different approach.

Help please!! I need this fixed this week... It seems possible and should have been done before.. Just need the quick "how-to".

Thanks in advance!

Christine, I am checking with a few people, but last I checked mobile did not support certain runtime functions because of how the form is rendered for mobile.

Check out this post for info on how to potentially setup a cascading drop down which may help solve your problem  


Thanks Eric for your response.

Because I'm not very good at explaining myself happy.png Here is a screenshot of my form. and I'll explain what I need to do..

Basically I want the user to insert their Employee ID. the form then will lookup automatically another 'hidden' list which the users have no access to. that has the Employee Name, ID, KM travelled, and the year.

display those KM on the form and pass the value to the runtime variable to calculate the mileage factor in runtime..

The hidden list only has employees who have cumulative KM, so not everyone is on this list.. the workflow will create a list item or add to it when new KM are claimed. so I cannot rely on this list to select the original employee ID (I mean, i cannot replace the employee ID single line of text with a lookup).

I don't personally like the view shown below where the user have to insert their ID in the employee ID field, then again select it to show their KM (if there is any).

I'm already implementing some cascading lookups here for department, supervisor and displaying them on desktop. because lookups don't show on mobile, I removed them from the mobile form. But the issue with the KM is I need them on the form to be able to do the runtime calculations...

update: removed screenshot


Reply