DFFS does not recognize workflow created list record

Forums Dynamic Forms for SharePoint DFFS does not recognize workflow created list record

Tagged: 

Viewing 14 reply threads
  • Author
    Posts
    • #25430
      Notrega
      Participant

      Ok… Let’s see if I can make this half way understandable.

      TL/DR – if a workflow creates a record in a list, DFFS does not recognize the new record and does not process any rules. So it is not recognizing when the form is initiated, ready, or saved. I guess part of the issue is that the workflow isn’t using the form at all… Is there anything that I can trigger via a workflow that will cause DFFS to kick in??

      List 1: Shift Report – parent vlookup of List 3
      List 2: Master Roster of staff
      List 3: Staff Assignments – child vloopup of List 1

      I have a workflow that starts with a new record being created in List 1 and it then runs a loop if [Facility_Shift] matches in List 1 and List 2. The loop then creates a record in List 3 if other fields meet the set criteria. Part of the reason it runs so slow is I have to add so many fields that should be populating with a cascading dropdown once the record is created.

      This workflow works fine, but it is extremely slow to run through the loop, delaying the end user for completing the rest of the form.

      I had the thought to create a workflow that would create the record in List 1 and then wait 24 hours and create it again. That workflow works fine. But again that workflow created record does not trigger any DFFS rules in the newly created record.

      I am at a loss of how to proceed…

      Attached screenshot of workflow

    • #25433
      Notrega
      Participant

      Version information

      DFFS frontend: 4.4.3.65 – March 31, 2019
      DFFS frontend CSS: 4.46 / 4.46
      Autocomplete: 1.6.28 – January 12, 2019
      Cascading dropdowns: 3.7.26 – March 31, 2019
      jQuery: 1.12.4
      Lookup: 1.1.16 – March 05, 2019
      Resource management: not loaded
      SPJS-Utility: 1.332 – March 05, 2019
      vLookup: 2.2.129 – March 07, 2019

      Using 2013 Workflows as 2010 Workflows do not support looping

    • #25458
      Alexander Bautz
      Keymaster

      Hi,
      Sorry, but there is no way to trigger the DFFS rules from a workflow. DFFS only “lives” when you open the form in the browser.

      I didn’t understand exactly what your forms should do exactly, but it is possible to create items in another list with JS from DFFS so you might be able to do what you want without the workflow.

      If you have some more details on what should happen when a new item is created in “List 1” I might be able to get you started with a JS solution.

      Alexander

    • #25483
      Notrega
      Participant

      The new items in List 1 are shift reports for each [Facility] and [Shift] and would need to be created at specific times each day.

      [Facility] [1stShift] would need to be created everyday at 0500
      [Facility] [2dShift] would need to be created everyday at 1300
      [Facility] [3rdShift] would need to be created everyday at 2100

      and that JS created record would need to create the items in List 3 or at least trigger the Looping Workflow.

    • #25489
      Alexander Bautz
      Keymaster

      I see, unfortunately there is no way to use DFFS like this when you need them created on a schedule.

      Alexander

    • #25496
      Notrega
      Participant

      The end users is creating a record in List 1 with [Facility], [Shift], and pre-populated [Date].
      Could something create a new record but with the next [Shift] when the user sets a field in their record?
      Maybe the user has a checkbox [CreateNextShiftReport]?

    • #25499
      Alexander Bautz
      Keymaster

      Yes, you can add a list item in a list like show here: https://spjsblog.com/forums/topic/create-a-new-item-in-list-b-prefilling-common-fields-from-list-a/

      You can trigger this function from a DFFS rule when the checkbox “CreateNextShiftReport” is checked and the form is saved by changing the PreSaveAction function (from the linked code snippet in the link above) like this:

      function PreSaveAction(){
        // If the checkbox is checkde and it was not checked when the form was loaded
        if(getFieldValue("CreateNextShiftReport") && !spjs.dffs.beforeProperties.CreateNextShiftReport){
          addItemInListB();
        }
        return true;
      }

      Alexander

    • #25506
      Notrega
      Participant

      Haven’t had a chance to look at this and won’t be in the office but an hour in the morning. Can’t wait to try this.

    • #25525
      Notrega
      Participant

      We have almost got this working like we want, but when the JS creates the new record in List 1 it does not populate the _DFFSID or _vLookupID. They will populate once you open/save the newly created record, but we really need the _vLookupID for the Looping Workflow for creating the other record.

    • #25528
      Alexander Bautz
      Keymaster

      Hi,
      I’m glad you are making progress!

      To add the two IDs you must generate them and pass them to your new item. The vLookupID is generated like this in the vLookup script:

      data._vLookupID = _spPageContextInfo.userId + ":" + new Date().valueOf();

      and the _DFFSID is generated like this:

      data._DFFSID = new Date().valueOf();

      Add these two lines to the code you use to create your new items and you should be good to go.

      Alexander

    • #25545
      Notrega
      Participant

      Beers on me Friday (payday)!!!

    • #25558
      Alexander Bautz
      Keymaster

      I guess you got it sorted out?

      Alexander

    • #25573
      Notrega
      Participant

      Well… my colleague did all the work… I just asked you the questions. LOL
      Seriously though it works perfectly and is exactly what we needed.

    • #25575
      Alexander Bautz
      Keymaster

      That’s great news!

      Alexander

    • #27064
      Notrega
      Participant

      Hey Alexander – This is working wonderfully with one issue… if somehow the user gets to the point that creating the new record is ready, but gets a Save Conflict error… What happens is when they refresh or cancel the new record is created. They then go back and attempt to enter more information and a second new record is created… sometimes as many as 4-5 depending on how persistent the user is.

      Is there anything that can check and see if the record is already there and not create a newer one?

      • #27079
        Alexander Bautz
        Keymaster

        You could use another query to check if the record has already been added. Try adding this in the top of your function (before the part where you create the new item):

        var alreadyAdded = spjs.utility.queryItems({
          "listName":"The_List_Display_Name_or_GUID",
          "query":"<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>Searh_value</Value></Eq></Where>",
          "viewFields": ["ID"]
        });
        if(alreadyAdded.count > 0){
          // Already added - skip
          return;
        }

        Change the CAML to match your field and search value.

        Alexander

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