• Jason F
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 2
    Replies
Long story short, I'm trying to write a single app for multiple salesforce because a parent company acquired other companies that are  staying in their separate instances of salesforce. I'm trying to create a single global application, but I'm getting Apex errors with my force-app classes because some properties of some objects exist in some instances but not others. My immediate challenge is when I try to write my Apex code, on SDFX force / push (to the scratch org) the compiler checks and throws an error when it sees my Apex classes attempt to access (potentially) non-existent custom properties of the Opportunity object. 

e.g. salesforce instance 1 has custom properties on the Opportunity A, B, C and instance 2 has custom properties X, Y, Z, 
My code will detect which instance of salesforce I'm using (either with custom settings or metadata -- I haven't worked that out yet), then it would only execute settings where the properties do in fact exist. In theory, the code should work fine because it will detect the right instance of salesforce and only execute the right code (the code differences are also small -- so I only want to include that in my current project).

Anyway, my problem is I am writing one application artifact / pacakge, and I don't want to replicate thousands of lines of code just because each salesforce instance requires slightly different code -- I also can't share properties between salesforce instances because each salesforce instance has a different defition of opportunity custom properties, and each instance also typically uses 500+ properties.  

What kind of solutions are viable here?
1-many force-apps? (terrible) do i have to write a separate app (and massively duplicate my code) for each salesforce instance?
2-conditional imports? (decent if possible) could i do conditional imports in my apex classes & put the extra support code in separate artifacts?
3-object inheritance? (would be nice) can I write a core artifact and extend it with my other artifacts -- and use some object inheritance across artifacts?
4-what other options do I have -- are there other possibilites? 
Long story short, I'm trying to write a single app for multiple salesforce because a parent company acquired other companies that are  staying in their separate instances of salesforce. I'm trying to create a single global application, but I'm getting Apex errors with my force-app classes because some properties of some objects exist in some instances but not others. My immediate challenge is when I try to write my Apex code, on SDFX force / push (to the scratch org) the compiler checks and throws an error when it sees my Apex classes attempt to access (potentially) non-existent custom properties of the Opportunity object. 

e.g. salesforce instance 1 has custom properties on the Opportunity A, B, C and instance 2 has custom properties X, Y, Z, 
My code will detect which instance of salesforce I'm using (either with custom settings or metadata -- I haven't worked that out yet), then it would only execute settings where the properties do in fact exist. In theory, the code should work fine because it will detect the right instance of salesforce and only execute the right code (the code differences are also small -- so I only want to include that in my current project).

Anyway, my problem is I am writing one application artifact / pacakge, and I don't want to replicate thousands of lines of code just because each salesforce instance requires slightly different code -- I also can't share properties between salesforce instances because each salesforce instance has a different defition of opportunity custom properties, and each instance also typically uses 500+ properties.  

What kind of solutions are viable here?
1-many force-apps? (terrible) do i have to write a separate app (and massively duplicate my code) for each salesforce instance?
2-conditional imports? (decent if possible) could i do conditional imports in my apex classes & put the extra support code in separate artifacts?
3-object inheritance? (would be nice) can I write a core artifact and extend it with my other artifacts -- and use some object inheritance across artifacts?
4-what other options do I have -- are there other possibilites? 
Hi we use the SF api for production and we experience API timeouts since May 2018
API calls intermittently timeout; getting back the following message:
<?xml version="1.0" encoding="UTF-8"?>\n<Errors>\n    <Error>\n        <errorCode>QUERY_TIMEOUT</errorCode>\n        <message>Your query request was running for too long.</message>\n    </Error>\n</Errors>\n.

The same query is running fine for couple of years now and is fairly simple.

we use API version v24.0 and the queries effectively READ or UPDATE objects

Anybody else experiencing this?
Hello,
We are calling salesforce REST API for object history from java.
Following are the sample queries, getting fired for different standard as well as custom objects

e.g.
1. SELECT Id, IsDeleted, Parent.Name, CreatedBy.Name, CreatedBy.Email, CreatedDate, Field, OldValue, NewValue FROM customObject4__History WHERE  CreatedDate > 2016-04-24T18:08:49Z order by CreatedDate

2. SELECT Id, IsDeleted, Parent.Name, Parent.LastModifiedBy.Name, Parent.LastModifiedBy.Email, Parent.LastModifiedDate, Field, OldValue, NewValue FROM customObject4__History where Parent.LastModifiedDate > 2016-04-24T18:09:09Z and Field = 'created' and IsDeleted = true order by Parent.LastModifiedDate

The response we receive is as below. This seems for query on large data sets.

 REST API return status of 400 with response: [{"message":"Your query request was running for too long.","errorCode":"QUERY_TIMEOUT"}]., status: 400]

From the analysis it seems that if the query is taking more than 2 minutes to run, salesforce server gives QUERY_TIMEOUT error.

1. Is there any way QUERY timeout can be increased? Can salesforce do it?
2. Query optimization is another way. Any pointers on how can above query be optmized? I understand the fields used in filter (where clause) should have an index for better performance (CreatedDate is by default indexed). What about other fields Parent.LastModifiedDate, Fields and IsDeleted ?
3. Does order by clause hampers performance?
4. Would batch size option help?

Any pointers on above queries would help.

Thanks,
Lalita



 
Hi we use the SF api for production and we experience API timeouts since May 2018
API calls intermittently timeout; getting back the following message:
<?xml version="1.0" encoding="UTF-8"?>\n<Errors>\n    <Error>\n        <errorCode>QUERY_TIMEOUT</errorCode>\n        <message>Your query request was running for too long.</message>\n    </Error>\n</Errors>\n.

The same query is running fine for couple of years now and is fairly simple.

we use API version v24.0 and the queries effectively READ or UPDATE objects

Anybody else experiencing this?