• MarcoTimba
  • NEWBIE
  • 25 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 10
    Replies

The mian goal is to set up web service which accept few parameters and based on that returns the file.

As it is my first try with webservices I do not know too much about it.

 

Input http call is GET type: https://cs8.salesforce.com/services/apexrest/RemoteActivation?company=abc&street=xyz

so parameters are passed in URL, for simplicity lets use just those two parameters.

 

I have found this article http://wiki.developerforce.com/page/Creating_REST_APIs_using_Apex_REST and followed the sample code. 

 

As a result came up with that:

@RestResource(urlMapping='/RemoteActivation/*')
global class as_remoteActivationService {
	
@HttpGet 
	global static String remoteActivation(RestRequest req, RestResponse res) {
		String company = req.params.get('company');
		String street = req.params.get('street');
				
		System.debug('COMPANY: ' + company);
		System.debug('STREET: ' + street);
		return 'Done';
	}

and error when saving:

Save error: Invalid type: HTTP GET/DELETE methods do not support parameters 

 

Now I do not understant it. Example code exacly says:

@HttpGet
  global static List<Case> getOpenCases(RestRequest req, RestResponse res) {

 and I have done the same and getting error. Why?

Hi,

when attempting to delete a list of FeedItems I'm getting the following error:

 

EXCEPTION: System.DmlException: Delete failed.

First exception on row 1 with id 0D5G000000h9c6ZKAQ; first error:

DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>: []

 

As I understand it the DUPLICATE_VALUE error is for then you try an insert/update/upsert and you have a duplicated value in a unique field, I don't understand why is this firing on a DELETE operation.

 

I checked and don't have duplicate FeedItems in the list, I even tried doing:

 

List<FeedItem> fiList = [SELECT Id FROM FeedItem WHERE Id in ('id1', 'id2')];
delete fiList;

 and I'm still getting the same error.

 

I have just one trigger and I alredy tried disabling it and the error still happens.

 

The error doesn't happen always, but I can't find any logic to why is happenning.

 

Any ideas of why this may be happening or how to fix it will be greatly appreciated.

 

Thank you

 

I have a question about how to test for security (CRUD/FLS) in a package code.

 

To test for (CRUD/FLS) we usually create a couple of different profiles, one for positive cases and another for negative cases, and then our Unit Tests just do a System.runAs(userWithPositiveProfile) and a different test does a System.runAs(userWithNegativeProfile), that way we test the parts of our Apex Classes that handle the permissions.

 

The problem that we are having with this is that apparently there is no way to include the Test Profiles in a package and you can't create Profiles from Apex code, so our test would run just fine in our DE Org, but fail if run on the Org that has the package installed.

 

I know that tests are not run during installation, but is this something that Salesforce looks at when doing their review of the package previous to the publication on the AppExchange?

 

And if a Sys Admin runs all tests in the Org that has the package installed he will see the errors. I would like to avoid this if possible.

 

Should we just write some conditions in our tests that will check if those profiles are there and if they aren't just skip those tests? Even if that takes our Code Coverage bellow 75% if the tests are run outside our DE Org? As I understand it we are required to have 75% coverage when uploading the package, I understand that it's advisible to always have 75%+ code coverage but we are having parts of the code that we just can't find a way to package the tests to run in any Org.

 

How are you handling the Unit Testing for Security (CRUD/FLS) in your package?

 

Thank you.

I'm developing in a Sandbox and it's really a pain to have to go to Setup > Monitoring > Debug Logs and then add the user or reset the user each time that I need to debug some piece of code.

 

Was there a particular reason for this change?

 

Is there any way to enable debug logs permanently, at least for the Developer/Sandbox organizations? 

 

We spend all day developing on Force.com but since the change in the way debug logs are activated it has been really difficult  to debug simple problems.

 

Hey guys,

 

As the latest release rolled out we have been unable to connect to our sandbox environment via oAuth. The application login logic has been untouched in months and the keys stored in production are as they were. The login mechanism runs but as the page redirects through its usual pattern we are presented with an SFDC page with the main frame displaying a "Data Not Available" message instead of the usual oAuth screens.

 

Anyone else seeing this behavior?

Hi,

when attempting to delete a list of FeedItems I'm getting the following error:

 

EXCEPTION: System.DmlException: Delete failed.

First exception on row 1 with id 0D5G000000h9c6ZKAQ; first error:

DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>: []

 

As I understand it the DUPLICATE_VALUE error is for then you try an insert/update/upsert and you have a duplicated value in a unique field, I don't understand why is this firing on a DELETE operation.

 

I checked and don't have duplicate FeedItems in the list, I even tried doing:

 

List<FeedItem> fiList = [SELECT Id FROM FeedItem WHERE Id in ('id1', 'id2')];
delete fiList;

 and I'm still getting the same error.

 

I have just one trigger and I alredy tried disabling it and the error still happens.

 

The error doesn't happen always, but I can't find any logic to why is happenning.

 

Any ideas of why this may be happening or how to fix it will be greatly appreciated.

 

Thank you

 

Hello Board,

 

I am eager to know the best way by which we can parse Apex Class, for checking how many SOQL queries are in for loop.

- One of many ways is to fetch Class in text from ApexClass object then using string manipulation identify queries inside for loops. But queries inside methods or another class method would be very dificult to identify.

 

Please shed some lights on on better way to parse the Apex Class. Thanks all for your time.

The mian goal is to set up web service which accept few parameters and based on that returns the file.

As it is my first try with webservices I do not know too much about it.

 

Input http call is GET type: https://cs8.salesforce.com/services/apexrest/RemoteActivation?company=abc&street=xyz

so parameters are passed in URL, for simplicity lets use just those two parameters.

 

I have found this article http://wiki.developerforce.com/page/Creating_REST_APIs_using_Apex_REST and followed the sample code. 

 

As a result came up with that:

@RestResource(urlMapping='/RemoteActivation/*')
global class as_remoteActivationService {
	
@HttpGet 
	global static String remoteActivation(RestRequest req, RestResponse res) {
		String company = req.params.get('company');
		String street = req.params.get('street');
				
		System.debug('COMPANY: ' + company);
		System.debug('STREET: ' + street);
		return 'Done';
	}

and error when saving:

Save error: Invalid type: HTTP GET/DELETE methods do not support parameters 

 

Now I do not understant it. Example code exacly says:

@HttpGet
  global static List<Case> getOpenCases(RestRequest req, RestResponse res) {

 and I have done the same and getting error. Why?

Is there a Summer 11 Force.com IDE for Eclipse release coming?  Sure would be nice to not have to manually change the API version on every new component...

I'm developing in a Sandbox and it's really a pain to have to go to Setup > Monitoring > Debug Logs and then add the user or reset the user each time that I need to debug some piece of code.

 

Was there a particular reason for this change?

 

Is there any way to enable debug logs permanently, at least for the Developer/Sandbox organizations? 

 

We spend all day developing on Force.com but since the change in the way debug logs are activated it has been really difficult  to debug simple problems.