Assigning associated lookup columns to related items


Posted by Karlostavitch - Dec 19 ’16 at 05:49

In relation to prefilling fields via jquery for related items.

So I assume you have to assign lookup fields by the ID.

In the case of a person, this is also a kind of lookup field. Is it possible to get the ID of a person nominated in the parent form and assigning that value to the child related items? In the same context, is is possible to get the ID from a lookup field in the parent item and assigning it to the child related item?


Many thanks,

  • Karlostavitch
    Member for: 6 years 3 months 15 days
    #1 by Karlostavitch Dec 21 ’16 at 09:47

    I can just assign it by creation workflow if it can't be done in the form.

  • YuriyMedvedev
    Member for: 6 years 2 months 14 days
    #2 by YuriyMedvedev Dec 22 ’16 at 09:12

    The message was removed by a forum moderator.

  • YuriyMedvedev
    Member for: 6 years 2 months 14 days
    #3 by YuriyMedvedev Dec 22 ’16 at 12:33


    yuriymedvedev [8:29 PM]

    Hi, just add to related-items-block class "related-items", set "Client" rendering and "Quick-edit" mode to "Only" and use this code:

    fd.field('User').control('ready', function() {
        if(fd.field('User').value().length == 0)
            return false;
        var clientContext = SP.ClientContext.get_current();
        var website = clientContext.get_web();
        currentUser = website.ensureUser(fd.field('User').value()[0].Key.split('|')[2]);
        clientContext.executeQueryAsync(onRequestSucceeded, onRequestFailed);
        function onRequestSucceeded() {
         var userid =  currentUser.get_id();
         fd.populateFieldsInGrid($('.related-items'), {
                Title: 'CurrentItem',
                Link: "",
                Lookup: fd.field('Lookup').value() || '',
                User: userid,
        function onRequestFailed(sender, args) {
          alert('Error: ' + args.get_message());

    Where "Lookup", "User" are names of your fields.

    So, now you can create new items in "related items" and they will have in fields "Lookup" and "User" values of parent

Displaying 1 to 3 of 3 messages