FQL query returning empty.
I run the following FQL in https://developers.facebook.com/tools/explorer:
SELECT uid, name, username, birthday_date, current_location, online_presence FROM user WHERE relationship_status ='Single' AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) LIMIT 30 OFFSET 0
She successfully returns all my friends who are single.
However, when I run the PHP, nothing is returned:
$fql = "SELECT uid, name, username, birthday_date, current_location, online_presence FROM user WHERE relationship_status ='Single' AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) LIMIT 30 OFFSET 0";
$solteiros = $facebook->api(array(
'method' => 'fql.query',
'access_token' => $userAccessToken,
'query' => $fql,
));
Until yesterday it was working fine.
Today when I test, it happened.
If it runs in the Explorer and not in your PHP app, you are most likely seeing a difference in access token clearance. That is, the access token supplied to Explorer has the permissions needed while the token used for your app does not.
Verify by calling /me/permissions on your PHP application to see what is there.
Your site also gives an invalid api key error
Related
I am new to Salesforce Development, I have tested a similar query to this in a sandbox Org which worked, however when trying to update records in the live Org I am having some issues.
The issue and context is as follows:
I am trying to update the 'Record Type' field of certain Job records through Apex DML. I have opened the Developer Console and run a query:
SELECT Name, GW_Volunteers__Campaign__c, RecordtypeId FROM GW_Volunteers__Volunteer_Job__c WHERE GW_Volunteers__Campaign__c = '7010O000001P2XIQA0' and RecordTypeId = null LIMIT 5
This works fine and will show me the first 5 job records where there is no assigned record type, which is what I want to update.
The problem is when I am opening "execute anonymous" window and entering this code:
GW_Volunteers__Volunteer_Job__c [] bjobs = [
SELECT Name, GW_Volunteers__Campaign__c, RecordTypeId FROM GW_Volunteers__Volunteer_Job__c WHERE GW_Volunteers__Campaign__c = '7010O000001P2XIQA0' and RecordTypeId = null LIMIT 5];
bjobs.RecordTypeId='0120O000000LAY6QAO';
update bjobs;
I keep getting the following error:
Line: 3, Column: 11 Variable does not exist: RecordTypeId
Unless I have missed something very obvious, I cannot figure out why this is happening. Since it recognizes that variable in the query fine and a similar query (where I also updated the RecordTypeId) in the sandbox worked.
Thank you,
YH
The problem here is, you cannot assign bjobs.RecordTypeId='0120O000000LAY6QAO';. You know, bjobs is an array of GW_Volunteers__Volunteer_Job__c.
So, what you need to do is,
GW_Volunteers__Volunteer_Job__c [] bjobs = [
SELECT Name, GW_Volunteers__Campaign__c, RecordTypeId FROM GW_Volunteers__Volunteer_Job__c WHERE GW_Volunteers__Campaign__c = '7010O000001P2XIQA0' and RecordTypeId = null LIMIT 5];
for(GW_Volunteers__Volunteer_Job__c job : bjobs)
{
job.RecordTypeId='0120O000000LAY6QAO';
}
update bjobs;
Hope, this will work.
I am running executing raw sql to delete some records that I added for the test. If I run the same query in management studio it works fine but when I run that query EF Core 2.0 it throws below error
System.Data.SqlClient.SqlException: 'Conversion failed when converting the nvarchar value '1,2' to data type int.'
Code
var idList = await Context.User.ToListAsync();
var ids = string.Join(",",idList.Select(x=>x.Id));
await _context.Database.ExecuteSqlCommandAsync($"Delete from User where Id in ({ids}) and RoleId = {contact.RoleId}");
Query executing
Delete from sale.WatchList where OfferId in (1,2) and UserId = 9
Could anybody please advise on what wrong with the above code.
Thanks
EF Core will transform interpolated strings into queries with parameters to create reusable queries and protect against SQL Injection vulnerabilities. See: Raw SQL Queries - EF Core - Passing Parameters
So
$"Delete from User where Id in ({ids}) and RoleId = {contact.RoleId}"
is transformed into
Delete from User where Id in (#ids) and RoleId = #RoleId
With SqlParameters bound.
If that's not what you want, just build the SQL Query on a previous line.
This will not work. You have to write dynamic query. Please try like below one
var idList = await _dataContext.User.ToListAsync();
var ids = string.Join(",", idList.Select(x => x.Id));
await _dataContext.Database.ExecuteSqlCommandAsync($"execute('Delete from User where Id in ({ids}) and RoleId = {contact.RoleId}')");
although accepted answer does work, it creates lot of warnings so for now I am using what #Abu Zafor suggested with small change/fix
await _dataContext.Database.ExecuteSqlCommandAsync($"execute('Delete from User where Id in ({ids}) and RoleId = {contact.RoleId}')",ids,contact.RoleId);
I am an IS auditor and I would like to check how we can retrieve the PASSWORD_VERIFY_FUNCTION assigned to users. I understand the script utlpwdmg.sql can be executed to setup the default password resource limits.
If changes were made using ALTER PROFILE, the script utlpwdmg.sql will not show the latest settings.
Please let me know what SQL commands I can execute to show what is the PASSWORD_VERIFY_FUNCTION stored and used in the system.
You can use this query to see source code of stored proc:
--Source of all password functions.
select *
from dba_source
where owner = 'SYS'
and name in
(
--The name of all password functions in use.
--See DBA_USERS.PROFILE to determine which user is using which profile.
select limit
from dba_profiles
where resource_name = 'PASSWORD_VERIFY_FUNCTION'
--Yes, this is intentionally the string 'NULL', that's what Oracle uses here.
and limit <> 'NULL'
)
order by name, line;
To find out what users are using PASSWORD_VERIFY_FUNCTION, you need to find out which profiles are using the function and then see which users are assigned that profile.
select profile from dba_profiles where limit = 'PASSWORD_VERIFY_FUNCTION';
select username from dba_users where profile = ;
I tried with many things and it always said the same i need return the user or the list of all users
i dont know what happen,
resul returns Resource id and
if i print mysql_fetch_array it returns Array and print r doesnt return all users in my database
<?php
,
$consulta = "SELECT user FROM usuarios";
$resul = mysql_query($consulta,$conexion);
echo $resul;
print_r(mysql_fetch_array($resul));
?>
with phpmyadmin return all users.. that query works fine when i put that with phpmyadmin
i have in that moment in the database one table called usuarios with 3 columns called user(admin,pablo) pass(admin,pablo) and obviously id
but the ouput is this
Resource id #2Array ( [0] => admin [user] => admin )
I'm trying to select user's subordinates from Salesforce, but a simple query
SELECT Id FROM User WHERE ManagerId=xxxxxxxxx
returns bunch of null values, when I run
SELECT Id,Name FROM User WHERE ManagerId=xxxxxxxx
I get the correct names, still no IDs.
Is this a permission issue? I can't find anything when I login to portal.
I'm running the queries via API on Sandbox environment.
Try this (both works for me allways):
Id myId = [Select Id From User Where Username = 'myUserName'].Id;
System.debug('#### myId: ' + myId);
List<User> myIdList = [Select Id From User Where Username = 'myUserName' Limit 1];
System.debug('#### myId from list: ' + myIdList[0].Id);
Portal Licence doesn't allow to query User. However you have still access to the name of the user through OwnerId, CreatedById, LastModifiedById using in an inputfield.
i.e :
If you want to have access to user through the portal you need a custom object and synchronise your records with User by trigger.