why is this error occuring? I am trying to create ...
# suitescript
r
why is this error occuring? I am trying to create a transfer record , it is not mentioned in record.type or scriptable but I am just doing creating a record and saving it.
Copy code
ReferenceError: "document" is not defined. (NLRecordScripting.scriptInit$lib#326)
Copy code
let createTransfer = record.create({
                type: 'transfer',
            });

            createTransfer.setValue('fromaccount', 218);
            createTransfer.setValue('toaccount', 219);
            createTransfer.setValue('trandate', new Date());
            createTransfer.setValue('fromamount', 1);
            createTransfer.setValue('toamount', 2);

            let transferId = createTransfer.save();

            log.debug('transferId', transferId);
m
Permissions ?
r
refernce error
permissions for what?
script or record
I am able to create record in UI
m
UI most likely has admin access. Script uses a role you created, the role is missing some permissions.
r
message has been deleted
all given
i changed it to all roles only
still same
what it could be
j
The issue is that you cannot create "transfer" records via script yet.
The document it's referencing is the "document" in the DOM. Interestingly you can create a transfer record via a console script if I recall correctly. Just not with an actual deployed SuiteScript.
r
so we cannot do anything
I mean I dont its possible to create via console everyrime
please suggest me an alternative
k
Could you just use the URL and pass the record value by using record.fieldid in the parameters of the url. Although this won’t create and save the record it will open in create mode and pre-fill the values that you want?
s
I don't see "transfer" in the record.Type enumeration, and it's not in the list of supported suitescript types which suggests to me that what you are doing is not supported/allowed.