Reputation: 342
I'm trying to add a button to the current record with the Client Script button definition on a script record, but for some reason it's not finding my function. I'm returning my function tryThis
and there is a button on the page which I created on the script record with the function tryThis
defined in the appropriate field, but the code doesn't run. Here's my script:
define (['N/currentRecord','N/search','N/record'] ,
function(currentRecord,search,record) {
function tryThis(context){
log.debug({
title: 'try this',
details: 'try this'
});
}
function pageInit(context) {
}
return {
pageInit: pageInit,
tryThis: tryThis
};
});
Nothing happens :(
Yes, the script is deployed.
How can I use this button on a client script??
Upvotes: 1
Views: 3669
Reputation: 304
At the bottom of your Client Script record in Edit mode you will find where you can easily set the button and function to call.
Upvotes: 0
Reputation: 5231
This doesn't exactly answer your question directly, but I hope it may help. I tested this, and there appears to be nothing wrong with the way you've set it up - the only thing that seems to be not working is the log
module, which I've come across before in client scripts.
Try running your function using a console.log()
or alert()
instead (both work for me).
Hopefully someone with more detailed knowledge of the N/log
module's design and behavior will chip in, as the documentation seems to indicate that this should work.
Upvotes: 4