I been working on an extension and I'm ready to release it.
I been learning a lot from all of your guyses experience and I'm ready to help if I can.
I need help with my notification pop up, currently it sometimes works,it always works on the second run.
Anyone has dealt with this before?
chrome.notifications.create(
'success',{
type: 'basic',
iconUrl: 'coo.png',
title: "coo",
message: "sent to: " +title ,
silent:true,
priority:0
},
function(){});
chrome.notifications.clear('success', function (){}) });
}
This is what I'm doing to create the notification, perhaps use update instead of create?
Thanks all :)
Related
I recently started converting my commands to slash commands. I successfully did that, but I'm missing one functionality that I can't seem to find how to do. I want to delete the response I've given to an interaction (so the callback), and if possible after a certain amount of time (but that isn't required for my Discord bot).
For example, my callback is posted like this:
client.api.interactions(interaction.id, interaction.token).callback.post({
data: {
type: 4,
data: {
content: 'Hello World!'
}
}
})
And I want to delete that response immediately (or timed, but not in this example).
In the Discord docs (this page) is standing that it is possible, but I don't know how exactly to do that.
The specific code I already tried is this, but when the code is executed I'm getting the METHOD NOT ALLOWED error:
client.api.interactions(interaction.id, interaction.token).callback.delete()
I hope you can help me, thanks in advance.
Sorry for my bad English 😉
you can just fetch this :
https://discordapp.com/api/webhooks/{APP ID}/{Interaction Token}/messages/#original
Like That :
fetch("https://discordapp.com/api/webhooks/123456789012345678/${interaction.token}/messages/#original",
{
method: "DELETE"
}
);
https://discord.com/developers/docs/interactions/slash-commands#delete-original-interaction-response
I have this client script which copies the line number entered in Copy line# and creates new lines from number of lines entered in Copy #Times.
This thing takes time when you increase the number of lines you require to copy. So can we give any processing animation till all the lines are set so user dont have to worry?
I have tried giving dialog.create but it didnt work. I want the animation to stay until script is executing and after that stop.
var options = {
title: 'Alert',
message: 'Processing. Please wait.',
buttons: [{
label: 'OKK...',
value: 1
},
]
};
dialog.create(options).then(success)
return (true);
success is a function I am calling.
The N/ui/dialog module is intended for showing dismissable messages, and won't really work for progress bars as you cannot hide the buttons, nor close it via code. I would recommend looking at a third party library. A very popular one is SweetAlert2, and there is some sample code on the NetSuite Professionals site for using it with NetSuite.
If you just want a quick hack, you could just used the Ext.js library that NetSuite includes by default on all pages. However I would highly recommend not doing so for any production code because NetSuite could update or remove it at any time in a future upgrade.
var messageBox = Ext.MessageBox.show({
title: 'Lines are being copied...',
msg: 'This may take a couple minutes',
wait: true,
width: 250
});
// your work here
messageBox.hide()
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 tryThisand 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??
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.
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.
I have a SuiteScript which is getting triggered on AfterSubmit of any Case update. It is working fine for normal updates.
But when I try to edit a Case in-line(through case search), the event is not getting triggered.
Do I need to configure anything specific to handle the in-line edit during the script deployment?
Please find the script which I am using to identify the xedit operation.
function handleSupportCaseCreateUpdateReqeust(type, form, request) {
try {
if(type == 'xedit'){
nlapiLogExecution('AUDIT', 'TFSNSIntegrator Log', 'Type of the event is :'+ type);
}
} catch (e) {
nlapiLogExecution('ERROR', 'Exception', e.message);
}
This is a simple thought, but may as well check - have you confirmed that your Deployment's Log Level is set to Audit? If not, that could be why you aren't seeing that in the execution log.
Through NetSuite Support, I figured out the issue.
The issue was with the option I selected to deploy the SuiteScript. I selected 'Edit' event to trigger the script, since we dont have a option "xedit". Actually we should not select any particular event. I just deployed it with our selecting any specific event and it started to work.
Thanks all for your replies!
I have a problem when I developed my website with Google+ sign-in:
I did step by step that the doc told me but I always failed at step4:
https://developers.google.com/+/web/signin/
the result was always ""immediate_failed" - Could not automatially log in the user", I just don't kown why, can anyone help me, thanks very much! :-(
Note that in the sample code you pointed to, the "immediate_failed" check is commented out. This is intentional, since the first time a user encounters the Sign-in button on the page, it will fail.
The reason it fails is that when the page first loads, before the user even presses the button, a request is sent to Google to determine if the user has already logged in (via Google or another site, for example). If they are - there is no need for them to log in again, so the button never needs to be shown. But if they have not been logged in already, you will get the "immediate_failed" response, and will need to either show (or not clear) the button.
tl;dr - Don't worry aout getting immediate_failed when the page first loads. This is normal.
As a workaround I use gapi.auth.authorize method in the gapi.auth.signIn callback. Here is my code:
gapi.auth.signIn({
'callback': gPlusLoginCallback
});
function gPlusLoginCallback(authResult) {
if (authResult['status']['signed_in']) {
doSmth(authRes['access_token']);
} else if (authResult['error'] == "immediate_failed") {
gapi.auth.authorize({
client_id: gplusClientId,
scope: 'https://www.googleapis.com/auth/plus.login email',
immediate: true
}, function (authRes) {
if (authRes['status']['signed_in']) {
doSmth(authRes['access_token']);
}
});
}
}
function doSmth(accessToken){
//Do smth
}
Change this setting "immediate: true", to be false " immediate: false".
But if you like to make more complex implementation look at the first sample here https://developers.google.com/api-client-library/javascript/start/start-js. You have to calls to Google's "gapi.auth.authorize({...", the first one with "immediate: true", and the second one with "immediate: false".
The question is old but I faced this issue recently.
In my case, it was because I specified the URI parameter prompt to none. I guess Google doesn't like that if the user has never been logged to your platform before.
Whenever I changed that to consent or totally removed it, it worked great.
In my case, the error was because of explicitly specifying the authorization parameter prompt to 'none',similar to a previous answer.
It worked for me by specifying prompt=None or as per the official docs,you may skip this parameter.