Connector does not refresh MetaData

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Cloud Applications
Post Reply
sportrx123
Posts: 6
Joined: Tue 17 Feb 2015 18:19

Connector does not refresh MetaData

Post by sportrx123 » Thu 09 Apr 2015 16:35

Hi there,
Every time I add/update or modify a field in Sales Force, My connector does not update.
I try to refresh the MetaData, create a new connection, but nothing helps.
Any suggestions?
Thanks
Ken

Shalex
Site Admin
Posts: 8787
Joined: Thu 14 Aug 2008 12:44

Re: Connector does not refresh MetaData

Post by Shalex » Mon 13 Apr 2015 13:50

If the column does exist in the database, the reason of the problem with its availability in client application is that your local metadata cache is out-of-date: http://www.devart.com/dotconnect/salesf ... cache.html. In this case, there are alternative ways to solve the issue:
1) execute the code:

Code: Select all

    SalesforceConnection conn = new SalesforceConnection(connString);
    conn.Open();
    conn.Cache.RefreshMetadata();
2) the "Refresh Metadata=true;" connection string parameter causes a refresh of Salesforce metadata each time when the connection is opened. Leads to the performance loses
3) remove the C:\Users\YOUR_OS_USER_NAME\Application Data\*.db files. dotConnect for Salesforce will recreate them on the next connection.Open()

If the column does exist and it is a system field, you should add "System Objects=true;" to your connection string (and call conn.Cache.RefreshMetadata() after this) to have access to the system fields of the Salesforce objects.

The names of custom objects/fields should be specified without the "__c" suffix when accessing them via dotConnect for Salesforce interface. An exception to the rule: if the object is created with the name, which already exists (e.g.: "Account"), the suffix must be used ("Account__c").
If conn.Cache.RefreshMetaData() doesn't help, please check if your custom column exists in the result set of the query "SELECT TABLE_NAME, COLUMN_NAME, API_NAME FROM SYS_COLUMNS".

