Custom Java Not Working on Weekends ONLY

Home Forums Classic DFFS Custom Java Not Working on Weekends ONLY

Viewing 1 reply thread
  • Author
    Posts
    • #36089
      Notrega
      Participant

        We have a sharpoint list that is used as a shift report. We do not want the end user to create the next shift report, so we used the javascript below to trigger the creation of the next report when the user enters the population and checks a box to calculate the various populations into a total. This has worked very will with very few issues for a few years.

        We recently encountered problems over the weekends when the trigger is not creating the next report. Coincidentally, or maybe not, we added a field that checks to see if the day is a weekday or not to show or hide fields we want used during the week but not the weekend, but this uses all new fields and does not appear to have any dependencies on the creation of the shift reports, but it is the only recent change.
        Does anyone have any ideas on where to focus troubleshooting?

        //Create next shift report

        function addItemInShiftReport(){
        var ok = spjs.dffs.check_Mandatory([“Title”]), data = {}, newItem;
        var newdate = new Date()
        if(ok){
        data.Title = getFieldValue(“NextShiftName”);
        data.Facilities0 = getFieldValue(“Facilities0”);
        data.Shift_ = getFieldValue(“NextShift”);
        data.ShiftName_1 = getFieldValue(“NextShiftName”);
        data.Region = getFieldValue(“Region”);
        data.Facility_Shift = getFieldValue(“NextShiftName”);
        data.Superintendent1 = getFieldValue(“Superintendent1”);
        data.ADCS_1 = getFieldValue(“ADCS_1”);
        data.ADCS_2 = getFieldValue(“ADCS_2”);
        data.ADCS_3 = getFieldValue(“ADCS_3”);
        data.Date = spjs.utility.getDateFieldAsDateObject(“End_x0020_Date”).toISOString();
        data.Supervisors_Email = getFieldValue(“Supervisors_Email”);
        data.SupervisorsEmails2 = getFieldValue(“SupervisorsEmails2”);
        data.SupervisorsEmails3 = getFieldValue(“SupervisorsEmails3”);
        data.FullShiftName = getFieldValue(“NextShiftName”)+’-‘+getFieldValue(“End_x0020_Date”);
        data.NextShiftID = getFieldValue(“_DFFSID”);
        setFieldValue(“CreateNextShiftReportCheck”,’Yes’);
        //data.End_x0020_Date = spjs.utility.getDateFieldAsDateObject(“NextShiftEndDate”).toISOString();
        data._vLookupID = _spPageContextInfo.userId + “:” + new Date().valueOf();
        data._DFFSID = new Date().valueOf();
        newItem = spjs.utility.addItem({“listName”:”Shift Report”,”data”:data});
        if(newItem.success){
        // Item added
        }else{
        alert(newItem.errorText);
        }
        }
        }

      • #36096
        Alexander Bautz
        Keymaster

          Hi,
          I don’t see any obvious errors in this code. Do you get an error message, or is the function addItemInShiftReport never triggered?

          You can check to see if it is triggered by adding a console.log line or writing the text debugger; in the top of the function (it will pause the code and open the dev tools).

          If it is not triggered you must look at the code (or rule) that triggers this function to look for clues as to why it is not triggering.

          Alexander

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