Is it possible to create a transfer record? I am a...
# suitescript
b
Is it possible to create a transfer record? I am able to
record.load({type: 'transfer', id: internalIdHere})
. However, when I try to create one with fields (
fromaccount
,
toaccount
, and
fromamount
) I get
"document" is not defined
. Any thoughts? Code in ๐Ÿงต
Copy code
/**
 *@NApiVersion 2.x
 *@NScriptType Restlet
 */
define(['N/record', 'N/log', 'N/error'], function (record, log, error) {
  function post() {
    // this works
    // const transfer = record.load({
    //   type: 'transfer',
    //   id: 616,
    // });
    //
    // log.debug('Transfer: ', JSON.stringify(transfer));

    const newTransfer = record.create({
      type: 'transfer',
    });

    newTransfer.setValue({
      fieldId: 'fromaccount', 
      value: 313
    });
    newTransfer.setValue({
      fieldId: 'toaccount', 
      value: 213
    });
    newTransfer.setValue({
      fieldId: 'fromamount', 
      value: '112.14'
    });

    // this fails
    return newTransfer.save()
  }

  return {
    post: post,
  };
});
There is also a checkbox which I tried to set to
true
Copy code
โ”†     newTransfer.setValue({    
โ”†       fieldId: 'generatetranidonsave',    
โ”†       value: true,    
โ”†     });
b
b
I am guessing since
transfer
is not in this list, it just isn't supported at all?
b
you take your chances when you go off list, in this case you got a record that has logic that only works in a browser
๐Ÿ’” 1
e
are you referring to
inventorytransfer
b
I am interested in bank transfers.
If anyone else reads this, I was informed by our accounting team that these are usually handled via journal entries.
(Which are a supported record type and easy to create in suitescript)
w
Funny, I recently pushed out accounting teams to use bank transfers to be able to get the exact exchange rate. Large amounts with roundings tend to create small differences on the bank account. The drawbacks so far is unscriptable and no ability to change form or attach files.