You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

NetSuite:如何通过REST API创建关联发票的部分贷项通知单

如何通过NetSuite REST API创建关联发票的部分贷项通知单

我需要创建关联至发票的部分贷项通知单,例如贷项通知单金额为100€,对应发票金额为500€。

常规的发票转贷项通知单方法无法满足需求:

  • 不带请求体转换时,生成的贷项通知单金额与原发票一致,不符合部分贷项的要求;
  • 携带请求体转换时,会触发已知的"Unexpected error"。

此前了解到可以创建独立发票并关联销售订单行项,效果等同于从销售订单生成发票。现在想知道是否能用类似方式创建关联发票的贷项通知单,但多次尝试均报错,具体情况如下:

尝试的请求示例及报错

第一次请求(doc嵌套id)

{    
    "entity": { "id": "1957" },    
    "trandate":"2023-11-21",    
    "startdate":"2023-11-21",    
    "duedate":"2023-12-31",    
    "memo": "Testing to create credit memo",    
    "salesrep":"209",    
    "item":{        
        "items":[            
            {                
                "description": "Test description",                
                "item": {                    
                    "id": "632"                
                },                
                "quantity": 0.1,                
                "rate": 2000.0,                
                "line": 1            
            }        
        ]    
    },    
    "apply": {        
        "items" : [            
            {                
                "amount": 200,                
                "apply": true,                
                "doc": {                     
                    "id" : 20067 // 销售订单ID                
                }            
            }        
        ]    
    }
}

返回报错:

{            
    "detail": "Error while accessing a resource. You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.",            
    "o:errorPath": "apply",            
    "o:errorCode": "USER_ERROR"        
}

第二次请求(doc直接传ID)

修改doc的设置方式后,请求内容如下:

{    
    "entity": { "id": "1957" },    
    "trandate":"2023-11-21",    
    "startdate":"2023-11-21",    
    "duedate":"2023-12-31",    
    "memo": "Testing to create credit memo",    
    "salesrep":"209",    
    "item":{        
        "items":[            
            {                
                "description": "Test description",                
                "item": {                    
                    "id": "632"                
                },                
                "quantity": 0.1,                
                "rate": 2000.0,                
                "line": 1            
            }        
        ]    
    },    
    "apply": {        
        "items" : [            
            {                
                "amount": 200,                
                "apply": true,                
                "doc":  20067            
            }        
        ]    
    }
}

返回报错:

"status": 400,    
"o:errorDetails": [        
    {            
        "detail": "Invalid value for the resource or sub-resource field 'doc'. Provide a valid value.",            
        "o:errorPath": "doc",            
        "o:errorCode": "INVALID_VALUE"        
    }    
]

我还尝试过添加行号0、1,移除doc等操作,但始终无法解决报错问题,求可行的解决思路。

内容的提问来源于stack exchange,提问作者AnthoVdo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 02:40:04