-
ChatterFeed
-
1Best Answers
-
0Likes Received
-
0Likes Given
-
6Questions
-
18Replies
Self Joins using ActiveSalesforce
Hi,
I'm trying to access a SFDC database from Rails, that has a custom object Employee__c, which in turn has a self referential foreign key Supervisor__r, pointing back to Employee__c. In Rails, I have a model Employee, which has a set_table_name of 'Employee__c'. Does anyone know how I can get the supervisor's name on a query to the employee. It doesn't seem as if Rails allows a model to associate to itself. Also, if I try just to pass the soql directly by using Employee.find_by_sql(), I can't figure out how to label the Supervisor__r foreign key in my query (which is being changed to supervisor_id__c when returned by asf). For example:
Employee.find_by_sql("select e.id, e.name, e.Supervisor__r.name from Employee__c") returns
NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.name
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:353:in `add_rows'from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:347:in `each'from
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:347:in `add_rows'from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:344:in `each'from
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:344:in `add_rows'from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:327:in `select_all'from
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/base.rb:661:in `find_by_sql'from (irb):10
Has anybody done this?
Thanks in advance.
-
- jchanowitz
- September 18, 2009
- Like
- 0
- Continue reading or reply
Eclipse IDE not able to access src in a Sandbox project
I'm all of a sudden unable to use a Sandbox project in Eclipse. If I try to "Refresh from Server" for any asset under src/unpackaged I get back a ServiceException stating the package was deleted in my production organization and is no longer accessible from the sandbox (UNKNOWN_EXCEPTION).
An app I have still works when pointing to the sandbox, the schema explorer for the project still works, and I'm able to see my classes, triggers, etc. in the correct sandbox from the salesforce UI. Developer instance Eclipse projects still work, and any new sandbox projects I create throw the same errors.
I haven't changed anything between it working and not working, (other than a pretty long SF maintanance outage Friday nite??).
Anybody else seeing this behavior with sandboxes, or am I personally doing something stupid here.
Thanks.
-
- jchanowitz
- January 25, 2009
- Like
- 0
- Continue reading or reply
"Unexpected Error" when trying to compile Apex Class
global class Folder { webservice ID id; webservice String title; webservice File[] files; webservice Folder[] subFolders; } global class File { webservice ID id; webservice String title; }
My objective is to return the top level folder, which would have within it the entire tree structure of what I'm trying to render in my client. When I try to compile, I get:
-
- jchanowitz
- October 03, 2007
- Like
- 0
- Continue reading or reply
Custom Class Mapping from Web Service Client to Apex Code
-
- jchanowitz
- September 25, 2007
- Like
- 0
- Continue reading or reply
Cross domain issue when calling Apex Code from Flex
I’m trying to invoke Apex code exposed as a web service from Flex using the Flex Toolkit, and am having cross domain security issues again. It works fine when I run it as a local file. When running from a domain, I get back "Security error accessing url."
The policy file that the Toolkit loads is at:
http://na3-api.salesforce.com/services/Soap/u/cross-domain.xml
But the endpoint that I’m calling is at:
http://na3-api.salesforce.com/services/Soap/class/MyClass
The Flash Player Security White Paper says “The scope of the permissions defined in a policy file includes all resources within the directory and within nested subdirectories.”
So it appears that the above policy file only supports API calls, and not Apex Code calls. Is there, or could there be, a policy file to support both?
-
- jchanowitz
- September 22, 2007
- Like
- 0
- Continue reading or reply
Flex toolkit and cross domain issues
-
- jchanowitz
- June 02, 2007
- Like
- 0
- Continue reading or reply
Self Joins using ActiveSalesforce
Hi,
I'm trying to access a SFDC database from Rails, that has a custom object Employee__c, which in turn has a self referential foreign key Supervisor__r, pointing back to Employee__c. In Rails, I have a model Employee, which has a set_table_name of 'Employee__c'. Does anyone know how I can get the supervisor's name on a query to the employee. It doesn't seem as if Rails allows a model to associate to itself. Also, if I try just to pass the soql directly by using Employee.find_by_sql(), I can't figure out how to label the Supervisor__r foreign key in my query (which is being changed to supervisor_id__c when returned by asf). For example:
Employee.find_by_sql("select e.id, e.name, e.Supervisor__r.name from Employee__c") returns
NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.name
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:353:in `add_rows'from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:347:in `each'from
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:347:in `add_rows'from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:344:in `each'from
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:344:in `add_rows'from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:327:in `select_all'from
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/base.rb:661:in `find_by_sql'from (irb):10
Has anybody done this?
Thanks in advance.
- jchanowitz
- September 18, 2009
- Like
- 0
- Continue reading or reply
Eclipse IDE not able to access src in a Sandbox project
I'm all of a sudden unable to use a Sandbox project in Eclipse. If I try to "Refresh from Server" for any asset under src/unpackaged I get back a ServiceException stating the package was deleted in my production organization and is no longer accessible from the sandbox (UNKNOWN_EXCEPTION).
An app I have still works when pointing to the sandbox, the schema explorer for the project still works, and I'm able to see my classes, triggers, etc. in the correct sandbox from the salesforce UI. Developer instance Eclipse projects still work, and any new sandbox projects I create throw the same errors.
I haven't changed anything between it working and not working, (other than a pretty long SF maintanance outage Friday nite??).
Anybody else seeing this behavior with sandboxes, or am I personally doing something stupid here.
Thanks.
- jchanowitz
- January 25, 2009
- Like
- 0
- Continue reading or reply
Custom Class Mapping from Web Service Client to Apex Code
- jchanowitz
- September 25, 2007
- Like
- 0
- Continue reading or reply
Cross domain issue when calling Apex Code from Flex
I’m trying to invoke Apex code exposed as a web service from Flex using the Flex Toolkit, and am having cross domain security issues again. It works fine when I run it as a local file. When running from a domain, I get back "Security error accessing url."
The policy file that the Toolkit loads is at:
http://na3-api.salesforce.com/services/Soap/u/cross-domain.xml
But the endpoint that I’m calling is at:
http://na3-api.salesforce.com/services/Soap/class/MyClass
The Flash Player Security White Paper says “The scope of the permissions defined in a policy file includes all resources within the directory and within nested subdirectories.”
So it appears that the above policy file only supports API calls, and not Apex Code calls. Is there, or could there be, a policy file to support both?
- jchanowitz
- September 22, 2007
- Like
- 0
- Continue reading or reply
Calling webservice method from java client
- Jegdish
- September 13, 2007
- Like
- 0
- Continue reading or reply
Apex and Flex 2 Web Services
- typemismatch
- June 14, 2007
- Like
- 0
- Continue reading or reply
Flex toolkit and cross domain issues
- jchanowitz
- June 02, 2007
- Like
- 0
- Continue reading or reply