Salesforce pull listviews fail for some listviews - salesforce

Pulling Listviews from salesforce through following url:
https://na23.salesforce.com/services/data/v34.0/sobjects/Contact/listviews/sfid/results
where sfid in url is our listview id, and that was working fine for a while, and it still working fine now but not for all lists some of them give us error:
[
{
"message": "\nDate_of_Next_Outreach__c <= TODAY AND NOT Comm_Plan__c like '%Completed%'\n ^\nERROR at Row:1:Column:475\nunexpected token: 'NOT'",
"errorCode": "MALFORMED_QUERY"
}
]
without any reasons, it just weired as it works for some and not for others?

Related

Microsoft Graph API beta/reports has no data

I have been trying to access MFA information for my account using the Microsoft Graph API. This information is included in the beta version of the API and is located at https://graph.microsoft.com/beta/reports/credentialUserRegistrationDetails. Although I can GET this with no issue, there seem to be no results available, as the response is:
{'#odata.context': 'https://graph.microsoft.com/beta/$metadata#reports/credentialUserRegistrationDetails', 'value': []}
when I expect something more like:
"#odata.context":"https://graph.microsoft.com/beta/reports/$metadata#Collection(microsoft.graph.credentialUserRegistrationDetails)",
"value":[
{
"id" : "id-value",
"userPrincipalName":"userPrincipalName",
"userDisplayName": "userDisplayName-value",
"authMethods": ["email", "mobileSMS"],
"isRegistered" : false,
"isEnabled" : true,
"isCapable" : false,
"isMfaRegistered" : true
}
]
}
I make this API call using the reports.read.all permission and whilst I may be lacking other permissions to be able to access the data, I really have no idea how to start troubleshooting this issue. I was wondering if anyone could shed some light on why I cant see any "value" data?

CSRF Validation Failed in Drupal 7

I've been searching and searching, including the many topics here, for a solution to my problem. I've had no luck thus far.
A bit of a backstory: I'm writing an AngularJS app with Drupal 7 as a backend. I'm able to login without problem, save Session Name and Session ID, and put them together for a Cookie header (I had to use this "hack"). Further, if I made a login call in the Postman app, then tried to update the node, it'd work. It makes me think that there's a problem with session authentication, but I still can't figure it out.
That being said, I'm at a roadblock. Whenever I try to PUT to update a node, I get the following error:
401 (Unauthorized : CSRF validation failed)
Now, my ajax call looks like this:
$http({
method: 'PUT',
url: CONSTANTS.SITE_URL+"/update/node/"+target_nid,
headers:{
'Content-Type': CONSTANTS.CONTENT_TYPE,
'Authentication': CONSTANTS.SESS_NAME +"="+CONSTANTS.SESS_ID,
'X-CSRF-Token' : CONSTANTS.TOKEN
},
data: {
(JSON stuff)
}
})
The CONTENT_TYPE is "application/json", the "Authentication" is the band-aid for the Cookie header problem, and the "X-CSRF-Token" is what is (presumably) giving me the problem. SESS_NAME, SESS_ID, and TOKEN are all gathered from the response at Login. I can pull lists made by users on the website, I can pull the list of all of the nodes of a certain type on the website as well. I only run into a problem when I attempt to PUT to update the node.
If I missed any information, let me know and I'll add it!
EDIT: I'm using AngularJS version 1.5.3.
After trying everything else, I followed one of the comments in the thread I linked at the beginning of my original post. They had to comment out a line in Services.module :
if ($non_safe_method_called && !drupal_valid_token($csrf_token, 'services')) {
//return t('CSRF validation failed');
}
It's around line 590, plus or minus a few depending on how much you've messed with the file. I don't like doing it this way, but I can't for the life of me figure out why the token's not working right. It's a temporary fix, for sure, but if someone runs across this with the same problem in the future it'll hopefully help you out!
Instead of removing the line you could also add a true to drupal_valid_token
if ($non_safe_method_called && !drupal_valid_token($csrf_token, 'services',true)) {
return t('CSRF validation failed');
}

