• sheryl brock
  • NEWBIE
  • -1 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies
We're using SmartSync and SmartStore on native iOS to create some data... The general model is that a user will go to a location, create a record of that visit and then create associated survey records that are connected to that record. My question is what is the best practices way to make sure that two objects in a parent-child relationship that have been created offline (and thus neither have an id) can be properly connected to each other on the reSync call?

My first thought was to use _soupEntryId to create a sort of temporary foreign key field between the two and then update the real foreignId field when the sync happens (and then sync again). However this has two problems:
  1. How can I get a list from SmartSync of all the objects that were updated during a sync? Do I have to just fetch every object in the database and deal with it as though it were updated?
  2. I haven't found a way to run an SFQuerySpec on a soup against any field that isn't Id. I see that all my custom data is stored in the record inside a field that basically just stores json, but I can't really query it directly. Would this mean I'd have to load all the objects from SmartStore and loop through them individually to match against a custom field?
We also noticed that there are a few classes, SFParentChildrenSyncUpTarget for example, that seem to address this. However we're not sure how to use this when the ids of the objects haven't yet been set... How would salesforce know what specific records we want linked together?

Any help would be much appreciated.

 
Hi all,

We need to implement the following pattern at my org:
  • callout to external data source
  • if that callout takes too long (according to some configurable threshold), log an error (ie do some DML)
  • if that callout timed out on the remote server, try it again
Recognizing the potential for the dreaded "You have uncommitted work pending. Please commit or rollback before calling out." error, I put the error logging code in a future method, thus isolating the DML from the callouts. However, the error is still being thrown. I reduced the issue down to this pattern:
public static void foo() {
    Http http = new Http();
    HttpRequest req = new Httprequest();
    req.setEndpoint('https://test.salesforce.com'); //whatever endpoint
    req.setMethod('GET');
    http.send(req); //works fine
    bar();
    http.send(req); //throws calloutexception
}

@future public static void bar() {

}
Am I correct to assume that calling a future method counts as a DML operation? Is there any documentation I'm missing somewhere?

 
User-added image
Can you any one suggest me how to update certificate and key management?
  • February 02, 2017
  • Like
  • 2
I am building an native iOS app with offline capabilites, So i have used smartStore and smartSync. There is an issue when i try to sync same records with 2 devices. Sometime changes doesnot reflect on other device. Like i have 2 iPads A and B.

A has a field package value "XYZ"
B has a field package value "XYZ"

I change A field package to "ABC" and sync it. Salesforce shows "ABC". This is correct.
B still show "XYZ" and when i sync , it still show "XYZ" and now salesforce again shows value "XYZ"

I want the new value "ABC" to be synced on all devices and as well as on salesforce too.
 

I am using a custom object which is a child of the account object.

 

If I run this query:

 

Select a.Name, (Select Partner_Research_Name__c, Partner_Research_URL__c From Partner_Research_Records__r) From Account a

 

I get a list of all accounts some of which contain a record Partner_Research_Records__r that is blank, and others (when the object is present in the parent object) a set of values.

 

I want to add something to the where clause that will filter out any responses where the Partner_Research_Records__r recordset is null, however I can't seem to figure out the proper syntax.