Get Lookup value of another column

rss

Posted by jcmeyer - Jul 7 ’14 at 03:30

I have a list with 3 columns:

FileNumber, ContactPerson, City

FIleNumber is unique

 

In another list I have a lookup column on 'FileNumber'.  I want to pass the value of column ('City') to a variable after selecting the associated FileNumber.  I will then set the value of City in the new form automatically onChange to FileNumber lookup.

 

I can get the record ID of the lookup using fd.field('Lookup').value

I can get the text of the lookup (FileNumber) using fd.field('Lookup').control('getSelectedText');

Is there any way I can get the text of City after selecting a FileNumber in the lookup?

 

Thank you

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 10 months 28 days
    #1 by Dmitry Kozlov Jul 8 ’14 at 03:35

    Hi,

    Unfortunately, you cannot retrieve additional columns of a lookup value dynamically. But you can try our Cross-site Lookup column that allows to request additional column and save them into a hash-table inside the 'Item format' function. Next you can get all these columns by the selected key value on a form via JavaScript.

  • jcmeyer
    Member
    Member for: 5 years 1 month 11 days
    #2 by jcmeyer Jul 8 ’14 at 09:11

    as an alternative I can return additional columns with the standard sharepoint lookup and display the additional columns in another form.  The user must select the related item from a lookup dropdown and submit to see the changes.

    I have tried adding a button with the following onclick event as described in another forum post, but it does not seem to be working; basically I want to submit the form but not close the form (New or Edit form).

    fd.sourceFormParam(decodeURIComponent(window.location.href));
    return true;

    Is there anything else I need to add to the onclick event to submit and return to the same form?  or, any way to show the values of the additional lookup columns once the primary lookup dropdown is selected?

    thank you very much.

     

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 10 months 28 days
    #3 by Dmitry Kozlov Jul 9 ’14 at 03:55

    [#2]: Hi,

    Please, read the following post to get information on how to redirect users to the edit form right after creation of an item:
    http://formsdesigner.blogspot.com/2013/10/how-to-open-edit-form-right-after.html

    With regard to the edit form, you can place a new save button in addition to the existing ones called 'Save without closing' and put the following code into its OnClick handler:

    fd.sourceFormParam(decodeURIComponent(window.location.href));
    return true;

    More info:
    http://formsdesigner.blogspot.com/2013/12/customization-of-toolbar-buttons-and.html

    If it doesn't work for you, please, send HTML-source of your form page to [email protected]

Displaying 1 to 3 of 3 messages