+ Start a Discussion
Stephanie Boggs 17Stephanie Boggs 17 

Hyperlink Formula Fields for JavaScript Disablement

Hello,

I want to ensure that I am reviewing this accurately. https://help.salesforce.com/articleView?id=Hyperlink-Formula-Fields-for-JavaScript-Disablement&language=en_US&type=1

Is there a way to report on all the formula fields and what the formulas are so that I can search to see if my org is affected by this change?

I don't believe that we will be affected, but I want to do my due diligence, so any help in how I should go about this would be greatly appreciated!

Thanks!
Stephanie
Best Answer chosen by Stephanie Boggs 17
Syed Abid ShahSyed Abid Shah
Hi All,

Please refer below link: It might help you:
https://success.salesforce.com/answers?id=9063A000000l1DAQAY

Regards
Syed

All Answers

Cliodhna Egan 7Cliodhna Egan 7
Hello, I also was wondering how I can find out what fields are affected. I have received an email today starting with "As an admin of a Salesforce org using hyperlink formula fields containing JavaScript, we are reminding you"..but I am quite new to this Org and was not involved in setup so how can we get an overview?
Derek Chan 23Derek Chan 23
We could also this information as well.
Syed Abid ShahSyed Abid Shah
Hi All,

Please refer below link: It might help you:
https://success.salesforce.com/answers?id=9063A000000l1DAQAY

Regards
Syed
This was selected as the best answer
NRD 4 UNRD 4 U
@syed :

Are you sure that there is only one way to include javasript in formula fields and will surely have "Javascript" keyword. I doubt.
However I read the article of salesforce.
Syed Abid ShahSyed Abid Shah
Yes , if Hyperlink javascript exists in your Org it will appear like below formula:
"
HYPERLINK("javascript:window.location.reload()","TEXT")
"
Grace SienGrace Sien
So does "elimination of the use of JavaScript in hyperlink formula fields" mean that I will no longer be able to do something like the example below? 

Formula Options
Data TypeFormula  
Decimal Places  
Chart_API__c + Clipping_Service_Fees__c + Custom_Index_Fees__c+ DJIA_Fees__c + Fundamental_Feed_Fees__c + Historical_Feed_Fees__c + Index_Fees__c + InvestCenter_Fees__c +
Devalkumar ShahDevalkumar Shah
Hi Everyone.

Salesforce has provided below code to identify the Hyperlink/java script formula field in our org..

// Get all the standard and custom objects in the org List<EntityDefinition> entityDefs = [select QualifiedApiName from EntityDefinition]; // Forming a list of Entity API names List<String> entityNames = new List<String>(); for(EntityDefinition entityDef: entityDefs){ if(!entityDef.QualifiedApiName.endsWith('kav')){ entityNames.add(entityDef.QualifiedApiName); } } // Make the describe call Schema.DescribeSobjectResult[] results = Schema.describeSObjects(entityNames); System.debug('Got describe information for ' + results.size() + ' sObjects.'); // Check if there is a formula field with JavaSscript used in the HYPERLINK function for(Schema.DescribeSobjectResult res : results) { Map<String, SObjectField> fields = res.fields.getMap(); for(String fieldKey: fields.keySet()){ SObjectField sField = fields.get(fieldKey); Schema.DescribeFieldResult fieldResult = sField.getDescribe(); // This will have the formula string for fields of type Formula String calculatedFormulaString = fieldResult.getCalculatedFormula(); // If the formula uses a HYPERLINK function with javascript vbscript or data protocol // it cannot be used for security reasons if(null != calculatedFormulaString && calculatedFormulaString.startsWithIgnoreCase('HYPERLINK') && (calculatedFormulaString.containsIgnoreCase('javascript:') || calculatedFormulaString.containsIgnoreCase('vbscript:') || calculatedFormulaString.containsIgnoreCase('data:'))){ System.debug('Object name: ' + res.getLabel()); System.debug('Field name: ' + fieldKey); System.debug(calculatedFormulaString); } } }

But the problem is my org is too big, so i am getting CPU timeout error.

For this error salesforce has mention "If your org has a large number of custom objects, you might encounter an Apex CPU limit error when you run the script. If so, you can modify this code to split the list of entities and run it for each subset of entities"

So my question is how to modify code to split the list of entities and run?

Thanks
Deval