RE: How to Invoke Button Function with Client Script

I’ve added a button with a beforeLoad UE script. When the user clicks the button, it should create a new instance of a custom record. As I understand, you need a client script to handle the button click. I seem to be having trouble invoking my button function, though. I set the name of the function when I created the button in the UE script. Then I defined the named function in my client script. But when the button is clicked, the function in the client script is never invoked. Anyone know what I’m missing?

mmascitto Beginner Asked on September 16, 2019 in SuiteScript.
Add Comment
9 Answers

You have to open the Console on your browser as it seems to me your client script is throwing an error, particularly on this line:


record.create({

type : 'custrecord_trainevent'

});

‘custrecord_trainevent’ is not a record type, it is a field name. You have to change it to the correct ID of the Custom Record type.

I tried mimicking your script and it returned this error on the Console: uncaught exception: {“type”:”error.SuiteScriptError”,”name”:”INVALID_RCRD_TYPE”,”message”:”The record type [CUSTRECORD_TRAINEVENT] is invalid.

If the client function is still not getting called even after correcting this line, you have to continue debugging until the client script is 100% error free.

 

Beginner Answered on September 16, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.