Search Results for 'get values from another list'

Forums Search Search Results for 'get values from another list'

Viewing 15 results - 1 through 15 (of 22 total)
  • Author
    Search Results
  • #37318
    Jonathan Stamper
    Participant

    Alex,
    I’m unsure what is happening, but my autocomplete field no longer retains its values.

    I’m running in a newer version of Chrome. I’m using the subsite with the troublesome “&” in its name that doesn’t encode to a %26. The field is a standard text field that brings report IDs (numeric) from the lookup list. It’s multi-select with a separator of “; “ It’s the same configuration as another working site.

    When I select an item in the AC, the number(s) show up under the field as I would expect. When I do a getFieldValue on it I get ‘’. If I save, they don’t save with it. I commented out the AC code, did a plain type of the report ID, and ran the same getFieldValue and the ID returned.

    I’ve made no changes to it and just noticed ut today after it had been working fine prior.

    Marcus Khoo
    Participant

    I have a lookup column that shows choices from another list.

    For example
    My first list contains a column for “office” and a column for “postcode”
    In my second list I have a lookup to the first list and show the “office” value but I also want the postcode to be placed into another text column in the second list.

    Is there an easy way to retrieve “other” columns from the first into the scond list?

    (I’m sure there is!)

    Jeff Lynch
    Participant

    This illustrates it, under product I’m using your script to get values from lookup, in there we see the casepack is 12, but how can I get the filed CasePack to populate in this item so it will force the cascaded of less than full case? If I enter a number in the item casepack, the cascade works but I can’t get the value from the product into the orderitem.

    Case pack does not have to be in the orderitem, it’s just convenient to use then to filter the less than full case dropdown. That works off of another list that has 2 columns,
    Case Pack LessthanCasePack
    6, 12 3
    12, 18 6
    12,18 9

    based on case pack = 12 my values are 3,6,9 which is correct and it works. the issue is that the 12 comes from the Product which is a lookup.

    #36150
    Alexander Bautz
    Keymaster

    To use all these examples you must have v1.0.12.0 or later


    Updated February 04, 2024: Added dffs_vLookup_callback example

    Updated September 07, 2023: Updated dffs_showModal code example and added dffs_hideModal


    Please note that you can do most of this with rules. Using Custom JS is an option for advanced users.

    Do something before the item is saved

    You can use a function like this to run your own custom code before save. The function must return true to allow save, or false to stop the save. If you use this function it will run before the rules triggering on “Before save of the form” and “After save of the form”. If your function returns false the rules described will not run.

    function dffs_PreSaveAction(exit, autosave) {
      if (exit) { // Code only runs when you use SaveAndExit (new in v1.0.46.0)
        // This example will prevent save if the title field value is not "test"
        if (getFieldValue("Title") !== "test") {
          alert("Nope, you cannot save!");
          return false;
        }
        // Allow save
        return true;
      } else {
        if (autosave) {
          console.log("AutSaving");
        } else {
          console.log("QuickSaving");
        }
      }
    }

    Save the item from Custom JS

    Call this function from Custom JS to save the form:

    dffs_triggerSave(true); // Save and exit
    dffs_triggerSave(false); // Quick save

    Do something after the item is saved

    You can use a function like this to run your own custom code after the item is saved

    function dffs_PostSaveAction() {
      // Do something after the item is saved - for example redirect to another page
      // You can read values from the current item using getFieldValue("Name_of_field")
      location.href = "https://contoso.com/SavedMsg";
    }
    

    Do something if the item is cancelled / closed

    You can use a function like this to run your own custom code if a form is opened and then cancelled out of without saving.

    function dffs_PostCancelAction() {
      // Do something if the item is cancelled - for example redirect to another page
      location.href = "https://contoso.com/CancelMsg";
    }
    

    Do something if the item is deleted

    You can use a function like this to run your own custom code after an item is deleted (from within a form, not from the list view menu).

    function dffs_PostDeleteAction() {
      // Do something if the item is deleted - for example redirect to another page
      location.href = "https://contoso.com/DeletedMsg";
    }
    

    Show a modal dialog

    To show a modal dialog with a custom message you can use this code. Please note that this will be a non-blocking dialog so it will not prevent other code from running when the dialog is shown (like the default browser “alert” function does).

    var modalId = dffs_showModal({
    "title": "A message to you",
    "body": "Add your message body here. You can use plain text or HTML",
    "isBlocking": true,
    "showClose": true,
    "showFooter": true,
    "closeCallbackFn": () => {
    // Add your custom code that runs when the dialog has been dismissed
    alert("Closed");
    },
    "cancelBtnLabel": "Cancel button",
    "cancelBtnFn": () => {
    // Add your custom code to run when clicking the cancel button
    },
    "okBtnLabel": "OK Button",
    "okBtnFn": () => {
    // Add your custom code to run when clicking the OK button
    }
    });
    

    If you don’t include the “cancelBtnFn”, the Cancel button is not shown. The OK button will always show (unless you set “showFooter”: false) and will by default close the dialog.

    New in v1.0.32.0 is that the dffs_showModal returns the ID of the modal – which can be used to programatically close the modal like this:

    dffs_hideModal(modalId);

    Trigger custom code when a field is changed

    Use a function like this to run custom code when a field is changed.

    function dffs_fieldChanged(fin, new_value, previous_value) {
      console.log("The field " + fin + " was changed from");
      console.log(previous_value);
      console.log("to");
      console.log(new_value);
    }
    

    Toggle readonly on a field

    Toggling readonly can be easily done in rules, but if you want to do it using custom js you can do it like this:

    // Set as readonly
    dffs_doReadonly(["Status", "Title", "AssignedTo"]);
    // Undo readonly
    dffs_undoReadonly(["Status", "Title", "AssignedTo"]);
    

    Toggle the visiblity on individual options in a choice field

    The code example was changed because of a change in v1.0.46.0

    dffs_choice_option_hidden = {"DropdownChoice_31838417512562245": { "Enter Choice #1": true, "Enter Choice #3": true }};
    

    The id (DropdownChoice_31838417512562245) for your field can be found in the field property panel. Add the label of the options you want to hide and set the value to true. Reversing the action and make them visible again by setting the value as false. You only have to address the options you want to hide or show.

    Detect change in a field

    Use this in for example dffs_PreSaveAction to detect change in the title field:

    if(dffs_beforeProperties["Title"] !== getFieldValue("Title")){
        alert("Title has changed!");
      }
    

    Add a callback when a vLookup has loaded

    You can use this method to run your own custom code when a vLookup has loaded. You can find the id of the vLooup in the vLookup configurator.

    function dffs_vLookup_callback(id, items){
      if(id === "vLookup_7943515991751215"){
        console.log(id, items);
      }
    }
    

    Post any question below.

    Best regards,
    Alexander

    #34430
    Alexander Bautz
    Keymaster

    Writing more values to the list is just a matter of changing the “data” part like this:

     res = spjs.utility.addItem({"listName":"Favorites","data":{"Title":url, "another_field": "another_value"}});

    You can use getFieldValue(“another_field”) instead of “another_value” in the snippet above to get the value from a field in the current item.

    Please note that the format is different for different field types. If you can tell me which type the fields are in the “My learning list” I can give you and example of how you can write the data object.

    Alexander

    #29493

    Topic: VLOOKUP

    Silvestre Kassoka
    Participant

    Hi Alex,

    Background
    We have two lists connected through Vlookup , List A and List B. Basically List A is a leave request form and List B keeps records leave days taken and remainder etc.(print screens annexed).

    Objective

    a)To display 2 columns on New Form from List B which are connected to list A through
    Vlookup. Remainder & Leave days to be taken

    b) To prevent user from saving the forms if the remainder of leave days is not enough. I tried to create a Javascript code that will basically make calculations based on two columns from list B (leave taken & remainder) and one column from List A (days taken). Basically to say if (leave taken + days taken > remainder ) then an alert is made “no enough leave days etc and the form is not saved (submitted. However this giving an error, that bring me to another question.
    It is possible to get Field Values from columns of another list connected through Vlookup.? through getFieldValue?

    I hope i was clear.

    #27197
    Alexander Bautz
    Keymaster

    You can use some custom js to read or update values from another list. I’m not 100% sure I understand what you mean though. If the person filling in list A uses a cascading dropdown and selects a Mentor from list B – how should the data in list B be modified? – remove the person from the Mentor field, flag it with a value in a field (like “selected = yes) or delete the item?

    Because the cascading dropdown does not retrieve the id of the list item, you would have to use the selected values in a query to get the item. If you can sow me some screenshots of your list a and b (please mask any sensitive data) I can create a code snippet to get you started.

    Please note: using custom js in DFFS means any updates in datasheet view will NOT trigger the code.

    Alexander

    #25583
    Paul Lynch
    Participant

    Thanks! With the help of the debug it became clear it was something to do with the Prefill values in child as it was returning 0 results because the parentID field was not being populated, so no results were appearing.

    Now working (sorry changed so many things at once before working I cannot say exactly what I did wrong to help future users).

    Below is the final piece of the jigsaw to get this form ready..

    jQuery("#dffs_LinkToParentItem input:first").val("click to see more details");

    Replace LinkToParentItem with your field internal name.

    My steps:
    1. My prefill child works (ItemRelURL, and it prefills a relative link which is accurate.

    2. This relative link (format /teams/gcoiti/Lists/Parent/DispForm.aspx?ID=8 goes into a multiline of text rich text field. But it does not appear as a link just text. Should I use another column type?

    3. This column has internal field name of “Linktoform”

    4. I go into the child DFFS settings, and in the custom tab I entered

    jQuery("#dffs_Linktoform input:first").val("click to see more details");

    5. But still the none clickable Relative URL shows up in the column Linktoform (in list view which is ideally where I want to show it) and child item display form (which is not so important)

    Wondering if I could get bit more help to make this work?

    #24301
    Leonid
    Participant

    Right, Alex, just a regular Lookup field named “Groups”, with enabled multi-value selection.
    The field is a lookup to another list. I’d like to pull not just selected values from the source list, but also selected items’ IDs.

    getFieldValue("Groups")

    only returns Values.
    Wondering if there is a DFFS function to get value pairs or IDs.
    I understand that if nothing else, I can run

    spjs.utility.queryItems()

    passing selected Values in CAML, but that seems too cumbersome just to get IDs.
    Please advise.

    Attachments:
    #22404
    Paul Lynch
    Participant

    This is an Office 365 E3 licensed SharePoint Online Team Site

    I’ve attached the console image (although some object arrays are cut off not sure how important they are)..

    Also I pressed F12 on the chart page, whilst in edit chart view. (Not sure if that is relevant).

    _________________________________________________________________________________

    In order to get this chart ready for me to demo

    I’d like to filter the chart to only show the entries in the list where the
    “lookup column name” – (internal fieldname) is as below..
    “Portal Status” – (Deployed)

    This looks up another list called “Chart List”, picks the Title field (internal fieldname is also Title).

    3 Title values I wish to show;
    Identified
    In development
    Internal

    _________________________________________________________________

    Separate question – is there any function in the chart software to rename returned values? E.g. if I were to rename the above “Internal” as something else like “Deprecated”. Or at least rename their values in a legend?

    Thanks!

    #21289
    Patrice
    Participant

    I cannot get the below custom-js to save to my lookup list. I have tried a few things to trouble-shoot. 1) Permissions are good 2) Thought perhaps when the Display Name is different from FIN it would make a difference so tested with another field with both the same – didn’t make any difference 3) Tried turning isLookupInSelf = false, and 4) tried adding to the lookup list with spjs-lookup which worked just fine. I recently installed v4.4.3.45 but had not put this code into any previous version so I don’t know if it worked before I upgraded. We have SP2013 back end (server) but still SP2010 front end. I tried in a SP2013 evaluation site but kept getting SOAP errors. My code is below and I have attached a screenshot of field and the console error message I received, however I received this error message in Google Chrome but not IE11; new item was not saved in either browser. Any thoughts? Thank you, as always.

    spjs.ac.textField({
    “applyTo”: “Company”,
    “helpText”: “Start typing to search for Company”,
    “loadText”: “”,
    “listGuid”: “69B37C20-7963-420C-94A1-97F8E9C5DEF9”,
    “listBaseUrl”: “/sites/DCO/ACDC/ACDCDev”,
    “showField”: “Title”,
    “searchFields”: [],
    “filterCAML”: “”,
    “useREST”: false,
    “preloadData”:false,
    “filterREST”: “”,
    “optionDetailFields”: [],
    “optionDetailPrefix”: [],
    “enforceUniqueValues”: true,
    “rowLimit”: 15,
    “listOptionsOnFocus”: false,
    “minLengthBeforeSearch”: 3,
    “reValidateOnLoad”: false,
    “allowAddNew”: true,
    “isLookupInSelf”: true,
    “addNewAdditionalFields”: [],
    “multiselect”: false,
    “multiselectSeparator”: “; “,
    “orderBy”: {
    “fin”: “Title”,
    “ascending”: true
    },
    “setFields”: [],
    “debug”: true
    });

    #20119
    Caron Shimo
    Participant

    I have recently upgraded and getting a feel for the new version. In my current forms I have the ability to show and hide fields when they are selected which is working. What doesn’t work is if I am in a form and I select one thing and then change the selection to something else, it doesn’t automatically hide the fields that are not needed. it shows both sets of fields for the first selected option then fields for the option it is changed to also.

    When Add/Modify/Remove values is selected in Type of Request – Agent Data Groups the following field visible and required
    ◦Add/Modify/Remove Values from which ADG
    ◦New/Modify/Remove AD Value
    ◦MU Number and Name

    When New ADG is selected in Type of Request – Agent Data Groups the following field visible and required
    ◦Name of New ADG
    ◦New/Modify/Remove AD Value
    ◦MU Number and Name
    ◦Business Need for New ADG

    If I toggle between the 2 selected values in the old version it would hide the fields not listed as visible and required.. Can someone help me on how this version would allow me to do the same. Do I need to write the rules differently? The user would have to refresh the page to get the correct field if a mistake or another selection was made within the same field

    #18180
    John Freemont
    Participant

    Hi.

    I’m using SharePoint Online with DFFS and have a requirement to relate one list to another. Unfortunately the user experience requires the use of a multi-line description field from List A to relate to List B but using a Lookup column in List B it isn’t allowed to use a multi-line column.

    Can anyone help with how I can create an experience when the user is creating a new item or editing an item in List B where they can see the values in the multi-line column (DESCRIPTION in example below) to select from but the value of a calculated ID column (CALCULATEDID) is stored to link the two together?

    e.g.

    **LIST A**
    TITLE DESCRIPTION CALCULATEDID
    Blank Lorem Ipsum…. LISTA-001

    **LIST B**
    TITLE DESCRIPTION LISTA_RELATIONSHIP LISTA_DESCRIPTION
    Blank Lorem Ipsum…. LISTA-001 Lorem Ipsum…

    Thanks.

    • This topic was modified 6 years, 6 months ago by John Freemont.
    #17773
    Alexander Bautz
    Keymaster

    You can pass the values in the URL like this:

    SP.UI.ModalDialog.showModalDialog({
            "url":"/DFFS/Lists/DFFS_TestList/NewForm.aspx?Title=Put your string here&AnotherField=Put the string here",
    ...
    ...

    Then in the NewForm Custom JS add this code:

    var urlTitle = GetUrlKeyValue("Title");
    if(urlTitle !== ""){
        setFieldValue("Title",urlTitle);
    }
    // Repeat for your other fields

    PS: Thanks for the beer!

    Alexander

    #17699
    Chris Diltz
    Participant

    I’m wondering if anyone has a solution that would launch a NewForm from another list in the site collection when a field is either (a) set to a specific value or (b) changes values. Use case: User answers a Yes/No question in parent form and must immediately be prompted to complete a child form (ticket) in a new dialog before moving forward with the current form. They must be prompted as we cannot rely on the user to click a button or navigate out to the child list.

    After the ticket(s) is/are created and the parent form completed, you could then use vLookup to tie the forms together.

Viewing 15 results - 1 through 15 (of 22 total)