Skip to main content
added 3828 characters in body
Source Link
Brock B.
  • 145
  • 1
  • 8

Edit 2:

Here is the code - I stripped a bit out to try to at least keep it a decent size.

     private static void PollDataForObject( SF_DataPolling_Object obj )
    {
        try
        {
            
            using( DataClassesDataContext dc = new DataClassesDataContext( Utility.GetConnectionString() ) )
            {

                dc.ObjectTrackingEnabled = false;

                string fields = string.Join( "," , obj.SF_DataPolling_Object_Fields.Select( x => x.FieldName ) );

                string SOQL = "SELECT " + fields + " FROM " + obj.ObjectName;

                if( obj.LastIntervalUpdate != null )
                {
                    Case c = new Case();
                   
                    SOQL += " WHERE CreatedDate >= " + ( ( DateTime ) obj.LastIntervalUpdate ).ToString( "yyyy'-'MM'-'dd'T'HH':'mm':'sszzzzz" ) + " OR  LastModifiedDate >= " + ( ( DateTime ) obj.LastIntervalUpdate ).ToString( "yyyy'-'MM'-'dd'T'HH':'mm':'sszzzzz" );
                }

                QueryResult queryResult = _sfDCBinding.query( SOQL );

                Type type = Type.GetType( "SF.DataPolling.Business.SFWebRef." + obj.ObjectName );

                PropertyInfo[] propertiesInfo = type.GetProperties();
                List<Tuple<string , object>> list = new List<Tuple<string , object>>();

                string checkVal = string.Empty;

                if( queryResult.size > 0 )
                {

                    string values = string.Empty;

                    while( queryResult.done == false )
                    {
                        for( int i = 0 ; i < queryResult.records.Count() ; i++ )
                        {
                            // Insert the records since last interval update.
                            list = new List<Tuple<string , object>>();

                            string propertyName = string.Empty;

                            for( int k = 0 ; k < propertiesInfo.Count() ; k++ )
                            {
                                propertyName = propertiesInfo[ k ].Name;

                                if( ( from x in obj.Fields where x.FieldName == propertyName select x ).Count() > 0 )
                                {
                                    object value = ( object ) propertiesInfo[ k ].GetValue( queryResult.records[ i ] , null );

                                    list.Add( new Tuple<string , object>( propertyName , value ) );

                                }
                            }

                            int count = dc.spSF_CHECKIFIDEXISTS( queryResult.records[ i ].Id , config.TableDataPrefix + obj.ObjectName );

                            // Check if the ID exists and do update.
                            // If not ADD.
                            if( count < 1 || obj.LastIntervalUpdate == null )
                            {
                                // It's new -- insert
                            }
                            else
                            {
                                // It's an update.
                                //update tbl                                    
                            }
                        }

                        queryResult = _sfDCBinding.queryMore( queryResult.queryLocator );
                    }


                }

            }

        }
        catch( Exception ex )
        {
            throw new Exception( ex.ToString() );
        }
       
    }

Edit 2:

