Closed rosskevin closed 3 weeks ago
I should note - I have deleted the resources folder locally, and my phpunit tests refreshed the cache and work.
On the other hand, I deleted the resources
on the wordpress server, restarted the php engine, resources were regenerated (at least the a folder and file was created) but it still appears to have outdated values.
Server relevant log statements:
Pulling contacts settings:
2024-08-15 21:22:25 com\zoho\api\logger\SDKLogger INFO GET - URL = https://www.zohoapis.com/crm/v6/settings/fields?module=Contacts , headers = {"Authorization":" ## can't disclose ## ","X-ZOHO-SDK":"Linux\/5.4.0-1132-gcp\/php-6.0\/8.3.10:4.0.0"} , PARAMS = {"module":"Contacts"}.
Exception showing outdated choice values:
[_message:com\zoho\crm\api\exception\SDKException:private] => {"field":"priority","class":"com\\zoho\\crm\\api\\record\\Record","index":0,"given-value":"MEC - Request for Demo","accepted-values":["-None-","Inquiry","Web Pricing Inquiry"]}
Why is a manual deletion of resources working locally but not in a server environment?
@rosskevin Thank you for reaching out with your query.
The SDK caches field metadata to optimize performance. By default, the SDKConfig instance in the SDK is set with the autoRefreshFields parameter to false. This means that fields are not auto-refreshed in the background, and the SDK will use the cached metadata unless manually refreshed.
To address this, you can do either of the following two methods:
Please refer to this help doc for more details.
Please let me know if this helps, or if you need further assistance please contact us at support@zohocrm.com.
When we add new choice values or change them in the CRM, deploy new code to our custom wordpress plugin, the old resources are used and the new choice values are not present/cause an exception as if we are passing invalid values.
If this SDK is going to cache values, it needs to be checking the equivalent of a last modified time to expire and refresh the cache.