Pre-Process Scripts Not Working As Expected (NodeJS, DF 3.0.1)

So, I will cut this very short, because my patience and my tolerance for things not working correctly is basically gone at this point. According to the documentation, I can modify data before it hits an API / Database, such as scrubbing SSN numbers, by using a Pre-Process server-side script. However, no matter what I do in a Pre-Process script, the call never does what it should; it always complains about a field missing, or data missing, even though they are obviously there from the script (a small sample below).

if (event.request.payload.resource) { 

    // Go through each record and modify appropriately
    if (event.request.payload.resource.length  && event.request.payload.resource.length >= 1) {
        event.request.payload.resource.forEach((record, idx) => {
            // Placeholder for the actual request detail
            let request = {};
            // Pull data from the API request and format appropriately
            request.JO =;
            request.PanelNo =;

            // This reassignment works, as I see it correct in the below console.log statements
            event.request.payload.resource[idx] = request;

According to console.log, here is what I now have:

  resource: [
      JO: '2',
      PanelNo: '4',
      DR: '5',
      FK_WorkStatusId: 200

However, according to the error I get back from the DreamFactory API when trying to post, this is not what the data looks like at all:

    "error": {
        "code": 1000,
        "context": {
            "error": [
            "resource": [
                    "code": 400,
                    "context": null,
                    "message": "Required field 'fk_workstatusid' can not be NULL.",
                    "status_code": 400
        "message": "Batch Error: Not all requested records could be created.",
        "status_code": 500

NOTE: The lowercase/uppercase naming of the field is meaningless, as adding a second field with the lowercase name still results in this error message. From what I gather, the technique shown in the documentation seems to have problems with accurately working.

NOTE: Here is the sample from DF []

NOTE: The script is Active

NOTE: The script is allowed to modify the request payload

NOTE: If I take the data from the console.log statement, and put it into Insomnia or another tool, I can post to the database using the same API without issue, which IMO indicates an issue with this feature to modify an incoming request during POST

Any ideas?

So, it looks like you have to modify the content block of the JSON object for the incoming request, NOT the resource record(s). For instance, this works:

    // Above I made all of the changes to data I needed to, as my earlier example
    event.request.content = JSON.stringify(event.request.payload.resource);

    // Not having the `event.request.payload.resource` object means nothing for the call to succeed
    event.request.payload.resource = null;

Either DreamFactory is doing an awful job on their documentation, or they have introduced a very strange, nonsensical bug into the framework.