• Gaurav Kheterpal
  • PRO
  • 2754 Points
  • Member since 2012
  • Salesforce Community Mobile Evangelist
  • Salesforce Developer Community

  • Chatter
  • 74
    Best Answers
  • 1
    Likes Received
  • 2
    Likes Given
  • 7
  • 621
Hello Guys,

I want to develop an offline mobile solution for both IOS and Android.
Can you please suggest me the best way to achieve it.
Please help me with some good links to sample code or demo.

Best Regards,

As of iOS 8.3, the call [[SFRestAPI sharedInstance] requestForDescribeWithObjectType:] does not ever return. The app does not crash, freeze, or hang, just escapes out of that method. In the screenshot below, the first breakpoint is hit many times for each operation we have created yet the second breakpoint is never hit. In iOS 8.2 and below, it works as expected (hits both breakpoints).



Is there anyway to access the "Import from Device" feature that is available on Salesforce1 from the Contacts Object when you hit New button, from a visualforce page? I am learning about Cordova/PhoneGap and dynamic components on the visualforce page, so I guess I could create my own Hybrid App that allows me to get contacts from the iOS device, but was hoping there was a way to leverage this function, since it is now standard on the Contact object. Any thoughts?

I am looking for some examples for Android app of how can I write a query to retrieve data from a custom object soup that I created. Is it diferent than standard object soup structure

Can anyone give some sample code/ examples?
Can anyone tell me how can I paginate the records in SmartStore for an app built using Salesforce iOS SDK. I am currently doing
- (NSArray*)query:(NSString*)queryString
    SFQuerySpec *querySpec = [SFQuerySpec newSmartQuerySpec:queryString];
    int count = [self.store countWithQuerySpec:querySpec error:nil];
    querySpec = [SFQuerySpec newSmartQuerySpec:queryString ];
    return [self.store queryWithQuerySpec:querySpec error:nil];

Please help
How to hide User drop in a lookup on visualforce page?
User-added image
Hi folks, I need help with this. The lightning developer week is coming to my country (Argentina), and I'll be exposing lightning components topic. I'd like to make a demo with this, by adding a new record tab to a sObject in SF1. I'know the I have to implement the force:recordTab interface, but not so much. Appart from that, I know that is part form Lightning Extensions feature thats in pilot stage. How do I'm suppose to enable this feature?. I imagine I will have to set which LC matches with which Sobject, right?

Very Thanks!
According to this documentation : http://www.salesforce.com/us/developer/docs/pages/Content/pages_mobile_develop.htm

There are performance issues with developing pages for iOS, and Blackberry. Is this documentation outdated, or still a relevant guideline? If it's still quiret relevant, what are recommended alternatives? 

From my understanding SF1 is not a viable option when considering implementing a solution for case submission/deflection from mobile apps as it requires every user to have a license/sfdc login info, and that isn't always feasible from a business perspective.
I'm developing a custom integration between Salesforce and RegOnline (call outs from SF to the RegOnline APIs to get data). Unfortunately it looks like I have a problem. I'm getting the following error message:

System.CalloutException: IO Exception: Server chose SSLv3, but that protocol version is not enabled or not supported by the client.

This looks related to SF recently disabling the use of SSLv3. Is this error from SF still trying to use SSLv3 and the Regonline API has SSLv3 disabled (or the other way around)?

Any ideas for a resolution/work around?

I'm developing a hybrid (local) app in XCode. It has been setup with the forceios command line.
In XCode there are 2 www-folders - 1) At the top level, 2) in the Staging folder. When I change something in the 1), it is not displayed in the resulting app, until I run "cordova prepare" in the command line. This command line migrates the changes to the Staging folder. On the other hand, if I try to change the Staging folder, it asks me to unlock the file.
What is the correct way of development in this case? Do I need to run the cordova prepare line before every test-run?
I am using the latest Cordova plugin for Salesforce Mobile and when I try to use Smartsync, my app crashes with

setObjectForKey: object cannot be nil (key: Customfield__c)' exception.

