How to specify subscriptionlinetype in Netsuite Rest API - Creating Subscription

13 Views Asked by At

I'm integrating Netsuite with an internal application of the organization. I've successfully created the subscription with fixed line numbers. However, I'm encountering difficulty determining the line number corresponding to the service sent and belonging to the subscription plan. Initially, I only receive the externalID of the service and later obtain the internalID.

Therefore, I am sending the internal ID of the Item in subscriptionLineElement, but I am not getting details on what to exactly send in subscriptionLineType and get an error.

I use this documentation as guide, but no specify it a lot about subscriptionlinetypes: Netsuite Create SubscriptionLine Object

The error returned by the API is as follows:

{
    "type": "https://www.rfc-editor.org/rfc/rfc9110.html#section-15.5.1",
    "title": "Bad Request",
    "status": 400,
    "o:errorDetails": [
        {
            "detail": "Error while accessing a resource. You have entered an Invalid Field Value Service for the following field: subscriptionlinetype.",
            "o:errorPath": "subscriptionLine.items[0]",
            "o:errorCode": "USER_ERROR"
        }
    ]
}

Request Body:

{
    "name": "Subscription 001",
    "customer": 542, 
    "billingAccount": 235, 
    "subscriptionPlan": 1065, 
    "defaultRenewalPlan": {"id" : 1065}, 
    "priceBook": 112, 
    "defaultRenewalPriceBook": {"id" : 112}, 
    "initialTerm": {"id" : -102}, 
    "defaultRenewalTerm": {"id" : 2},
    "startDate": "2024-4-01",
    "endDate": "2024-8-01",
    "autoRenewal": true,
    "defaultRenewalTranType": "SalesOrd",
    "defaultRenewalMethod": "CREATE_NEW_SUBSCRIPTION",
    "subscriptionline": {
        "items": 
        [
            {
                "status": "DRAFT",
                "billingMode": "IN_ADVANCE",
                "isincluded": true,
                "item": {
                    "id": 620,
                    "refName": "Enterprise Plan"
                },
                "subscriptionLineType" { //  problem here
                    "id": "Service",
                    "refName": "Service"
                }
            }
        ]
    },
    "priceinterval": {
        "items": [
            {
                "quantity": 3,
                "repeatEvery": 1,
                "frequency": "MONTHLY" 
            }
        ]
    }
} 

Would really appreciate the help, or even just pointing me to the right direction. Thanks a lot!

0

There are 0 best solutions below