Global API
...
Requests
Upload File
Attach File to Transaction
4min
netsuite api does not support attaching a file directly to the transaction, so we need minor customizations in netsuite and salesforce to attach the file to a transaction in netsuite create a custom field of type document on the transaction to which you want to attach the file in salesforce once you create the custom field in netsuite, visit the breadwinner tab, go to the custom fields section, and click "fetch custom fields " you can see the created custom field here with the checkbox disabled do the following steps create the field of type text manually in salesforce with the api name shown in the custom fields section, i e , for example if your netsuite api name is custbody44, you must give the salesforce api name as ncf body44 c refer to the sample screenshot attached below after creating the field in salesforce, give the required permissions at the profile level to cross check whether the field is created correctly, visit the custom fields section the disabled checkbox should be checked to link the document to this field, pass the internal id of the file to that custom field using the update action in global api the following is an example of updating the sales order by passing the file's internal id to the custom field // create a map to store all the data of a sales order map\<string, object> nssalesorder = new map\<string, object>(); nssalesorder put('internalid', '122466'); // pass the internalid of the sales order // initialize the sales order custom fields list\<object> socustomfieldlist = new list\<object>(); map\<string,object> socustomfield = new map\<string,object>(); socustomfield put('fieldtype', 'string'); socustomfield put('scriptid', 'custbody44'); socustomfield put('value', '2178'); // pass the internalid of the file socustomfieldlist add(socustomfield); // add the sales order custom fields nssalesorder put('customfieldlist', new map\<string,object>{'customfield'=>socustomfieldlist}); // initialize the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('salesorders', new list\<object>{nssalesorder}); string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version', '1 0'); reqobj put('action', 'updatesalesorder'); reqobj put('requestjson', reqjson); // place a request to breadwinner global api map\<string, object> resp = breadwinner ns breadwinnernetsuiteapi call(reqobj); system debug(resp);