I am trying to print messages in a client script, it used to work before but has suddently stopped recently. When I press F12 on the browser to view the console, I notice that there is a line that says 'Suppress=T', maybe all the messages are being suppressed somehow. This used to work earlier but somehow none of the message printing mechanism ( console.log, log.debug, dialog.alert) seem to be working. This used to work before and even if I create a copy of the form on sandbox, the issue does not go away. Has anyone else faced this? Attaching the sample code and screenshot from the console for your reference. Thanks in advance
define(['N/record','N/search','N/ui/dialog', 'N/log'], function (record, search, dialog, log) {
/**
*#NApiVersion 2.0
*#NScriptType ClientScript
*/
function pageInit(context) {
console.log('Console LOG - PageInit0001');
log.debug({
title: 'Customer First Name',
details: 'TEST LOG'
});
dialog.alert({
title: 'Announcement',
message: 'TEST Alert'
});
}
return {
pageInit: pageInit
}
});
Related
I want to write a command in my own bot that writes the content of the embedded text to a text channel.
Unfortunately, so far I've only managed to do it for plain text messages
Can someone help me?
I am asking for help here because I am a beginner "programmer" and I am clueless.
Thank you in advance for your help.
module.exports = {
name: 'test',
description: 'test',
execute (channel, message, Discord) {
message.channel.messages.fetch("902919303043637269")
.then(message => message.channel.send(message.content))
.catch(console.error);
}
}
You are getting the message correctly, and it has almost all the properties (since it's fetched). You may however want to change message in the .then to something else (since message is already declared). You can access content and embeds with these 2 properties:
Message.content
Message.embeds
Here is an example logging the content and embeds:
message.channel.messages.fetch("902919303043637269")
.then(msg => {
console.log(msg.content)
console.log(msg.embeds)
})
Here's the code to the popup.jsx file and the background index.js file. For starters, I'm just working with a simple alert. the way I've gone with the working is that the background makes note of any new tabs using chrome.tabs.onCreated() and sends a message to the popup once so,
the issue I feel I'm facing is that the popup isnt receiving the message sent by the background file. please help out if you can, this is the link to the Github repo.https://github.com/Brihadeeshrk/extension
popup.jsx
chrome.runtime.onMessage.addListener((req) => {
console.log("message: "+req.message)
if(req.type === 'newTabCreated') {
alert("new tab")
}
return true
})
background.js
chrome.tabs.onCreated.addListener(function() {
console.log('new tab created')
chrome.runtime.sendMessage({
type: "newTabCreated",
message: "new tab created121"
}, function() {
console.log("message sent")
})
})
I have the below script that I am trying to upload but am getting a Fail to evaluate script: All SuiteScript API Modules are unavailable while executing your define callback - error.
Not sure what I am doing wrong as I am basically following the example in the api.
Note: This is being done in Sandbox.
/**
* #NApiVersion 2.x
* #NScriptType Suitelet
* #NModuleScope SameAccount
*/
define(['N/email'],
/**
* #param {email} email
*/
function(email){
function sendEmail() {
var senderId = 34972;
var recipientEmail = 'email#example.com';
email.send({
author: senderId,
recipients: recipientEmail,
subject: 'Test Sample Email Module',
body: 'Thisis a test',
});
}
sendEmail();
});
If you are writing a Suitelet script in 2.0, you need to use the RETURN of your callback function. In your case, it will look something like the following:
return {
onRequest : sendEmail
};
May I also ask - is there any reason why you are trying to trigger an email send via a SUITELET? Assuming you want to trigger the email via the URL generated on the "script deployment" page of the Suitelet, you should consider including the ServerResponse call to write on your browser that the email was sent successfully. That will look something like the following:
context.response.write('Email now sent');
Lastly - I also see that you have wrongfully used a comma at the end of your 'email.send' object. Remove the comma as pointed out below:
email.send({
author: senderId,
recipients: recipientEmail,
subject: 'Test Sample Email Module',
body: 'Thisis a test', <---- REMOVE COMMA!
});
Hope this helps.
That is not a correct suitelet and you are calling your function inside the define.
The functions returned from the define() may call Netsuite functions but your sendemail function is calling Netsuite APIs “inside” the define.
If you are just trying to wrap your head around SuiteScript change your define to a require and call that code in a console window.
Otherwise review the suitelet docs and return the correct function object.
Here's a straight forward answer... comment out anything that isn't native suite script code... your custom modules, classes and Upload. then edit it in the file cabinet and and un comment your stuff
I've built a bot that asks user to upload an attachment. But I also want to give the ability to the user to just type any text instead of uploading an attachment, but whenever I do that it says
I didn't receive a file. Please try again.
In the command line, I can see it says no intent handler found for null. How do I handle these nulls/incorrect inputs?
Sample code:
intents.matchesAny([/lost and found/i], [
function (session) {
builder.Prompts.attachment(session,"Please upload a picture of the item.");
},
function (session) {
session.endConversation('Thank you');
}
]);
Per your issue message, no intent handler found for null, which seems that you are using builder.IntentDialog, and the issue means that your bot didn't match any intents provided in your bot.
Also I notice that your are using intents.matchesAny, according to the comment:
Invokes a handler when any of the given intents are detected in the users utterance. So I think you forget to set such intent lost and found in your LUIS server.
If you want to trigger any miss catched user utterance, you can try to use:
intents.onDefault([
function (session) {
builder.Prompts.attachment(session,"Please upload a picture of the item.");
},
function (session) {
session.endConversation('Thank you');
}
]);
I'm trying to generate report with cucumber-html-reporter. On it's GitHub page I saw a fancy bootstrap report, where a screenshot is attached to the failed step itself.
https://www.npmjs.com/package/cucumber-html-reporter
I'm working with cucumber-js 2.3.1 and cannot attach a screenshot to the StepResult.
I can attach a screenshot only in the After hook, where the World is available.
After(function (scenario) {
if (scenario.isFailed()) {
const world = this;
return browser.takeScreenshot().then(function (screenShot) {
world.attach(screenShot, 'image/png');
});
}
});
This is working fine, but unfortunately the screenshot is attached to the "After" step, not to the failed one.
I have tried this:
registerHandler('StepResult', function (StepResult) {
if (StepResult.isFailed()) {
return browser.takeScreenshot().then(function (screenShot) {
var decodedImage = new Buffer(screenShot, 'base64');
StepResult.attachments.push({
data: decodedImage.toString('base64'),
mimeType: 'image/png'
});
});
}
});
It works, the attachment is added, but not rendered into the report, since the cucumber json_formatter.handleStepResult is executed BEFORE the 'StepResult' hook is invoked.
Can someone show me a solution?
Thanks!
The reporter would show the Screenshot link in the failed STEP if you capture screenshot in the STEP itself. If you capture at the AFTER hook, it will show in the hook.
On the example shown in the Github page, it attaches the screenshot to the Step, and so it shows to the "then" step. Please take a look at here for more info.