|
|||
|
|||
Thank you for asking. This it definitely not the expected response time. We cannot say what might be causing it and external factors may definitely be involved. In any case, without knowing the way it is implemented or how your code works here's a general recommendation:
The default setting is the entire record is fetched with all details. It would be certainly be faster if you load only the needed fields. For example, here is how you could fetch the accounts (as an example) for only two fields: lstAccounts = objQuery.FetchObjects(RangerMSP.Account.Fields.Acc ountREC_ID.Key + "," + RangerMSP.Account.Fields.FileAs.Key) So, basically you need to pass a comma separated string with the field names that you need access to. Please apply the above to your use case and see how it goes. |
|
|||
|
|||
Hello,
Limiting to 2 fields takes 20 seconds, and with the fields that I need, it takes 3 minutes. Here is the parameter of FetchObjects() now: "FLDBCTACCRECID,FLDBCTAMOUNTSTART,FLDBCTCODE,FLDBC TRECID,FLDBCTCREATEDATE,FLDBCTENDDATE,FLDBCTUSER1, FLDBCTUSER2,FLDBCTNAME,FLDBCTRECTYPE,FLDBCTSTARTDA TE,FLDBCTCONTRACTTYPE,FLDBCTUPDATEDATE" This is better that the 8 minutes I had before, but still a bit long. This difference of execution time is a normal behavior? |
|
|||
|
|||
Thank you for the update. The amount of data and the fields that you fetch do affect the processing time, just like happens in your case. The actual time duration that you specified sound too high. Putting external environment factors aside, do you really need to fetch 1300 records at once? How about filtering the resultset so it will only include the exact records that you need (in case you don't need them all up front). You can always fetch the next batch later.
|
|
|||
|
|||
Hello,
I have been attempting to do exactly this with only one field and get very slow results as well. The goal is to be able to validate if an account exists in CommitCRM so we need to check against all our accounts. Is there something in my code that is causing this slowdown? Quote:
|
|
|||
|
|||
To validate whether an Account exists or not it should be enough to limit the query to 1 result, e.g. if at least one record is returned (Account with that name) then it exists. In the example above the default of 100 results was increased to 2000, and this creates too many objects for no reason. Instead either use the default or better reduce it to 1 (or 5) and then in the query itself build a filtering criteria that already check/compares the Account name - as a result only such account/s will be returned and if at least 1 record is returned - the account is found.
Also, you need to only query the exact fields you need, this will also improve performance. So in this case, you can query only the key or name and you do not need to further query any field nor to later loop the results as if there's a single record return - account was found. Hope this helps. |
|
|||
|
|||
This made it click for me. Thank you for your help and reply. This is working as intended now. Feels great!
public void IsValidAccount(String acct) { CommitCRM.ObjectQuery<CommitCRM.Account> accountSearch = new CommitCRM.ObjectQuery<CommitCRM.Account>(CommitCRM .LinkEnum.linkAND, 1); accountSearch.AddCriteria(CommitCRM.Account.Fields .CompanyName, CommitCRM.OperatorEnum.opEqual, acct); List<CommitCRM.Account> accounts = accountSearch.FetchObjects(CommitCRM.Account.Field s.CompanyName.Key); foreach (CommitCRM.Account account in accounts) { if (account.CompanyName == acct) { accountValidity = true; break; } else { // continue... } } } |