Is including additional information in the output object a good idea?

I'm experimenting with a Conversation where I would like to modify the output in a couple of different ways:
different output for speech or text
different output depending on the tone of the conversation
It looks like I can add extra output details which make it through to the client ok. For example, adding speech alongside text...
{
"output": {
"speech": {
"Hi. Please see my website for details."
},
"link": "http://www.example.com",
"text": {
"Hi. Please see http://www.example.com for details."
}
}
}
For the tone, I wondered about making up a custom selection policy, unfortunately it seems to treat it the same as a random selection policy. For example...
{
"output": {
"text": {
"values": [
"Hello. Please see http://www.example.com for more details.",
"Hi. Please see http://www.example.com for details."
]
},
"append": false,
"selection_policy": "tone"
}
}
I could just add a separate tone-sensitive object to output though so that's not a big problem.
Would there be any issues adding things to output in this way?
You can definitely use the output field to specify custom variables you want your client app to see with the benefit that these variables will not persist across multiple dialog rounds (which they would if you would add them to the context field).
Now currently there is no "easy" way how to define your custom selection policy (apart from the random and sequential supported by the runtime right now) - but you could still return an array of possible answers to the client app with some attribute telling the client app which selection policy to use and you would implement this policy in the client app.

Login application using angularjs

Hi all I am new to Angular, I have to work on login application as of now iam using static json values and my json is given below
{
"records": [
{
"Name": "sudhir",
"Password": "ptg"
},
{
"Name":"manne",
"Password":"ptg123"
}
]
}
Using this Json i have to work on login application so please tell me how to validate this users in my controller if possible give me the answer with code.
Since it looks that your quite new to Angular I would suggest looking at:
http://jasonwatmore.com/post/2015/03/10/AngularJS-User-Registration-and-Login-Example.aspx
https://www.youtube.com/watch?v=C21JNx6hE1w
Or just use any SE. There's plenty of tutorials that will give you a step by step solution to building/validating login form.

addEventListner for received SMS using mozMobileMessage in B2G

I have been teaching myself how to write apps in AngularJS for Firefox OS for a university assignment. This is my first attempt at writing an app in JS.
The aim of the app is to run commands based upon 'commands' sent via SMS (aka, 'ring loud', 'lock device', 'turn on wifi', and reply to an SMS command with GPS locations). At the moment, I'm just trying to do a simple $window.alert('Messaged Received'), to display when an SMS has been received.
My problem is, I am trying to create an addEventListener for incoming SMS, and for the moment, display an $window.alert(). Later, I will use a case switch.
I've referred to the MDN API to create the Event Listener.
var mozMM = navigator.mozMobileMessage;
mozMM.addEventListener('received', function addEventListener(evt) {
// Display a alert when a message is received
$window.alert('SMS received');
$window.alert(evt.message.body);
}, false);
My manifest.webapp has been set up to include all the relevant settings:
"type" : "certified",
"permissions": {
"backgroundservice":{},
"sms":{},
...
},
"messages": [
{ "sms-received": "/index.html" },
{ "notification": "/index.html" }
]
I am able to send SMS from my app without any issues. So I assume I have no problems with my permissions. I've also confirmed that I have full access to the mozMobileMessage object.
For testing, I am using a Geekphone, which has been rooted, and can install certified apps.
I have uploaded the source code to github:
https://github.com/s3069246/findmydevice/tree/master/app
Thanks to someone on Google Groups for giving me the correct solution. I thought I would also share it here.
The issue was that I was using the wrong Event Handler. I should have been using a system message handler instead
navigator.mozSetMessageHandler('sms-received', function onSMS(sms) {
/* here your code */
});
Combined with the "message": [] handler in the manifest, the system handler will alert the application that a message has been received, even if the app is running in the background.

Resources