This was just working... not sure what happened.
# suitescript
r
This was just working... not sure what happened.
Copy code
{
  "id": "8302275",
  "type": "projecttask",
  "isDynamic": true,
  "fields": {
    "custevent_proj_task_name": "New Task",
    "eventid": "1",
    "wfinstances": "",
    "nlloc": "2",
    "nlsub": "1",
    "custevent_proj_billable": "F",
    "ismilestone": "T",
    "_eml_nkey_": "0",
    "custevent_imported_from_oa": "0",
    "starttime": "9:00 am",
    "type": "projecttask",
    "lateend": "2/5/2019",
    "title": "New Task",
    "startdate": "2/5/2019",
    "nsapiCT": "1549392337098",
    "sys_id": "11865746099945879",
    "nluser": "378495",
    "isbudgetrebuilding": "F",
    "estimatedwork": "0",
    "isoncriticalpath": "T",
    "nldept": "25",
    "isbaselineset": "F",
    "company": "402485",
    "id": "8302275",
    "latestart": "2/5/2019",
    "nonbillabletask": "F",
    "custevent_serv_item_updated": "F",
    "owner": "378495",
    "constrainttype": "ASAP",
    "templatestored": "F",
    "actualwork": "0:00",
    "slackminutes": "0",
    "entryformquerystring": "e=T&id=8302275",
    "nlrole": "3",
    "baserecordtype": "projectTask",
    "priority": "MEDIUM",
    "fxrate": "1",
    "percenttimecomplete": "0.0%",
    "enddate": "2/5/2019",
    "customform": "30",
    "custevent_do_not_assign_resources": "F",
    "custevent_service_item_for_this_task": "2274",
    "remainingwork": "0:00",
    "custevent_project_task_link": "402485",
    "issummarytask": "T",
    "status": "NOTSTART"
  },
  "sublists": {
    "assignee": {
      "currentline": {
        "billingclass": "",
        "cost": "",
        "estimatedwork": "",
        "id": "",
        "price": "",
        "resource": "",
        "serviceitem": "",
        "sys_id": "-11865746099957007",
        "sys_parentid": "11865746099945879",
        "unitcost": "",
        "unitprice": "",
        "units": "100.0%",
        "#": "1"
      }
    },
    "predecessor": {
      "currentline": {
        "enddate": "",
        "lagdays": "",
        "startdate": "",
        "sys_id": "-11865746100039815",
        "sys_parentid": "11865746099945879",
        "task": "",
        "type": "",
        "#": "1"
      }
    }
  }
}
Error at line 25.
Tried with taskRec.isDynamic = true and false.
j
When you do a map reduce script, the values passed into map and reduce are strings.
When you JSON.stringify an object it loses all of its methods
You need to load the task record using record.load
to produce a record object, which has methods
r
can't parse it?
the record loads were slowing it down.
j
No. Try doing this in your console
Copy code
var x = {
  hello: function() {
    console.log("Hello");
  }
};
x.hello(); // works fine

var x2 = JSON.parse(JSON.stringify(x));
x2.hello(); // error, x2.hello is not a function