How can I fix this?


In my native app built using iOS SDK, how can I check if my smartsore already exist and if so delete it before re-creating it?

Any tutorial/ sample code available?
Hi there,
I have created Multiple Page Blocks for Edit page which consists of Input Fields of custom Object and few pageblocks for Viewable i.e.,output Field.
Am not sure whethere its a good practice.

Please suggest some standard Edit and view Functionality for custom object Vf page
I created the expense tracker app in one rganization and trying to move to a different org . 

deploying  failed with the error:
Missing feature, Details: Installing this package requires the following feature and its associated permissions: Lightning Component Bundles

 My changeset includes the follwoing objects : 
User-added image

  • February 24, 2015
  • Like
  • 0
I have read somewhere, that Apple revision will reject apps which just redirect the user to a remote page (e.g. Salesforce). Is this true? Does this mean that Hybrid Remote apps will be rejected by Apple revision?
How to create salesforce offline app which allow user to Offline access to Salesforce data also insert data off-line &  once client will online then data will automatically sync with salesforce.
I am looking at the AccountEditor sample and although I have added a new splash screen image in my project, It is not refelecting on iPad. It works fine on iPhone though.

What could be reason?
I'm trying to integrate Salesforce into my application and i decided to use REST API and user&password authorization. I registered developer account, connected an application with enabled OAuth settings.
It's my settings:

Unfortunelly, i receive "{"error_description":"authentication failure","error":"invalid_grant"}" each time when i do authorization. It's example of my calling:
curl https://test.salesforce.com//services/oauth2/token -d "grant_type=password&client_id=CONSUMERKEY&client_secret=CONSUMERSECRET&username=yuriy%40example.com&password=passwordTOKEN"

Here are my selected scopes:
Access your basic information (id, profile, email, address, phone)
Access and manage your data (api)
Provide access to your data via the Web (web)
Full access (full)
Access and manage your Chatter data (chatter_api)
Provide access to custom applications (visualforce)
Perform requests on your behalf at any time (refresh_token, offline_access)
Allow access to your unique identifier (openid)
Access custom permissions (custom_permissions

Callback URL is just "https://login.salesforce.com/services/oauth2/authorize"

Could you please help me to understand what i'm doing wrong? I ebabled all policies, my user(who i'm trying to log in) is superadmin of this account. Thank you!



My project source zip exceeds 35 MB so ChallengePost won't let me upload it directly. Therefore as suggested by Hack Central Support Area Team/ Sandeep Bhanot, I've put it on Dropbox and provided the link - I am hoping that does not lead to any confusion in judging.


Please confirm.

Okay, I'm pretty close to wrapping up my 4-week worths of days, nights, weekdays & weekends, lost hair and dark circles below my eyes :) But I can't really find how do I submit my entry. Can anyone point me to the submission link?

I'm almost done with my iOS app. In addition to the code, I want to provide a working build (IPA) of my app via TestFlight or a similar mechanism just in case judges face any issues in compiling the code. Can you let me know the UDID for a couple of test devices? Else, please provide some guidance on how can I provide a build to you for judging.


An early response would be appreciated.

The rules state "A maximum 2 minute demo video of the working application uploaded to
your YouTube or Vimeo account"


In the past for Salesforce Mobile Developer Challenge, I've seen entries with larger durations accepted. Can you confirm if the 2 min duration limit is in stone of can it exceed by few seconds?

My app is almost complete and I can't wait to show what I built. Can we go ahead and promote our app on Twitter/ YouTube to create some buzz?

The terms & conditions for Hackathon states


"You may make one change to your team registration."


Does this mean we can add/delete one member at most or add/delete multiple if required but all in one go?


Pelase clarify ASAP.



I'm in a tricky situation where my org has more than 2,000 records for objects which I'm trying to fetch in my Android native app


RestRequest restRequest = RestRequest.getRequestForQuery( getString(R.string.api_version), soql);


and then I get the response using