Here is the code - I stripped a bit out to try to at least keep it a decent size.

     private static void PollDataForObject( SF_DataPolling_Object obj )
    {
        try
        {
            
            using( DataClassesDataContext dc = new DataClassesDataContext( Utility.GetConnectionString() ) )
            {

                dc.ObjectTrackingEnabled = false;

                string fields = string.Join( "," , obj.SF_DataPolling_Object_Fields.Select( x => x.FieldName ) );

                string SOQL = "SELECT " + fields + " FROM " + obj.ObjectName;

                if( obj.LastIntervalUpdate != null )
                {
                    Case c = new Case();
                   
                    SOQL += " WHERE CreatedDate >= " + ( ( DateTime ) obj.LastIntervalUpdate ).ToString( "yyyy'-'MM'-'dd'T'HH':'mm':'sszzzzz" ) + " OR  LastModifiedDate >= " + ( ( DateTime ) obj.LastIntervalUpdate ).ToString( "yyyy'-'MM'-'dd'T'HH':'mm':'sszzzzz" );
                }

                QueryResult queryResult = _sfDCBinding.query( SOQL );

                Type type = Type.GetType( "SF.DataPolling.Business.SFWebRef." + obj.ObjectName );

                PropertyInfo[] propertiesInfo = type.GetProperties();
                List<Tuple<string , object>> list = new List<Tuple<string , object>>();

                string checkVal = string.Empty;

                if( queryResult.size > 0 )
                {

                    string values = string.Empty;

                    while( queryResult.done == false )
                    {
                        for( int i = 0 ; i < queryResult.records.Count() ; i++ )
                        {
                            // Insert the records since last interval update.
                            list = new List<Tuple<string , object>>();

                            string propertyName = string.Empty;

                            for( int k = 0 ; k < propertiesInfo.Count() ; k++ )
                            {
                                propertyName = propertiesInfo[ k ].Name;

                                if( ( from x in obj.Fields where x.FieldName == propertyName select x ).Count() > 0 )
                                {
                                    object value = ( object ) propertiesInfo[ k ].GetValue( queryResult.records[ i ] , null );

                                    list.Add( new Tuple<string , object>( propertyName , value ) );

                                }
                            }

                            int count = dc.spSF_CHECKIFIDEXISTS( queryResult.records[ i ].Id , config.TableDataPrefix + obj.ObjectName );

                            // Check if the ID exists and do update.
                            // If not ADD.
                            if( count < 1 || obj.LastIntervalUpdate == null )
                            {
                                // It's new -- insert
                            }
                            else
                            {
                                // It's an update.
                                //update tbl                                    
                            }
                        }

                        queryResult = _sfDCBinding.queryMore( queryResult.queryLocator );
                    }


                }

            }

        }
        catch( Exception ex )
        {
            throw new Exception( ex.ToString() );
        }
       
    }
added 343 characters in body
Source Link
Brock B.
  • 145
  • 1
  • 8

We are writing an integration service between one of our systems and SFDC. The problem we are running into with the syncing of the data is that we're only able to sync 42,000 Account records from Salesforce, and have no idea why we're not getting all 42,400 records back.

Our query is pulling all Account objects and not limiting them at all.

Any ideas on how to get the remaining records?

Edit:

We're using .NET SOAP calls and using the load more technique to grab all records. This method seems to be topping out at 42,000 on the account object.

Using the SFDC data loader, I'm able to grab all 42,400 records with no problem, and the user has permissions to all records.

Any further help would be greatly appreciated.

We are writing an integration service between one of our systems and SFDC. The problem we are running into with the syncing of the data is that we're only able to sync 42,000 Account records from Salesforce, and have no idea why we're not getting all 42,400 records back.

Our query is pulling all Account objects and not limiting them at all.

Any ideas on how to get the remaining records?

We are writing an integration service between one of our systems and SFDC. The problem we are running into with the syncing of the data is that we're only able to sync 42,000 Account records from Salesforce, and have no idea why we're not getting all 42,400 records back.

Our query is pulling all Account objects and not limiting them at all.

Any ideas on how to get the remaining records?

Edit:

We're using .NET SOAP calls and using the load more technique to grab all records. This method seems to be topping out at 42,000 on the account object.

Using the SFDC data loader, I'm able to grab all 42,400 records with no problem, and the user has permissions to all records.

Any further help would be greatly appreciated.

Source Link
Brock B.
  • 145
  • 1
  • 8

Maximum of 42,000 Account records returned by query

We are writing an integration service between one of our systems and SFDC. The problem we are running into with the syncing of the data is that we're only able to sync 42,000 Account records from Salesforce, and have no idea why we're not getting all 42,400 records back.

Our query is pulling all Account objects and not limiting them at all.

Any ideas on how to get the remaining records?