Get data from another list in the new form

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
SPTech
Posts: 10
Joined: Wed May 27, 2015

01 Sep 2015

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.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

01 Sep 2015

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 ?

SPTech
Posts: 10
Joined: Wed May 27, 2015

01 Sep 2015

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/

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

01 Sep 2015

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.

SPTech
Posts: 10
Joined: Wed May 27, 2015

03 Sep 2015

Thank you very much Dmitry, I have successfully completed the development using the sources you provided.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 22 guests