RegistrationActivity.client.sendAsync(restRequest, new AsyncRequestCallback() { @Override public void onSuccess(RestRequest request, RestResponse result) { }


This approach suffers the limitation that it can only return 2,000 records in the SOQL. In the response, I'm getting the nextRecordsUrl in the response and I can retrieve it as



nextRecordsUrl =result.asJSONObject().getString("nextRecordsUrl").toString();


Now, my understanding is that I will need to fire HTTP GET requests to this URL using this approach



Http h = new Http(); HttpRequest req = new HttpRequest(); req.setEndpoint("http://na1.salesforce.com" + nextRecordsUrl); req.setMethod('GET'); req.setHeader('Authorization', 'OAuth ' + UserInfo.getSessionId()); req.setHeader('Content-Type', 'application/json'); HttpResponse res = h.send(req);


and then parse the response.


While this approach is theoretically possible, I'm not very keen on mixing 2 approaches - getting the initial records using RestClient getRequestForQuery() method and follow up data (more than 2,000 records) using the HttpRequest method.



Can anyone guide me on the correct/ coherent way of fetching object data (more than 2,000 records) in a native force.com Android app?

The terms & conditions for Hackathon states


"You may make one change to your team registration."


Does this mean we can add/delete one member at most or add/delete multiple if required but all in one go?


Pelase clarify ASAP.



When i am trying to create a Hybrid App, with command: forcedroid create, i am getting the following error.

    "You have been opted out of telemetry. To change this, run: cordova telemetry on.6.2.0 ". Should be in the format x[.y[.ignored]] You have
    been opted out of telemetry. To change this, run: cordova telemetry    on.6.2.0 ) is less than the minimum required version (5.4.0).  Please
    update your version of Cordova."

Please help me how to fix this issue.
Does Lightning components built using material Design work with Salesforce 1 mobile App.

App is getting freezed when custom pages are opened.
Hello all,

We seem to have difficulty with the output of our styled Live Chat pages.

While the pop up window on desktop looks fine, the display on mobile still appears to resemble a full width desktop. Please see the screenshots below:


We currently have the height of the window set to 700px. Could that be a reason for this outcome?

Many thanks.


I have few questions regarding salesforce1 mobile app:
1. In salesforce1 mobile app the error message for custom field validations are not shown properly.
2. How can we make fields mandatoty in mobile app.
3. How to add custom fields in salesforce1 mobile app.
Can you please suggest me the best way to achieve it.
Hi All,
Not sure whether i am in the right forum for my question as i am a newbie to Salesforce. I have a couple of questions.
I am developing an app which connects to SFDC to retrieve records and show them as per the app business logic. This app has Offline capability and I am using Smartstore API to store the data in offline. I am using SFRestAPI to synchronise the data to and fro in the SFDC server. I have a connection manager class that takes care of the rest calls, i.e, build the queryspec and pass it to the SFRestAPI+Blocks API.
1. How can i manage the response of the calls, since the responses comes asynchronously from the API. I mean i need to show a HUD loading mask above my view untill all my data is downloaded. But i am not finding any suitable way to track this  from the API, so that i can remove the HUD mask on a callback.
2. Is there any way to send an array of insert objects/update objects to the REST web service of SFDC through SFRestAPI. I mean when i will query my soup for the locally inserted/updated records, i will receive an array of record. Now what i am doing is looping through the array and creating each connection for each row, this is increasing my network traffic and also my code complex.
I will be thankful to all of you for your support.

Thanks again in advance.
Hello Guys,

I want to develop an offline mobile solution for both IOS and Android.
Can you please suggest me the best way to achieve it.
Please help me with some good links to sample code or demo.

Best Regards,
We created some VF tabs that we would like to use in the mobile app, but when clicking on the VF tab from the app, it brings up a login screen. However, when the credentials are entered, it goes blank.
- It works fine in Android Salesforce1 app and mobile browser, this problem is only seen in iOS Salesforce1 app.
- Also, we have enabled all the VF pages for mobile in the Mobile Navigation setup.
- I am logging as a System Admin so profile permission is not an issue.

User-added image

I'm using the <input type="file" accept="image/*" capture="camera"/> tag in a custom VF page publisher action. When choosing to take photo or select an existing photo option, the publisher action gets dismissed. When I reopen my custom publisher action, it opens with the publisher action header overlayed on top of a blacked out camera view. (It seems like the camera crashes and I can't return to my VF page unless I end the Salesforce1 process on my phone)

