• jhersh0
  • NEWBIE
  • 25 Points
  • Member since 2013

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

Hello everybody !

 

I hope you will be able to help me. 

 

I would like to parse a SOQL query to retrieve fields and tables. For now, to have a query structure, I launch it and take the first record in order to create my structure on the fly. For example :

 

SELECT Id, Name, Amount, Account.Name, Account.BillingCity FROM Opportunity

 

will return all records with following structure :

 

    Account =     {

        Name = "...";

        BillingCity = "...";

        attributes =         {

            type = Account;

            url = "/services/data/v23.0/sobjects/Account/...";

        };

    };

    Amount = ...;

    Id = ...;

    Name = "...";

    attributes =     {

        type = Opportunity;

        url = "/services/data/v23.0/sobjects/Opportunity/...";

    };

 

 It's okay for me : I can create a dictionary containing fields (Amount, Id, Name and Account which contains BillingCity and Name fields). The problem is when there is no record, or when a lookup, or a sub-request (SELECT request in select part) return null result, I cannot get structure. For example, I have :

 

    Account =   null;

    Amount = ...;

    Id = ...;

    Name = "...";

    attributes =     {

        type = Opportunity;

        url = "/services/data/v23.0/sobjects/Opportunity/...";

    };

 

In this case, I cannot get Account structure.

 

Is there a way to get this information anyway, without having to write a custom parser (which must work in more complex queries) ?

 

Thanks !

  • September 20, 2013
  • Like
  • 0

I have built a hybrid remote app, set up the start page as the homepage of force.com paltform. The question is if user open this app from push notification, how can we let user open the relevant page directly instead the homepage? E.g.

 

Start Page: /Home/home.jsp

Expected page when click from Push: /apex/newsdetails?id=(the id provided within the push)

 

So the direct question is that how can we open /apex/newsdetails?id=? page from native code?

 

Here is where i am fetching the oauth after logginging 

 

- (void) oauthCoordinatorDidAuthenticate:(SFOAuthCoordinator *)coordinator

{

    NSLog(@"Username: %@", coordinator.credentials.userId);

    userId_ = [NSString stringWithString:coordinator.credentials.userId];

   

    [superoauthCoordinatorDidAuthenticate:coordinator];

 

 

}

 

 

Now is there a way to logut progrmatically from the app?

 

  • September 26, 2013
  • Like
  • 0

Hello,

 

I want  build a simple App.

Native  not Hybrid. I have some Buttons on the main Screen, which opens a Webview to a SF Org ( Lists, Links  etc)

I use to start the  Sample app with SFRest an Oauth.

