Get data from another list in the new form
Hi,
We have two different lists, one of them is for employee data. It is holding employee information and number of leave of absence days of each employee. The other list is for leave of absence request. An employee creates a leave of absence request from new form. What we need is to show how many leave of absence days left for the employee who is creating the request in the new form. We tried to get current login name and use it with related items to get data from the employee data list but it is not feasible as we just need one column value and show it in a plain text control. We really stuck at this point and any help will be appreciated.
We have two different lists, one of them is for employee data. It is holding employee information and number of leave of absence days of each employee. The other list is for leave of absence request. An employee creates a leave of absence request from new form. What we need is to show how many leave of absence days left for the employee who is creating the request in the new form. We tried to get current login name and use it with related items to get data from the employee data list but it is not feasible as we just need one column value and show it in a plain text control. We really stuck at this point and any help will be appreciated.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi Dmitry,
Thank you for the reply.
Is this way a little unsafe ? I mean code will work on client side and if a user try to intercept and change the username variable before sending it to server then it will be possible to get other user's data ?
Thank you for the reply.
Is this way a little unsafe ? I mean code will work on client side and if a user try to intercept and change the username variable before sending it to server then it will be possible to get other user's data ?
If you're using a User or Group column, we can filter the 'Employee' list by the current user without passing his login. CAML-queries support [Me] token:
https://christopherclementen.wordpress. ... aml-query/
https://christopherclementen.wordpress. ... aml-query/
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi
What you'd need to do is use JavaScript to:
Load the current user's login or name (depending on how you will identify him in the list) using SP.ClientContext, see this post http://sharepoint.stackexchange.com/a/120503
Then using this name you'll load the list, see https://msdn.microsoft.com/en-us/librar ... e.14).aspx. You can specify the user login/name here in CAMLQuery
Then you'll retrieve the required item from the listcollection object https://msdn.microsoft.com/en-us/librar ... 46453.aspx and get the item's property that you need.
Our support team can help you with this task, it will take 100 support minutes. If you're interested, please, pay for the support minutes in our store and send templates of both lists to support@spform.com. To get the templates, please, go to the List Settings -> Save list as template. We will start working on the task the next day after the payment.
What you'd need to do is use JavaScript to:
Load the current user's login or name (depending on how you will identify him in the list) using SP.ClientContext, see this post http://sharepoint.stackexchange.com/a/120503
Then using this name you'll load the list, see https://msdn.microsoft.com/en-us/librar ... e.14).aspx. You can specify the user login/name here in CAMLQuery
Then you'll retrieve the required item from the listcollection object https://msdn.microsoft.com/en-us/librar ... 46453.aspx and get the item's property that you need.
Our support team can help you with this task, it will take 100 support minutes. If you're interested, please, pay for the support minutes in our store and send templates of both lists to support@spform.com. To get the templates, please, go to the List Settings -> Save list as template. We will start working on the task the next day after the payment.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 7 guests