Pass return value to spjs.dffs.triggerSave() ?

Forums General discussion Pass return value to spjs.dffs.triggerSave() ?

Viewing 1 reply thread
  • Author
    Posts
    • #26143
      Taylor Scott
      Participant

      Hi Alex,

      I’ve built out a dashboard that opens a variety of parent and child forms in different lists. When I open my parent forms in dialog from my dashboard, I want to be able to pass back an object when I save. Is there a way to do this using

      spjs.dffs.triggerSave();

      Please note: I know I can get my values back by filling up an object and passing it to the function below, but this doesn’t save the item, it just closes the dialog and forces the result === 1.

      SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, obj)

      In the example above ‘obj’ is the object I want to pass to the trigger save that works in the same way, but instead of just closing… saving. I can’t seem to figure out how to pass my object back on save. I know that when my dialog closes if the result === 1 then it saved, but unless I pass my object back with the save function I have no return values.

      Any ideas?

    • #26153
      Alexander Bautz
      Keymaster

      The function spjs.dffs.triggerSave only clicks the default save button and does not offer any callback. To do this you need some Custom JS in both the parent and the child form.

      Add this to your parent form Custom JS:

      function vlookupChildAddedCallback(){
          // Here is your callback-object
          console.log(window.top.dlgCallbackObj);
      }

      And this to your child list NewForm:

      function dffs_PreSaveAction(){
          window.top.dlgCallbackObj = {
              "childItemTitle": getFieldValue("Title")
          };
          return true;
      }

      Hope you can use this.

      Alexander

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