0

We have a large Json file to come back into SF via Apex - the file contains every line whether it is edited or not which results in 1400 lines coming back for each update. Is there a way to ensure SF is only picking up the edited fields and not every single line? For example, you only edit the numbers of the street but you are still updating the street, city, state, country - but you only want the street updated.

2
  • I just tried updating an account without changing anything in execute anonymous. The account last modified date doesn't change. I don't think Salesforce will update fields that haven't changed. However, it will still take up one of your DML rows. Are you trying to save out on DML rows or simply trying to prevent unnecessarily saving fields?
    – Kasper
    Sep 11, 2017 at 13:17
  • Yes, trying to save on DML rows, if possible, along with too many API uses in a 24 hour period. Someone said I could do filters but there is not a way to know exactly what fields will be edited.
    – Jab.ottawa
    Sep 12, 2017 at 11:53

1 Answer 1

0

If every JSON line is one Salesforce record and you don't expect the number of lines to increase much beyond the 1400 records than I would just deserialize the JSON into whatever object you need and update them. The 1400 records are well within the 10.000 DML rows you are allowed in one operation.

If you think you'll get close to the 10.000 DML rows, and a substantial part of the data hasn't actually been changed, then it may be worth the effort to first query the data you are going to update, and check if it needs updating. I don't believe there is a way to automatically have Salesforce check this, but depending on your requirements it wouldn't be too complicated to make.

Assuming you send the entire file in one piece to Salesforce than only the number of times you send the file will have an influence on your API call limit. (Do mind the 6 mb heap size limit, and the 6 mb call out limit for synchronous operations.)

The API call limits are pretty generous unless you intent to update these records a lot of times. You have at least 15000 calls per 24 hours + either 1000 or 5000 per Salesforce licence. (See: https://developer.salesforce.com/docs/atlas.en-us.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_api.htm)

7
  • It will be sent to Salesforce approximately every 10 seconds for every customer - to three different objects. And only if there are updates/edits.
    – Jab.ottawa
    Sep 12, 2017 at 12:31
  • The 1400 lines are all for one record essentially, one person's file...so we could have a large number essentially.
    – Jab.ottawa
    Sep 12, 2017 at 12:32
  • Geez, that is a lot! How many customers do you have? I'm assuming you don't have any control over the JSON source? It would make your life a lot easier if they have some kind of last changed time stamp. Do you expect these records to also be changed on the Salesforce side? If that happens than keeping the records synchronized becomes a lot more complicated.
    – Kasper
    Sep 12, 2017 at 12:33
  • If I have control over the JSON source - how would I factor in the last changed time stamp?
    – Jab.ottawa
    Sep 12, 2017 at 12:36
  • You might want to edit your current question with the extra information. I can then delete this answer since it's of no value as an answer to this question. Please include anything you think is relevant so that people can try to answer your question as well as possible.
    – Kasper
    Sep 12, 2017 at 12:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .