Hi All! This is my post request of a restlet funct...
# general
g
Hi All! This is my post request of a restlet function
Copy code
function _post(context) {
    try {
      var rec = record.create({ type: context.recordtype, isDynamic: true });
      for (var fldName in context) {
        if (context.hasOwnProperty(fldName)) {
          if (fldName !== "recordtype" && fldName !== "sublists") {
            if (fldName.indexOf("date") !== -1) {
              rec.setValue(fldName, new Date(context[fldName]));
            } else {
              rec.setValue(fldName, context[fldName]);
            }
          }
        }
      }
      var recordId = rec.save();
      return JSON.stringify(recordId);
    } catch (err) {
      return JSON.stringify(err);
    }
  }
And this is my object which i am sending data
Copy code
const data = {
      recordtype: "opportunity",
      entity: entity,
      custbodyreceiveddate:applicationData.createdOn,
      entitystatus: "10",
      salesrep: 8,
      custbodyactionstatus: 4,
      department: 4,
      cseg_property: property,
      custbodytransactionunit: unit,
      custbody_ncrr_opp_orig_portal_num: applicationTitle,
      custbody_ncrr_opp_hntb_num: HNTBFileNumber,
      custbodyportal_link:link,
      externalid: `${applicationID}_OPPORTUNITY`,
    };
here custbodyreceiveddate is a date field so i am converting it to Date Object in the Reselet Function like this
Copy code
rec.setValue(fldName, new Date(context[fldName]));
But the Date Field is not adding and it doesnt give any error as well The Received Date is Empty any solution for this?