You need to sign in to do that
Don't have an account?
Alexander Vallat
Adding or removing a field from ContentVersion does not update DescribeGlobal's last-modified value
Has anyone else experienced problems with detecting schema changes to ContentVersion specifically?
According to https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/describe_global_with_ifmodified_header.htm the Last-Modified and If-Modified-Since headers can be used to determine if metadata has changed.
This works fine when adding or removing a field from standard or custom object types, however it does *not* work when adding or removing a field from ContentVersion.
Repro steps:
1. Call /services/data/v49.0/sobjects, note the Last-Modified header value.
2. In the Object Manager, add or remove a custom field from a standard (e.g. Account) or custom record type
3. Call /services/data/v49.0/sobjects, note the Last-Modified header value has been updated
4. Add or remove a custom field from ContentVersion record type
5. Call /services/data/v49.0/sobjects, note the Last-Modified header value has *NOT* been updated
6. Call /services/data/v49.0/sobjects, with an If-Modified-Since header value that is prior to the modification to ContentVersion. Note that a 304 Not Modified response is returned.
According to https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/describe_global_with_ifmodified_header.htm the Last-Modified and If-Modified-Since headers can be used to determine if metadata has changed.
This works fine when adding or removing a field from standard or custom object types, however it does *not* work when adding or removing a field from ContentVersion.
Repro steps:
1. Call /services/data/v49.0/sobjects, note the Last-Modified header value.
2. In the Object Manager, add or remove a custom field from a standard (e.g. Account) or custom record type
3. Call /services/data/v49.0/sobjects, note the Last-Modified header value has been updated
4. Add or remove a custom field from ContentVersion record type
5. Call /services/data/v49.0/sobjects, note the Last-Modified header value has *NOT* been updated
6. Call /services/data/v49.0/sobjects, with an If-Modified-Since header value that is prior to the modification to ContentVersion. Note that a 304 Not Modified response is returned.
Thanks for bringing this up. I was able to reproduce that the changes to contentVersion changes did not reflect on the "Last-Modified" of Raw Response in Workbench.
>Can you clarify if you are using any tool?
>Can you elaborate on how I can check step 6 of using the "If-Modified-Since" header value?
Regards,
Swetha Maddali
Salesforce.com Support
Senior Success Engineer Tier 2
I am not using any special tool (if it helps, I am making the request using RestSharp from a .NET application, but any tool that sends an HTTP GET request will do the job).
To check step 6, add the HTTP header to the GET request with the name "If-Modified-Since" and a value that is a DateTime prior to the modification of the content version (but after any other changes you may have made). For example "Thu, 24 Dec 2020 11:48:24 GMT". I believe in Workbench this would be done by clicking the Headers button and adding the line "If-Modified-Since: Thu, 24 Dec 2020 11:48:24 GMT".
If this was working properly, then you would get back a normal 200 response with the data. Instead, you get a 304 response with no data, indicating that Salesforce does not believe that the schema has been modified since the time specified.
Regards,
Alex Vallat
Appreciate your patience in the meantime.
Apologies for the delay. Most of the team were on holiday and so I couldn't catch up. I have followed up with the team on this today and waiting to hear back.Thanks
I have an update:
This appears to be working as designed behaviour. Adding a field to an entity doesn’t change the if-modified-since date on /sObjects endpoint since that endpoint doesn’t show fields. If you create a new entity or change your users permission so that an entity isn’t visible any more, you should see the date change on the /sObjects endpoint.
If you do a if-modified-since check under /sObjects/contentVersion/describe, you’ll see the date change when you add a new field.
The REST endpoint /services/data/v49.0/sobjects is analogous to calling describeGlobal, not describeSObject. DescribeGlobal only lists entities and some meta-attributes about those entities, not the fields on such.
If you notice that this behavior is inconsistent (for example, works differently for ContentVersion than for entities), then we can investigate further.
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
That is not right. Please check my first post again.
According to https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/describe_global_with_ifmodified_header.htm the documented behaviour is that if changes to any object are made, then the last-modified (and consequently if-modified-since) for Describe Global is updated.
As I detailed in my original post, this behaviour can easily be verified by adding or removing a field from the Account stanard object type, or from a custom object type.
Further, again, as previously detailed, if you do this only with specicfically a ContentVersion object type, then it does not work and the last-modified date is not updated. This is inconsistent behaviour between ContentVersion and other object types, and doesn't match the documented behaviour.
Please investigate further, if possible.
Regards,
Alex
Checking..
I have tried below and checked the working and nonworking scenario:
> Added text field to account at Thu, 24 Dec 2020 10:41:34 GMT and made a call. Raw response reflects Last-Modified :Thu, 24 Dec 2020 10:41:34 GMT (Working)
>Added text field to ContentVersion at Thu, 24 Dec 2020 10:50:00 GMT and made a call. Raw response reflects Last-Modified :Thu, 24 Dec 2020 10:41:34 GMT (Not Working)
>Deleted the text field on account on Thu, 24 Dec 2020 10:55:00 GMT and made a call.Raw response reflects Last-Modified :Thu, 24 Dec 2020 10:55:00 GMT (Working)
>Deleted the text field on account on Thu, 24 Dec 2020 10:55:00 GMT and made a call adding "If-Modified-Since: Thu, 24 Dec 2020 10:52:34 GMT" the GET request header . The raw response gives 304 Not Modified ( Not Working)
> Deleted the text field on ContentVersion on Thu, 24 Dec 2020 10:59:00 GMT and made a call adding "If-Modified-Since: Thu, 24 Dec 2020 10:52:34 GMT" the GET request header . The raw response gives 304 Not Modified( Not Working)