This topic contains 2 replies, has 2 voices, and was last updated by Saravanan J 3 years, 5 months ago.

  • Author
    Posts
  • #18037 Score: 0

    jshepler
    • Contributions: 0
    • Level 1
    • ☆

    The error:

    Code:
    {
    “type”: “error.SuiteScriptError”,
    “name”: “UNEXPECTED_ERROR”,
    “message”: null,
    “stack”: [“createRecord(N/record)”,
    (/SuiteScripts/jshepler/RL_sheptest_rt.js:8)”,
    “createRecord(N/record)”],
    “cause”: {
    “type”: “internal error”,
    “code”: “UNEXPECTED_ERROR”,
    “details”: null,
    “userEvent”: null,
    “stackTrace”: [“createRecord(N/record)”,
    (/SuiteScripts/jshepler/RL_sheptest_rt.js:8)”,
    “createRecord(N/record)”],
    “notifyOff”: false
    },
    “id”: “076c1977-d483-4e48-a5a5-0f61f3863b9a-2d323031382e30322e3039”,
    “notifyOff”: false
    }
    Code to reproduce it:

    Code:
    /**
    * @NApiVersion 2.x
    * @NScriptType Restlet
    */
    define([“require”, “exports”, “N/record”], function (require, exports, record) {
    Object.defineProperty(exports, “__esModule”, { value: true });
    var _get = function (request) {
    var changeOrder = record.create({ type: record.Type.SUBSCRIPTION_CHANGE_ORDER });
    };
    exports.get = _get;
    });
    I haven’t had any issues creating other record types so far. I think this is an internal bug. Any ideas?

    On a related note, what I’m trying to accomplish is using the api to do signups. I can create a customer, add a credit card to the customer, create a billing account, and create a subscription. I then update the items to set status to “pending activation”. I now need to activate the subscription/lines. Is there is a way to do that without doing a subscription change order? Or maybe a way to have them start out already activated?
    This is a cached copy. Click here to see the original post.

  • #18038 Score: 0

    jshepler
    • Contributions: 0
    • Level 1
    • ☆

    For anyone who might run into the same issue, the issue is there are some required parameters that need to be sent in the call to create the record that was not documented anywhere that I could find.

    record.create has an optional parameter to specify “defaults”. In my case, I had to pass the subscription id and the action:

    Code:
    var rec = record.create({ type: record.Type.SUBSCRIPTION_CHANGE_ORDER, defaultValues: { subscription: 610, action: “ACTIVATE” } });
    Presumably because it needs to load the sublist “subline” so you can mark which subscription line item(s) to activate. Again, not documented in obvious places, like https://system.na2.netsuite.com/app/…493322182.html

  • #26139 Score: 0

    Saravanan J
    Member
    • Contributions: 1
    • Level 1
    • ☆
    @saravanan_j

    Hi <span style=”background-color: #fbfbfb; color: #606060; font-family: Montserrat; font-size: 12px; text-align: center;”>jshepler,</span>

    I signed up just to say thank you for your comment. This saved me a lot of hours. Hope you see this 🙂

    Thanks,
    SJ

You must be logged in to reply to this topic.