I have a Lightning Aura component that is added on the Opportunity record detail page. When I update an Opportunity record and refresh the page, the below error pops up.
Uncaught Error in $A.getCallback() [Value is not a string, ObjectId, or FieldId.]
throws at https://xxxinstance.lightning.force.com/auraFW/javascript/dOMRLHt4yryfVjId3qhSww/aura_prod.js:43:15. Caused by: Error in $A.getCallback() [Value is not a string, ObjectId, or FieldId.]
I see the console log and even after enabling Lightning debug mode, I don't see any error in the console and neither in the debug logs.
var action = component.get("c.getChecklist");
action.setParams({
"recordId" : component.get("v.recordId")
});
action.setCallback(this, function(a) {
if (a.getState() === "SUCCESS") {
if(component.isValid()) {
var returnValue = a.getReturnValue();
if(returnValue != null){
else{
}
}
}
});
$A.enqueueAction(action);
Related
I am using a quick action on case object to close the case with the help of aura component.
In aura component I am using the below code to get the work items related to agent and close them:
omniAPI.getAgentWorks().then(function(result) {
var works = JSON.parse(result.works);
console.log('Works : ',works);
//how to get current case's work ID
var work = works[0];
console.log('Works[0] : ',work);
// Update and add condition
//add if condition
omniAPI.closeAgentWork({workId: work.workId}).then(function(res) {
if (res) {
console.log("Closed work successfully");
var workspaceAPI = cmp.find("workspace");
workspaceAPI.getFocusedTabInfo().then(function(response) {
var focusedTabId = response.tabId;
workspaceAPI.closeTab({tabId: focusedTabId});
})
.catch(function(error) {
console.log(error);
});
} else {
console.log("Close work failed");
}
}).catch(function(error) {
console.log(error);
});
});
here getAgentWork is retrieving all the work item related to the agent,how do I figure out the current case's workID? so that I can close only that workitem using omniAPI.closeAgentWork({workId: work.workId}).
I try to do a anti link bot discord that only who have the VIEW_AUDIT_LOG permission can send link this is my code :
client.on("messageCreate", message => {
const { member } = message;
let blacklisted = ['http://', 'www.', 'https://'];
let foundInText = false;
if(!member.permissions.has(Permissions.FLAGS.VIEW_AUDIT_LOG)) {
for (var i in blacklisted) {
if (message.content.toLowerCase().includes(blacklisted[i].toLowerCase())) foundInText = true;
}
if (foundInText) {
const logembed = new MessageEmbed()
.setColor("DARK_AQUA")
.addField(' with message :', ` ${message.content} `, true)
if(!message.member.roles.cache.has("929434049011941386")) {
message.guild.channels.cache.get('941704496185221221').send({ content: `<#${message.author.id}> tried to send links in <#${message.channel.id}>`, embeds: [logembed] });;
message.delete();
message.channel.send("No links here, " + `${message.author}`);
}
}
}
});
but it give this error when he delete a message with link :
if(!member.permissions.has(Permissions.FLAGS.VIEW_AUDIT_LOG)) {
^
TypeError: Cannot read properties of null (reading 'permissions')
ok so here's my guess....you're hitting this event handler twice or more times...the first time is the message the user typed. you will get their member info, if you console.log(message.member). The second time through, you'll be getting another event, which is the message(s) you send as a handler.
So the easy solution is to add something like this at or near the top of this event handler:
if (message.author.bot) return;
this basically tests to see if it's a bot or not that's calling your event. It's also good hygiene to ensure you're not accepting/reacting to other bots, which could result in spam you likely don't want.
I need to show error in a dialog stating the server has stopped whenever the server crashes or server gets shut down.
I as console log my error in request as below:
export default function request(url, options) {
return fetch(url, options)
.then(checkStatus)
.then(parseJSON).
catch(error => {
console.log("error",error)
throw error;
});
}
the console is :
TypeError Failed to fetch
Can someone help me with this?
you can use navigator in you code in order to check if user is offline nor user can't connect to your WebService like below:
//if there was a problem with server
if(navigator && navigator.onLine) {
throw {
code: 'SERVER_CONNECTION_PROBLEM',
message: 'Server connection failure...'
}
} else { // if there is a problem with internet
throw {
code: 'INTERNET_CONNECTION_ERROR',
message: 'there is a problem with your INTERNET, god damn it...'
}
}
You can check error status e.g. error.status and do
if(error.statusCode === 503){ // or status code which your server send
// do something
}
There is library called react-offline.
which used in detect your network is in work or not.
After proper implementation it should be work, it shows offline page which you created when your network goes down...
link is here : https://openbase.com/js/react-offline/documentation
[Click here for documentation][1]
[1]: https://openbase.com/js/react-offline/documentation
code example :
<Offline
render={() => {
return (
<div>"I take precedence over any function as child component."</div>
);
}}
>
{() => {
return <div>"I will not render."</div>;
}}
</Offline>
I am trying to implement an Alexa Skill with Multi Turn method and a Node.js back end.
alexaApp.intent("findFact", {
"dialog": {
type: "delegate"
},
},
function(request, response) {
console.log("In Fact intent");
var test = this.event.request.intent.slots.testtwo.value;
// console.log(request.dialogState);
console.log("test fact : " + test);
response.say(get_fact());
}
);
Iam not able to get the value within the testtwo slot.
The console displays 'Unhandled exception: Cannot read property 'request' of undefined.'
Any idea why ?
Thanks !
ANSWER IS :
var test = request.data.request.intent.slots.testtwo.value;
I am using Visual studio 2015 and ionic and i have been able to build for windows phone 8.1. I created a login page that is to query a php on a different server but i get a problem like this SCRIPT7002: XMLHttpRequest: Network Error 0x2efd, Could not complete the operation due to error 00002efd.
index.html
error. My code trying to make a request is
var login = function(name, pw) {
return $q(function(resolve, reject) {
$http.post('http://192.167.180.1//logn/sear.php',{ 'pin': pw }).then(
function(result) {
// No result here..
var re=result.data.split(",");
console.log(re[3]);
if ((re[0] == 0 )) {
// Make a request and receive your auth token from your server
storeUserCredentials(re[2]);
useCredentials(re[1]+" "+re[3]+" "+re[4]);
console.log(LOCAL_TOKEN_KEY);
resolve('Login success.');
} else if(result.data == 1) {
reject('Login Failed.');
}
}, function(err) {
// $scope.response = err.records;
console.log("error");
});
});
};
When you are facing this error while building a Win 8 Phone App, you might want to add private network capability to app manifest.
Credits for the guy who helped me out: https://sonyarouje.com/tag/network-error/
- there you'll find step-by-step instruction how to do it.
There is also another answer how to do it on SO:
WinJS.xhr: Network Error 0x2efd, Could not complete the operation due to error 00002efd