function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Internal PartnerInternal Partner 

How to look for a string when you have many static ressources in the Salesforce application?

Hi all,

does anybody know how to search for a string in all static ressources a Salesforce application has?.
Our application has many static ressources and it would be time consuming to search for on every ressource.

I would appreciate tips here :).
v varaprasadv varaprasad
Hi,

you can use query like below to fetch static resources : 

 
List<StaticResource> sr = [Select body, name from StaticResource where Name = 'xx'];

Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.

Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
Internal PartnerInternal Partner
THanks varaprasad!!!. I will give it a try and write here back if this helped or not.
Internal PartnerInternal Partner
Hi varaprasad, I read your answer quietly. What I want is to find a way to find the string "window.location" in the static ressources our Salesforce application has. 
I changed your line this way:
 
List<StaticResource> sr = [Select body, name from StaticResource where body like = 'window.location'];

Unfortunately I get the error:
 
Line: 1, Column: 27
name from StaticResource where body like 'window.location' ^ ERROR at Row:1:Column:45 field 'body' can not be filtered in a query call

I am trying to get this work. Do you have any idea?.

 
Internal PartnerInternal Partner
I will try this with the data loader. There you can select to export Static Ressource records.
Internal PartnerInternal Partner
Possible to export per Data Loader but the body is in format Base64 :(. We have over 300 static resources.