Obtaining value of vLookup

Home Forums vLooup for SharePoint Obtaining value of vLookup

Tagged: 

Viewing 1 reply thread
  • Author
    Posts
    • #26727
      Anne Maki
      Participant

        Hello,

        In the new Item form of a list I am working with, I am using vLookup to display a single line of text-type value from another list. What I’d like to do is capture that value that is returned and do some string manipulations to display a different value to the user in the same form. I tried to use the following to capture the vLookup value but am getting “undefined”.

        var str = getFieldValue(‘vLookupIntFieldName’);
        alert(str);

        I also tried the following but I get undefined as well:

        var str = spjs.vLookup.dataObj[“vLookup11”][getFieldValue(“_vLookupID”)];
        alert(str);

        What am I missing?

        Thanks,
        Anne

      • #26733
        Alexander Bautz
        Keymaster

          Hi,
          I think the best option is to read the value directly from the HTML like this:

          function vlookupChildAddedCallback() {
              switch (spjs.vLookup.data.refreshThisField) {
                  case "vLookupTasks":
                      var str = jQuery(".vLookupTasks_Status:first").text();
                      console.log(str);
                      break;
              }
          }

          In this example my vLookup column is named “vLookupTasks” and the field from the child item I want to ready is “Status” – change the snippet to match your field names.

          Alexander

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.