Has anyone ever had maximum call stack reached err...
# suitescript
j
Has anyone ever had maximum call stack reached errors when using default values to create a transaction? When I try and create a dynamic record with a default value (entity) in a client script it breaks where as in a restlet it works fine.
Further weirdness, when I set the entity it seems to cause the maximum call stack issue too. Anyone seen before?
a
Where are setting it in the client script? On page init?
@jmacdonald
j
The client script is running from a button press, the button is added by a UE script. I'm using the same code (it's from a library) file, it creates a record and uses default values to set the entity/customer. Please see a snippet below. var transactionRecord = record.create({ type: recordType, isDynamic: true, defaultValues: { entity: currentTransactionData['entity'] } });
n
have you checked to see what value is in currentTransactionData['entity']?
j
Yeah it's just an ID: 14121
recordType is
creditmemo
a
@jmacdonald Are you sure its
entity
and not
entityid
? I also have a lot of problems with default values and usually don't use it. I set after record.create, but I think you said that also didn't work correct? Also if you are getting maximum call stack, only on client scripts, I find that usually means you got stuck in an endless loop, so do you have another fieldchanged event which is getting invoked again with your button click?
j
Yeah it's definitely
entity
as the code works in a UE script. If I create a record in a client script, for example I'm on a Sales Order Client Script, then I create a new record Credit Memo, that shouldn't fire any client script on the credit memo right?
There is no loop, really weird literally just set the entity and it seems to break. I think I'm going to log a case for this, the stack trace I get can be seen below:
It looks like it is related to some client script events but I have no idea why they are firing?
n
could it be a fieldChange type event triggered by you setting the entity?
j
I assume it's something along those lines but when I create a record using record.create then a client script shouldn't be firing right?
n
You'd think so but someone blew up record.create for customer records here with a WorkFlow which I didn't think would trigger from the debugger console so my sanity has recently been shaken...
a
@jmacdonald Strange! Yesterday I needed to use record.create in a user event. I figured it was easier to use the chrome console (which is front-end, essentially a client script) for testing, and then I could transfer it over to my user-event script when needed. After hours of it not working front-end, I realized it worked right away when I tested it back end in the script debugger. I'm wondering if the record.create has limited capabilites in front-end
j
I think I'm going to have to log a case with NetSuite, I managed to get it to set the entity by doing ignoreFieldChange but then I get invalid reference keys for class and location which is weird.