適用
製品: NetSuite 2024.2
シナリオ
PDF、JPGなどのファイルを必要とするレコードに新しいファイルをアップロードします。
解決策
このような機能を実現するには、2つのリクエストを使用します。
1. NetSuiteのファイルキャビネットにファイルをアップロードするためにADDリクエストを使用します。ファイルは文字列として表す必要があります。
<soapenv:Envelope
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:docFileCab='urn:filecabinet_2019_2.documents.webservices.netsuite.com'
xmlns:platformMsgs='urn:messages_2019_2.platform.webservices.netsuite.com'>
<soapenv:Header/>
<soapenv:Body>
<add xsi:type='platformMsgs:AddRequest'>
<record xsi:type='docFileCab:File'>
<name xsi:type='xsd:string'>TestFile.jpg</name>
<fileType xsi:type='xsd:string'>_JPGIMAGE</fileType>
<content xsi:type='xsd:base64Binary'>/9j/4AAQSkZJRgABAQEASABIAAD/CgAAAAAAAAAAAA ...(content omitted)</content>
</record>
</add>
</soapenv:Body>
</soapenv:Envelope>
2. 特定のレコードに対するADDリクエストを使用し、最近アップロードされたファイルのファイルIDを指定します
<soapenv:Envelope
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:listEmp='urn:employees_2019_2.lists.webservices.netsuite.com'
xmlns:platformCore='urn:core_2019_2.platform.webservices.netsuite.com'
xmlns:platformMsgs='urn:messages_2019_2.platform.webservices.netsuite.com'>
<soapenv:Header/>
<soapenv:Body>
<add xsi:type='platformMsgs:AddRequest'>
<record xsi:type='listEmp:Employee'>
<customFieldList xsi:type='platformCore:CustomFieldList'>
<customField internalId='123' scriptId='customscript_employeepicture' xsi:type='platformCore:SelectCustomFieldRef'>