I used record.save() function in clientscript to t...
# general
v
I used record.save() function in clientscript to take the id of the record, but its not saved. what could be the reason? could anyone please help?
m
In SuiteScript 2.0 record module has not save method. record.Record object has save method and returns the internal id of the new or edited record.
v
so should i include the module? what and where should i include? Thanks in advance
m
Don't understand well what you mean. You are asking to define modules in SuiteScript 2.0 ?
v
yes i defined the record module
still it didnt return the id of the record.
m
But record module has no save method. record.Record object has save method.
v
how can i do that?
m
Please share your code. I will check and correct.
v
var recipient = record.create({ type: record.Type.CUSTOMER, isDynamic: true }); log.debug('recipient',recipient); recipient.setValue({ fieldId: 'subsidiary', value: '15' }); recipient.setValue({ fieldId: 'companyname', value: 'Test Company' + timeStamp }); recipient.setValue({ fieldId: 'email', value: recipientEmail });var recipientId = recipient.save({ enableSourcing: false, ignoreMandatoryFields: false});
m
There is no problem in the code snippet. Are there any exceptions logged ?
And if it's Client Script, then you can easily log using console. console.log('xxxxx');
Please use try ... catch and check log.