Is it possible from the functionName of the form.a...
# ask-stanley-ai
r
Is it possible from the functionName of the form.addButton to call a http.get?
c
AI generated answer (using internal Slack threads):
Based on the conversations provided, it seems that the
functionName
parameter of the
form.addButton
method in SuiteScript is used to specify a client-side JavaScript function to be executed when the button is clicked. This function should be defined in a client script file that is associated with the form. However, the
http.get
method is a server-side SuiteScript API method, and it cannot be directly called from a client-side function. Therefore, it is not possible to call
http.get
directly from the
functionName
of the
form.addButton
method. If you need to perform a
http.get
request as a result of a button click, you would need to set up a Suitelet or Restlet that performs the
http.get
request, and then have the client-side function make a request to that Suitelet or Restlet. Here is an example of how you might set up the button:
Copy code
javascript
form.addButton({
    id: 'custpage_mybutton',
    label: 'My Button',
    functionName: 'myButtonFunction'
});
And then in your client script:
Copy code
javascript
function myButtonFunction() {
    var suiteletUrl = '<https://myaccount.suitetalk.api.netsuite.com/app/site/hosting/scriptlet.nl?script=123&deploy=1>';
    window.open(suiteletUrl, '_blank');
}
In this example, when the button is clicked, it opens a new window with the URL of the Suitelet that performs the
http.get
request. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.820640087
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.81807965
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.817578375
Please provide your feedback on this answer.