Update data in list B from list A on save

Forums Dynamic Forms for SharePoint Update data in list B from list A on save

Viewing 5 reply threads
  • Author
    • #27191
      Jon Whisman

      I have 2 lists working together in a form via some DFFS cascades and vLookups. I also have a worflow that is SUPPOSED to be setting fields in list B once list A has certain updates made.

      Our SharePoint infrastructure is not the best at the moment, so I am looking for alternatives to updating list B’s data from the list A form when the user saves list list A form.

      The binding data between the 2 would be IDs and various data brought in from list B that the user selects in the list A form.


      List A is a “Protege” list.
      List B is a “Mentor” list.

      In List A (Protege), user selects Mentor data (List B) to be paired via series of cascade drop downs in the form.

      On Save of list A, I want to UPDATE the selected mentor (list B) that the mentor has been paired with protege so that both are taken out of the pool for future selections. This is what the workflow is SUPPOSED to be doing, but fails quite a lot.

      Is there an spjs function for doing updates to data between lists based on data I select other than ID betweeen the lists? EG: Bind would be where mentorID = protegeID.

    • #27197
      Alexander Bautz

      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.


    • #27221
      Jon Whisman

      Hi Alexander,

      To answer your question, what I’m after is the below.

      The person filling in list A uses the a cascading dropdown and selects a Mentor from list B. On Save (I’ll use the preSave function), the data in list B should be modified to update fields in list B as below:

      paired = yes
      set protegeID (ID from list A) into protegeID into list B.

      This way, I can use vLookup in a list view of list A to pull back data from list B of who list A people have been paired with from list B based on ID.

      Hope this makes sense. The workflow does the above at the moment, but randomly fails.

    • #27240
      Alexander Bautz

      Sorry for the late reply.
      Because the cascading dropdown does not pull back the ID of the list item we need to build a query to find the correct list item in list b to update the values.

      Will the Mentor field in list b have unique values, or is it the combination of cascading dropdowns (level1 > level2 > mentor) that is unique? – if so, can you show me the config for the cascading dropdown so I can replicate it to create the code example?


    • #27383
      Jon Whisman

      Sorry for my late reply.

      The cascading dropdown actually does pull back an ID (‘mentorID’) from the lookup list. I place this into a ‘mentorID’ field within the current item at the end of the cascade in the form. The ‘mentorID’ in the lookup list is set upon item creation via workflow from the lookup list ID field.

      With that, all I’m after is creating a new function I can do via dffs_PreSaveAction in the current item that will update certain fields in list B, doing a match against the ‘mentorID’ in the current item to the ‘mentorID’ in the lookup list.

    • #27405
      Alexander Bautz

      Try it like this:

      function dffs_PreSaveAction() {
          var res = spjs.utility.updateItem({
              "listName": "The display name or GUID of list b",
              "id": getFieldValue("mentorID"),
              "data": {
                  "paired": "1", // Boolean Yes/No field
                  "protegeID": spjs.dffs.data.thisItemID
          if (res.success) {
              // Updated successfully
          } else {
              return false; // < stops the save process


Viewing 5 reply threads
  • You must be logged in to reply to this topic.