This is a discussion on Grab pre-built reports via API? within the Salesforce Coding Discussions forums, part of the Salesforce category; I'm currently having issues wrapping my head around how SalesForce works and
-
Grab pre-built reports via API?
I'm currently having issues wrapping my head around how SalesForce works and the best way to pull my data. Right now I'd like to pull a pre-built report from salesforce and I can't see how I would do that via the API/php (soap) toolkit. I'd like to pull a list of reports from a "folder" but not required.
I see blog and forum posts from 2006 with people having issues pulling reports. If I can't use a prebuilt report, how do I pull the same data? I can look at how the report is built and build a query but it does not show what table it is pulling from. Also it shows the column names with spaces and I doubt they are the real column names.
Any advice on dealing with reports or understanding of salesforce's database structure would be fantastic.
Thanks!
-Mike
-
Mike!!
Welcome and thanks for joining my site... I appreciate it
Do you use skype at all?
Would like to talk to you to discuss this.. If you want, you can reach me at 469.298.8850
~Mike
-
Thanks for the reply Mike, sorry but I don't skype. But I think I understand more what is going on then I did yesterday. Right now I've given up on the idea of using reports in salesforce and I'm making my own query. I've run into issues with errors about my API version not supporting semi-joins and I've updated the PHP Tool-Kit 13.1 to point to the 20.0 api url (is this the best library too use?).
Though right now I'm running into the issue of there being no relationship between the object opportunities and contact.
Right now I know there needs to be a opportunityID or ContactID listed on either of the objects. I figure if I'm thinking about this correctly, Contact should be a parent of Opportunity?
And how does one create relationships on salesforces website? I'm just not seeing anything that manages relationships even though it seems SOQL is driven off of them so much. And I find it odd that the report in salesforce can pull from Contact so easily even though there is no relationship.
From the SalesForce Report (no main object listed):
Filtered By:
Plan to Attend equals 2011 - Fall
AND Stage equals Deposit,Admittance,Admit Conditional
AND Jenzabar ID does not contain 1,2,3,4,5,6,7,8,9
AND Previously Attended? not equal to True
AND Applicant Record Type equals Admissions Opportunity Record Type
My query so far:
$query = "SELECT Id, LastModifiedDate, Plan_to_Attend__c, CreatedById, RecordTypeId, name, stagename, Previously_Attended__c, contact.jex_id__c "
. " FROM Opportunity "
. "WHERE RecordTypeId = '01250000000DghRAAS'"
. " AND Plan_to_Attend__c = '2011 - Fall' "
. " AND Previously_Attended__c = false "
. " AND stagename in ('Deposit','Admittance','Admit','Conditional') "
. " AND Id (SELECT Id FROM Contact WHERE jex_id__c = null) "
. "LIMIT 10";
I don't think I'm Selecting the jex_id correctly, the condistional on RecordTypeId is hacked a bit, and the semi-join for checking if jex_id__c is null fails with error: "ERROR at Row:1:Column:12 Didn't understand relationship 'Opportunity' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name."
Also, is there some other main object I should be working with other then Opportunity? And just use the Opportunity object for conditionals...
Thanks for your time.
-Mike
-
I think I've got what I want now. I finally got an idea how the relationships work via this chart: http://www.salesforce.com/us/develop...or_objects.png
$query = "
SELECT Id, Contact.jex_id__c, Contact.FirstName,
Opportunity.Plan_to_Attend__c, Opportunity.Previously_Attended__c,
Opportunity.stagename, Opportunity.RecordTypeId
FROM OpportunityContactRole
WHERE Opportunity.Plan_to_Attend__c = '2011 - Fall'
AND Opportunity.Previously_Attended__c = false
AND Opportunity.stagename in ('Deposit','Admittance','Admit','Conditional')
AND Opportunity.RecordTypeId = '01250000000DghRAAS'
AND Contact.jex_id__c = null
LIMIT 10";
Thanks!
-Mike
-
Glad you got it to work man!!
Similar Threads
-
By Asia in forum Salesforce APEX
Replies: 1
Last Post: 08-13-2010, 01:23 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
Bookmarks