Local cache is stored in SQLite database. The metadata cache (tables structure) is used always, the data cache (user's information stored in the tables) is not used by default but it can be turned on for a particular table or for all tables.

If this information doesn't help, please specify: is your metadata cache or data cache outdated?

sportrx123
Posts: 6
Joined: Tue 17 Feb 2015 18:19

Re: Connector does not refresh MetaData

Post by sportrx123 » Wed 15 Jul 2015 17:12

I queried the SYS_COLUMNS and the tables and columns are there.

It was working awhile and now it says the columns are not there.
I assumed that the meta data are not updated.
I tried to delete the Db ( C:\Users\YOUR_OS_USER_NAME\Application Data\*.db)
but cannot access to the Application Data folder. I do have full admin right to the machine
Any suggestion?

Update:
Actual path to Application Data - C:\Users\{user name}\AppData\Roaming
Note: application Data is a short cut

Delete the cache DB solved the problem.
(this is considered a bug with the tool)
Thanks

Shalex
Site Admin
Posts: 8787
Joined: Thu 14 Aug 2008 12:44

Re: Connector does not refresh MetaData

Post by Shalex » Fri 17 Jul 2015 08:34

sportrx123 wrote:Update:
Actual path to Application Data - C:\Users\{user name}\AppData\Roaming
Note: application Data is a short cut
Thank you for your suggestion. We will update our documentation.
sportrx123 wrote:I queried the SYS_COLUMNS and the tables and columns are there.

It was working awhile and now it says the columns are not there.
I assumed that the meta data are not updated.
[...]
Delete the cache DB solved the problem.
(this is considered a bug with the tool)
1. Please clarify the scenario: you added the column, refreshed the cache, your code talked to this new column successfully, but then (was something changed?) the column became unavailable. Is this correct?
2. Specify the full text of the error and its call stack.

wesley.silva
Posts: 3
Joined: Wed 31 Jul 2019 20:14

Re: Connector does not refresh MetaData

Post by wesley.silva » Wed 31 Jul 2019 21:10

Can you please help us with a Production problem?
The Metadata is not creating the new *.db files using the suggestion.

Follow our error. What could be done?

Inicio Consulta SalesForce
2019-07-31 17:09:19.19 Inicio UserAlert
------------------------------------------------------
System.ServiceModel.CommunicationException: Error in deserializing body of reply message for operation 'describeSObjects'. ---> Sys\
tem.InvalidOperationException: There is an error in XML document (1, 3600). ---> System.InvalidOperationException: Instance validat\
ion error: 'tns:ChangeEventHeader' is not a valid value for soapType.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSoap.Read29_soapType(String s)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSoap.Read31_Field(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSoap.Read35_DescribeSObjectResult(Boolean isNullable, Boo\
lean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSoap.Read228_describeSObjectsResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer3.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion ver\
sion, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters,\
Boolean isRequest)
--- End of inner exception stack trace ---

Shalex
Site Admin
Posts: 8787
Joined: Thu 14 Aug 2008 12:44

Re: Connector does not refresh MetaData

Post by Shalex » Thu 01 Aug 2019 11:03

Salesforce Web Services API version 46 is supported starting from v3.4.790: https://www.devart.com/dotconnect/sales ... story.html. Please upgrade to the newest build v3.4.805.

If the upgrade doesn't help, run the following code to detect objects that lead to the error. Open Visual Studio and navigate to File > New > Project > Visual C# > Windows Desktop > Console App (.NET Framework), run the code with your Salesforce account in the connection string:

Code: Select all

            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;

            var builder = new SalesforceConnectionStringBuilder();
            builder.UserId = "****";
            builder.Password = "****";
            builder.SecurityToken = "****";
            builder.RefreshMetadata = true;
            
            Console.WriteLine("Start");

            using (var conn = new SalesforceConnection())
            {

                builder["Direct"] = true;
                conn.ConnectionString = builder.ConnectionString;
                conn.Open();
                string[] allTables = conn.DescribeGlobal();
                conn.Close();
                builder["Direct"] = false;

                string tableName = null;
                try
                {
                    foreach (string name in allTables)
                    {

                        builder["SObjects"] = tableName = name;
                        conn.ConnectionString = builder.ConnectionString;
                        conn.Open();
                    }
                }
                catch (SalesforceException ex)
                {
                    Console.WriteLine("Table name is {0}", tableName);
                    Console.WriteLine(ex.Message);
                    if (ex.Errors != null)
                    {
                        foreach (SalesforceError error in ex.Errors)
                            Console.WriteLine(error.Message);
                    }
                    Console.WriteLine(Environment.NewLine);
                }
            }
            Console.WriteLine("Finish");
            Console.ReadKey();
        }
1. Specify the output so that we can investigate the issue.
2. As a temporary workaround, use the SObjects connection string parameter with exclamation mark (!) to define objects not to include in metadata. For example: "SObjects=!CampaignChangeEvent,!ApiEvent;".

wesley.silva
Posts: 3
Joined: Wed 31 Jul 2019 20:14

Re: Connector does not refresh MetaData

Post by wesley.silva » Mon 05 Aug 2019 19:19

@Aleksandr Shevchenko, good affternoon...

How much it cost the upgrade? What's the benefits?

Who is the contact to talk about the upgrade?

About this bug... this component need to work !!!
Always we gonna need to buy a upgrade?

Shalex
Site Admin
Posts: 8787
Joined: Thu 14 Aug 2008 12:44

Re: Connector does not refresh MetaData

Post by Shalex » Tue 06 Aug 2019 13:49

wesley.silva wrote:
Mon 05 Aug 2019 19:19
How much it cost the upgrade? What's the benefits?

Who is the contact to talk about the upgrade?
I have forwarded your questions to our Sales department.
wesley.silva wrote:
Mon 05 Aug 2019 19:19
About this bug... this component need to work !!!
Always we gonna need to buy a upgrade?
When Salesforce updates API, we need to upgrade our provider as well. The fixes are included in the new builds only: https://www.devart.com/dotconnect/sales ... story.html.

wesley.silva
Posts: 3
Joined: Wed 31 Jul 2019 20:14

Re: Connector does not refresh MetaData

Post by wesley.silva » Tue 13 Aug 2019 21:17

Why the apiuser.*@*.*746637491_metadata.db do not update after replaced?

Shalex
Site Admin
Posts: 8787
Joined: Thu 14 Aug 2008 12:44

Re: Connector does not refresh MetaData

Post by Shalex » Wed 14 Aug 2019 17:00

If you remove C:\Users\{user name}\AppData\Roaming\apiuser.*@*.*746637491_metadata.db, it has to be recreated by the provider on the next conn.Open().

In case of initializing the Metadata Cache connection string parameter (sets path to the metadata cache database file), the *_metadata.db file will be created in the specified path.

Post Reply