I tested this out on a visualforce page tab in Salesforce1 and it works as it should, so it's something specific to publisher actions and using the iPhone camera. This functionality is already working in the file publisher action, so I want to say that the publisher isn't subscribed to a camera event, but I can't find any event in publisher.js that is related to camera events. 

This is iPhone specific since I tested it out on the iPad and it works as it should. (Running iOS 8.3 on iPhone and iPad)

User need to access Salesforce only on the company provided Mobile(iphone,Android,BlackBeery).
Currently Mobile Iron MDM is used.
How to deny access Salesforce when user login using the private mobile.
Hi Folks,

I have created a VF page for Salesforce1 to add OLI. Once OLI is added user is redirected back to Opportunity detail page. But when user tried to view added OLI in the related list section below eror is thrown. Please check te snapshot below.
User-added image

Any solution for it??
the code bellow:
SFRestRequest *request = [SFRestRequest requestWithMethod:SFRestMethodPOST path:@"
/services/apexrest/MyRestApi/MyFavorite" queryParams:nil];
    request.endpoint = @"/services/apexrest/MyRestApi/MyFavorite";
    [[SFRestAPI sharedInstance] sendRESTRequest:request failBlock:^(NSError *e){
        NSLog(@"error: %@", e);
    } completeBlock:^(id success){
        NSLog(@"success: %@", success);
the response print in the console:
​success: (null)

anyone can tell me why?? thenks

Hi All,

Rich text area on salesforce1 doesn't function the same way as in mobile browser (chrome mobile view). Need help on this. Please refer to the image below. 

User-added image


[ios mobile app]  the code blow:
  SFRestRequest *request = [[SFRestRequest alloc] init]; 
  request.endpoint = @"/services/apexrest"; 
  request.method = SFRestMethodGET; 
  request.path = @"/MyRestApi/Inquiry/getInquiryDefaultValue"; 
  [[SFRestAPI sharedInstance] send:request delegate:self];
- (void)request:(SFRestRequest *)request didLoadResponse:(id)dataResponse { 
    NSLog(@"dataResponse: %@", [dataResponse description]);
the print log info is a hex stream, any one can tell me why???????   thanks

dataResponse: <227b5c22 74615c22 3a7b5c22 4f746865 725c223a 5b7b5c22 4e616d65 5c223a5c 2247656e 57617474 2050726f 70616e65 20353030 6b575c22 2c5c2249 645c223a 5c223031 74393030 30303030 32703139 68414141 5c227d2c 7b5c224e 616d655c 223a5c22 47656e57 61747420 50726f70 616e6520 31353030 6b575c22 2c5c2249 645c223a 5c223031 74393030 30303030 32703139 69414141 5c227d2c 7b5c224e 616d655c 223a5c22 47656e57 61747420 4761736f 6c696e65 20333030 6b575c22 2c5c2249 645c223a 5c223031 74393030 30303030 32703139 6a414141 5c227d2c 7b5c224e 616d655c 223a5c22 47656e57 61747420 4761736f 6c696e65 20373530 6b575c22 2c5c2249 645c223a 5c223031 74393030 30303030 32703139 6b414141 5c227d2c 7b5c224e 616d655c 223a5c22 47656e57 61747420 4761736f 6c696e65 20323030 306b575c 222c5c22 49645c22 3a5c2230 31743930 30303030 30327031 396c4141 415c227d 2c7b5c22 4e616d65 5c223a5c 22496e73 74616c6c 6174696f 6e3a2050 6f727461 626c655c 222c5c22 49645c22 3a5c2230 31743930 30303030 30327031 396d4141 415c227d 2c7b5c22 4e616d65 5c223a5c 22496e73 74616c6c 6174696f 6e3a2049 6e647573 74726961 6c202d20 4c6f775c 222c5c22 49645c22 3a5c2230 31743930 30303030 30327031 396e4141 415c227d 2c7b5c22 4e616d65 5c223a5c 22496e73 74616c6c 6174696f 6e3a2049 6e647573 74726961 6c202d20 4d656469 756d5c22 2c5c2249 645c223a 5c223031 74393030 30303030 32703139 6f414141 5c227d2c 7b5c224e 616d655c 223a5c22 496e7374 616c6c61 74696f6e 3a20496e 64757374 7269616c 202d2048 6967685c 222c5c22 49645c22 3a5c2230 31743930 30303030 30327031 39704141 415c227d 2c7b5c22 4e616d65 5c223a5c 22534c41 3a20506c 6174696e 756d5c22 2c5c2249 645c223a 5c223031 74393030 30303030 32703139 71414141 5c227d2c 7b5c224e 616d655c 223a5c22 534c413a 2042726f 6e7a655c 222c5c22 49645c22 3a5c2230 31743930 30303030 30327031 39724141 415c227d 2c7b5c22 4e616d65 5c223a5c 22534c41 3a205369 6c766572 5c222c5c 2249645c 223a5c22 30317439 30303030 30303270 31397341 41415c22 7d2c7b5c 224e616d 655c223a 5c22534c 413a2047 6f6c645c 222c5c22 49645c22 3a5c2230 31743930 30303030 30327031 39744141 415c227d 2c7b5c22 4e616d65 5c223a5c 2247656e 57617474 20446965 73656c20 31306b57 5c222c5c 2249645c 223a5c22 30317439 30303030 30303270 31397541 41415c22 7d5d2c5c 22e5beaa e792b0e5 99a85c22 3a5b7b5c 224e616d 655c223a 5c224765 6e576174 74204469 6573656c 20323030 6b575c22 2c5c2249 645c223a 5c223031 74393030 30303030 32703139 65414141 5c227d2c 7b5c224e 616d655c 223a5c22 47656e57 61747420 50726f70 616e6520 3130306b 575c222c 5c224964 5c223a5c 22303174 39303030 30303032 70313967 4141415c 227d5d2c 5c22e7b3 96e5b0bf e797855c 223a5b7b 5c224e61 6d655c22 3a5c2247 656e5761 74742044 69657365 6c203130 30306b57 5c222c5c 2249645c 223a5c22 30317439 30303030 30303270 31396641 41415c22 7d5d7d2c 5c224d52 5f427261 63685f5f 635c223a 5b5c22e7 a59ee688 b8e694af e5ba975c 222c5c22 e5ba83e5 b3b6e694 afe5ba97 5c222c5c 22e7a68f e5b2a1e6 94afe5ba 975c222c 5c22e9ab 98e69dbe e694afe5 ba975c22 2c5c22e3 82a2e382 b9e38388 e383a9e3 82bce383 8de382ab e6a0aae5 bc8fe4bc 9ae7a4be 20e69cac e7a4be5c 222c5c22 e382a2e3 82b9e383 88e383a9 e382bce3 838de382 abe38080 e69db1e4 baace694 afe7a4be 5c222c5c 22e58d83 e89189e6 94afe5ba 975c222c 5c22e5a4 a7e998aa e694afe5 ba975c22 2c5c22e6 9cade5b9 8ce694af e5ba975c 222c5c22 e4bb99e5 8fb0e694 afe5ba97 5c222c5c 22e69db1 e4baace6 94afe5ba 975c222c 5c22e59f bce78e89 e694afe5 ba975c22 2c5c22e6 9db1e4ba ace694af e7a4be28 e794b2e4 bfa1e8b6 8a295c22 2c5c22e6 a8aae6b5 9ce694af e5ba975c 222c5c22 e69db1e4 baace694 afe7a4be 28e58c97 e996a2e6 9db1295c 222c5c22 e5908de5 8fa4e5b1 8be694af e5ba975c 222c5c22 e4baace9 83bde694 afe5ba97 5c222c5c 22e587bd e9a4a8e5 8886e5ae a45c222c 5c22e5b8 afe5ba83 e58886e5 aea45c22 2c5c22e6 97ade5b7 9de58886 e5aea45c 222c5c22 e99d92e6 a3aee588 86e5aea4 5c222c5c 22e79b9b e5b2a1e5 8886e5ae a45c222c 5c22e7a7 8be794b0 e58886e5 aea45c22 2c5c22e5 b1b1e5bd a2e58886 e5aea45c 222c5c22 e983a1e5 b1b1e588 86e5aea4 5c222c5c 22e59f8e e58d97e5 8886e5ae a45c222c 5c22e5a4 9ae691a9 e58886e5 aea45c22 2c5c22e5 9f8ee8a5 bfe58886 e5aea45c 222c5c22 e5b79de8 b68ae588 86e5aea4 5c222c5c 22e69dbe e688b8e5 8886e5ae a45c222c 5c22e58e 9ae69ca8 e58886e5 aea45c22 2c5c22e5 ae87e983 bde5aeae e58886e5 aea45c22 2c5c22e9 ab98e5b4 8ee58886 e5aea45c 222c5c22 e6b0b4e6 88b8e588 86e5aea4 5c222c5c 22e59c9f e6b5a6e5 8886e5ae a45c222c 5c22e696 b0e6bd9f e58886e5 aea45c22 2c5c22e9 95b7e5b2 a1e58886 e5aea45c 222c5c22 e69dbee6 9cace588 86e5aea4 5c222c5c 22e995b7 e9878ee5 8886e5ae a45c222c 5c22e794 b2e5ba9c e58886e5 aea45c22 2c5c22e5 b2a1e5b4 8ee58886 e5aea45c 222c5c22 e5b290e9 989ce588 86e5aea4 5c222c5c 22e99d99 e5b2a1e5 8886e5ae a45c222c 5c22e6b2 bce6b4a5 e58886e5 aea45c22 2c5c22e6 b59ce69d bee58886 e5aea45c 222c5c22 e6b4a5e5 8886e5ae a45c222c 5c22e6bb 8be8b380 e58886e5 aea45c22 2c5c22e7 a68fe4ba 95e58886 e5aea45c 222c5c22 e98791e6 b2a2e588 86e5aea4 5c222c5c 22e5af8c e5b1b1e5 8886e5ae a45c222c 5c22e58c 97e69182 e58886e5 aea45c22 2c5c22e5 a0bae588 86e5aea4 5c222c5c 22e5a588 e889afe5 8886e5ae a45c222c 5c22e592 8ce6ad8c e5b1b1e5 8886e5ae a45c222c 5c22e8a5 bfe5aeae e58886e5 aea45c22 2c5c22e5 a7abe8b7 afe58886 e5aea45c 222c5c22 e5b2a1e5 b1b1e588 86e5aea4 5c222c5c 22e7a68f e5b1b1e5 8886e5ae a45c222c 5c22e5b0 8fe983a1 e58886e5 aea45c22 2c5c22e7 b1b3e5ad 90e58886 e5aea45c 222c5c22 e69dbee6 b19fe588 86e5aea4 5c222c5c 22e69dbe e5b1b1e5 8886e5ae a45c222c 5c22e5be b3e5b3b6 e58886e5 aea45c22 2c5c22e9 ab98e79f a5e58886 e5aea45c 222c5c22 e58c97e4 b99de5b7 9ee58886 e5aea45c 222c5c22 e4b985e7 9599e7b1 b3e58886 e5aea45c 222c5c22 e4bd90e8 b380e588 86e5aea4 5c222c5c 22e6b296 e7b884e5 8886e5ae a45c222c 5c22e995 b7e5b48e e58886e5 aea45c22 2c5c22e4 bd90e4b8 96e4bf9d e58886e5 aea45c22 2c5c22e5 a4a7e588 86e58886 e5aea45c 222c5c22 e7868ae6 9cace588 86e5aea4 5c222c5c 22e9b9bf e58590e5 b3b6e588 86e5aea4 5c222c5c 22e5aeae e5b48ee5 8886e5ae a45c225d 7d22>


Hi All,
we are trying to build a Hybrid_remote mobile app using visual force pages.
I have seen lot of contents over internet which says how to create hybrid app from cmd prompt using forcedroid.

My question is how do i import these forcedroid projects in eclipse? When I import this hybrid_remote project into eclipse, I'm getting errors in the project directories.. Below the steps how I imported the hybrid app project and the results.

User-added image

2) The imported project with errors
User-added image

I'm not sure what is the error.. I could import forcedroid created native apps successfully.. 
Can someone provide me some materials or guide to create hybrid apps using salesforce mobile sdk...

hi all,

I urgently need to edit/delete a post made by me on this discussion forum...But its not allowing me to do so and pops up
saying that 'you cant delete this question as others are interested in it'.
There are no likes and no comments on it still i am unable  to delete it
Any help would be highly appreciated

Its very urgent,

Good day Ladies and Gents.

I lay before you the fruit of many days of frustration, labor and tears, begging for your help.

There are a few moving parts here, so let me introduce them one by one, with nicknames.

TheVisualForcePage - A humble visualforce page, attached to standard controller User, with a custom extension.

TheVFExtensionCtrl - A braggadocious apex class, who wants the world to know how awesome it is(n't).

TheVFComponentOfDoom - A visualforce component with a custom Controller that exposes two very insubordinate Command buttons. In our case, this component exists to provide a re-usable "delete" button, associated logic and general frustration.

TheVFComponentCtrl - An apex class whose sole purpose in life is to delete an F'ing record. Like the fat kid at primary school sports day, it's main issue is that nobody calls on it. (and therein lies our problem)

To set the stage with these moving pieces, we should consider that the Visualforce page displays, depending on mode, a list of either makes, models or years of cars owned by the given user. Because in my fictional world, users may own multiple Ferrari F12 Berlinetta's (different colors of course.) We can safely assume that if one were to navigate to Farrari, and then Berlinetta, we would see at least one record displayed on our VF page. (2013 of course). These records are displayed in a custom list view format created by using an Apex:Repeat tag.

It's here where we discover our first problem. The list view has, as it's last column a series of "actions" like: "Sell", "Delete" (dear god, who would ever delete a Farrari f12???) and edit. Sell and Delete are command buttons exposed via our handy components. To simply this issue, lets pretend we only have a delete button.

Now, to the untrained, unsuspecting eye a visualforce component, with it's own controller invoked on a page during an Apex:Repeat loop doesn't sound all that complicated. Sure there's the issue of passing in an ID to the logic of the component controller, but that's time-tested, mother approved. Indeed, I thought I was, well, done with this until ...

As it turns out, pressing the delete button has a very curious set of consequences in this setup, consequences I can not fully explain, nor fix.

When you click on the delete command button, the page refreshes (yay, i want that!) However:

Detailed logging shows that the master vfpage's associated controller extension's constructor is executed. Without error
That the component's deleteThisCar method is Never invoked.
Visually, the page state has been lost. What do I mean? I mean that the page that was displaying years of Ferrari F12 Berlinetta's is now just blank, showing only the headers of the listview.

Not to be outdone by an overgrown java app, I've tried the following approaches:

Updating my code to use apex:ActionRegion tags around the components
Tried every damn combination of reRender on the command buttons. Curiously, this had the effect of not reloading the page, and not calling my apex method.
I said, F-IT loudly and refactored the code to not use a component -- invoking an action method directly on the master controller, but this also failed! causing the page to reload, without my action method being invoked
I have slept on the problem. (no joke, this usually works for me. I wake up with the answer.)
I have asked Co-workers to look at it. They suggested the actionRegion bit.
I tried giving up on my trusty commandButtons attempting to use a standard input button with an ActionFunction -- Curiously, this invokes the constructor of my component controller, but not the actual delete function.

Suffice it to say, that overgrown java app is raining on my day.

This feels like somehow the wrong form is being submitted, which is distinctly maddening because i've also rewritten the master vf page such that it had 2 forms (search in header, main page form) and 5 forms (Search in header, 1 form per "mode") Neither has worked.

I realize that it'd be hypocritical in the extreme if I posted this question without some kind of code attached, so here's the component and it's extension. The VF page itself is quite lengthy and I've not finished "sanitizing" it for public consumption.
<apex:component controller="ACE_DeleteCarCmpCtrl" allowDML="true">
<apex:attribute name="tv"
    description="ID of the Car model and year to display controls for."
<apex:attribute name="t"
    description="ID of the Car model to display controls for."

    <apex:outputPanel layout="block" id="theoutputpanel">
    <apex:actionRegion >
    <!-- <apex:actionFunction name="sayHello" action="{!deleteTrackOrVersion}" rerender="TrackVersionsForSelectedTrack" /> -->
        <apex:commandButton action="{!deleteCarOrYear}"
            value="Delete Car"
            rendered="{!IF(ISNULL(Car), false , true)}"
            styleClass="btn btn-sm btn-default"
        <!-- <input type="button" class="submit" onclick="sayHello"/> -->
        <apex:commandButton action="{!deleteCarOrYear}"
            value="Delete Car Version"
            styleClass="btn btn-sm btn-default"
            rendered="{!IF(ISNULL(CarVersionId), false , true)}"
and the controller for it:
public with sharing class ACE_DeleteCarCmpCtrl {

Public ACE_Car_Version__c carVersion {get; set;}
Public Id carVersionId  {get; set { carVersionId = value; }}
Public ACE_Car__c car {get; set;}

public ACE_DeleteCarCmpCtrl() {
    system.debug('$$$$$$$$$$$$$$ : ' + ApexPages.currentPage().getParameters());

public PageReference deleteTrackOrVersion() {
    system.debug('************* : ' + ApexPages.currentPage().getParameters());
    try {
        if (car != null && carVersion != null) {
            throw new ACE_contentManagementLib.ContentManagementException('Both car and carVersion cannot be populated when invoking this component');
        } else if (carVersion == null && car == null) {
            throw new ACE_contentManagementLib.ContentManagementException('Both car and carVersion cannot be null when invoking this component');
        } else if (carVersion != null) {
        } else if (car != null) {
    } catch (ACE_ContentManagementLib.ContentManagementException e) {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage()));
    //return null;
    //Also tried null above. no joy.
    PageReference pageRef = new PageReference('/AwesomePage?id=' + UserInfo.getUserId() );
    system.debug('$$$$$$$$$$$$$$ : ' + ApexPages.currentPage().getParameters());
    return pageRef;

  • February 10, 2015
  • Like
  • 2

Today we’re excited to announce the new Salesforce Developers Discussion Forums. We’ve listened to your feedback on how we can improve the forums.  With Chatter Answers, built on the Salesforce1 Platform, we were able to implement an entirely new experience, integrated with the rest of the Salesforce Developers site.  By the way, it’s also mobile-friendly.

We’ve migrated all the existing data, including user accounts. You can use the same Salesforce account you’ve always used to login right away.  You’ll also have a great new user profile page that will highlight your community activity.  Kudos have been replaced by “liking” a post instead and you’ll now be able to filter solved vs unsolved posts.

This is, of course, only the beginning  and because it’s built on the Salesforce1 Platform, we’re going to be able to bring you more features faster than ever before.  Be sure to share any feedback, ideas, or questions you have on this forum post.

Hats off to our development team who has been working tirelessly over the past few months to bring this new experience to our community. And thanks to each of you for helping to build one of the most vibrant and collaborative developer communities ever.