(http://www2.developerforce.com/en/mobile/getting-started/ios#native)

How can I build this to open a  Webview which open when i press the Button.

 

Chris

 

Hi

We are developing a hybrid app with Salesforce iOS SDK with offline support using Smartstore. When app is offline we want UIwebview to load an error page which is at the client side instead of throwing the below error at the console. ERROR|SFHybridViewController|Error while attempting to load web page: Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo=0x99c4530 {NSErrorFailingURLStringKey=http://, NSErrorFailingURLKey=http://, NSLocalizedDescription=The Internet connection appears to be offline., NSUnderlyingError=0x9d86970 "The Internet connection appears to be offline."} Failed to load webpage with error: The Internet connection appears to be offline.

  • September 23, 2013
  • Like
  • 0

Hello everybody !

 

I hope you will be able to help me. 

 

I would like to parse a SOQL query to retrieve fields and tables. For now, to have a query structure, I launch it and take the first record in order to create my structure on the fly. For example :

 

SELECT Id, Name, Amount, Account.Name, Account.BillingCity FROM Opportunity

 

will return all records with following structure :

 

    Account =     {

        Name = "...";

        BillingCity = "...";

        attributes =         {

            type = Account;

            url = "/services/data/v23.0/sobjects/Account/...";

        };

    };

    Amount = ...;

    Id = ...;

    Name = "...";

    attributes =     {

        type = Opportunity;

        url = "/services/data/v23.0/sobjects/Opportunity/...";

    };

 

 It's okay for me : I can create a dictionary containing fields (Amount, Id, Name and Account which contains BillingCity and Name fields). The problem is when there is no record, or when a lookup, or a sub-request (SELECT request in select part) return null result, I cannot get structure. For example, I have :

 

    Account =   null;

    Amount = ...;

    Id = ...;

    Name = "...";

    attributes =     {

        type = Opportunity;

        url = "/services/data/v23.0/sobjects/Opportunity/...";

    };

 

In this case, I cannot get Account structure.

 

Is there a way to get this information anyway, without having to write a custom parser (which must work in more complex queries) ?

 

Thanks !

  • September 20, 2013
  • Like
  • 0

Hi,

 

Could you please help us by clarifying our below query regarding REST APIs of Salesforce Mobile SDK for iOS. Thanks in advance.

 

In one of our apps, we are planning to use a new feature of iOS 7: Background transfer service. We would like to use the Salesforce REST APIs to download files from SFDC in background using this service.
Could you please let us know if there is a way to achieve this using Salesforce REST APIs.

 

Note:
To download files in foreground, we currently use Salesforce REST API, SFRestAPI:send:delegate. I understand that it internally uses NSURLConnection through RestKit framework. We would like to move the file downloading part from foreground to background. The background transfer service of iOS 7 uses NSURLSession API instead of the current NSURLConnection API.

 

Regards,
Ravi

We have been working on a mobile iPad app that uses SalesForce Mobile SDK with OAuth2 and REST API for chatter and other SalesForce services. We went through the process of registering a Connected App in our SalesForce account. Next, took the OAuth id and secret, and integrated with our app with proper redirect URI.

 

After doing all the steps, our app works with the Developer Edition SalesForce account and we can access Accounts/Leads/Opportunities/Chatter via REST APIs from our iPad app. However, when we use it with our company's Group Edition SalesForce account, we get an error "API not enabled" for our account. However that said, our Group Edition account does work with ForcePad app available from Apple app store. I downloaded the ForcePad source code and replaced OAuthClientId with our registered connected app and got the same error about "API Not enabled" in our Group Edition account.

 

So we are not sure what else we need to do to get our iPad app authorized to access our Group Edition account  + our customers GE/EE/PE accounts also. Are there any other steps that we need to so get our app whitelisted for Group Edition so that it works similar to ForcePad available from iPad app store.

 

Appreciate some help here.

 

Rahul

How do I not force user to login to salesforce when launching the app?

 

I'd like to allow the user to use the app both if he's got a salesforce account or not

 

Thanks

In our organization, we are trying to implement Single Sign On and trying to find information how to enable it for the mobile app. Any advice is greatly appreciated

I started a new project using the Native Force.com REST App template that comes with the Mobile SDK. I am building a very simple nested tableview app similar to how the Salesforce Mobile App works, you start with a tableview showing a list of Totalreport__c records, tapping one navigates you to a tableview of related Inspection__c records, tapping one navigates you to a tableview of related Result__c records, tapping one navigates you to a detail page for that record. 
Here is the tricky part. I want to display a picker view on the Result__c detail page, the contents of which are build from Device_Type__c records. Mind you, records, not the values of a picklist on a custom object, actual records. The picker view should use the Name field as the label and the Id field as the value and the selected option should be stored in a lookup field in the Result__c record. (Basically I want to present the user with a picker view interface for a lookup field on a custom object)
What I am doing right now isn't working. In the ResultTableViewController.m viewDidLoad method I am using a SFRestRequest to query the server to return the chosen Inspection__c record's related Result__c records and in the same method I am also using an SFRestRequest to query the Device_Type__c records. (I am doing it here because I need the value of a field in the chosen Inspection__c record to use in the Where clause of the Device_Type__c query.)
The problem lies in the fact that even though I have two different SFRestRequests, there is only one request didLoadResponse method that handles both, and therefore I only get back one jsonResponse, either with the Result__c records, or the Device_Type__c records.

How do I split them up and handle them separately?

 

Code:

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = inspectionName;
    
    //Result__c query being concatenated to include the Inspection__c Id
    NSString *resultSelect =@"SELECT ID, Name, Mobile_1__c, Number__c, Type__c, Location__c, System_Type_Id__c, Floor_Name__c FROM Result__c WHERE Device_Class__c != 'Subcomponent' AND Inspection__c = '";
    NSString *resultQuery = [resultSelect stringByAppendingString:[inspectionId stringByAppendingString:@"' ORDER BY Floor_Order__c"]];

    //Result__c query sent
    SFRestRequest *resultRequest = [[SFRestAPI sharedInstance] requestForQuery: resultQuery];
    [[SFRestAPI sharedInstance] send:resultRequest delegate:self];

    //Device_Type__c query being concatenated to include the System_Type_Id__c Id
    NSString *deviceTypeSelect =@"SELECT Id, Name FROM Device_Type__c WHERE Class__c != 'Subcomponent' AND System_Type__c = '";
    NSString *deviceTypeQuery = [deviceTypeSelect stringByAppendingString:[inspectionSystemTypeId stringByAppendingString:@"' Order by Name"]];
    
    //Device_Type__c query sent
    SFRestRequest *deviceTypeRequest = [[SFRestAPI sharedInstance] requestForQuery: deviceTypeQuery];
    [[SFRestAPI sharedInstance] send:deviceTypeRequest delegate:self];
    
}


#pragma mark - SFRestAPIDelegate
- (void)request:(SFRestRequest *)request didLoadResponse:(id)jsonResponse {
    NSArray *records = [jsonResponse objectForKey:@"records"];
    NSLog(@"request:didLoadResponse:# of records: %d", records.count);
    NSLog(@"request:Description:%@",records.description);
    
    //Results to display in the ResultTableView
    self.dataRows = records;
    //Trying to figure out a way to put the response records of the Device_Type__c query into the deviceType NSArray. This obviously doesn't work and is where I need help
    deviceTypes = records;
    [self.tableView reloadData];
}