This topic contains 5 replies, has 0 voices, and was last updated by Godrules500 6 years, 7 months ago.
-
AuthorPosts
-
July 6, 2017 at 8:58 pm #18395
borncorpHey guys, just letting you know that I encountered an issue recently. I was trying to create a Suitelet “Available without Login” that uses a form and I was attaching a button and a clientscript to it, but guess what? The button doesn’t work. I checked the console and every time I call the button I get “require is not defined” error:
So I stripped the suitelet to the most barebones version and I still got the error. I verified with others and it seems to be a defect from SS2.0 External Suitelets.
At the end of the day I was able to run the code by hacking the dom like so:
Code:
form.addButton({
id : ‘custpage_mybutton’,
label : ‘MyButton’,
functionName : ‘runButtonClickAction’
});var fileContents = file.load(5835).getContents();
var field = form.addField({
id: ‘custpageinjectcode’,
type: ‘INLINEHTML’,
label: ‘Inject Code’
});
field.defaultValue = ““;
and as the clientscript file I have this:Code:
$(‘custpage_mybutton’).onclick = function(){ runButtonClickAction(); }function runButtonClickAction(){
alert(‘Button clicked’);
}Totally not recommended, but just throwing it out there.
This is a cached copy. Click here to see the original post. -
July 10, 2017 at 8:44 am #18396
david.smithIs your CS code available w/o login?
-
July 10, 2017 at 10:54 am #18397
borncorpOriginally posted by david.smith
View Post
Is your CS code available w/o login?
Yes, the file with the clientscript is available without login.
-
August 10, 2017 at 10:01 am #18398
Godrules500I tried modifying the above to add an onload function (which isn’t working). Do you know if there is a way to add an onload and use the N/ui/message module?
Also, the script I have that does follow your code, there is a button a text box. The button click works. However, when I hit enter in the textbox it takes me to a blank page. Know of a way to prevent this?
-
March 17, 2018 at 10:28 am #18399
Vesku1980Is it true that this feature is still like this, that you can’t run client script with External Suitelet?
-
March 29, 2018 at 6:59 am #18400
Godrules500This is changing in 2018.1 I believe. So you should be able to run client script on an external suitelet.
-
AuthorPosts
You must be logged in to reply to this topic.