I have to pass a percentage value with 2 decimal places through URL hacking in lightning, for French locale the decimal point is replaced with comma, now when I send the value containing comma, salesforce is not able to parse the URL and it is considering the later part of decimal as a field that is passed in URL.
if(UserInfo.getUiThemeDisplayed() == 'Theme4d'){
url = '/lightning/o/Contract/new?defaultFieldValues=AccountId=' + accId;
url = url + ',' + 'ZTS_EU_Related_Contract_Template__c' + '=' + contractTemplateDetail.Id;
if(contractTemplateDetail.ZTS_EU_Discount_Type__c == 'Fixed Discount'){
url = url + ',' + 'ZTS_EU_Discount__c' + '=' + discountValueFinal;
}
if(contractTemplateDetail.ZTS_EU_CTBusiness_Unit__c != null){
url = url + ',' + 'ZTS_EU_BusinessUnit__c' + '=' + contractTemplateDetail.ZTS_EU_CTBusiness_Unit__c;
}
url = url + ',' + 'ZTS_EU_Type__c' + '=' + contractTemplateDetail.ZTS_EU_Type__c;
url = url + ',' + 'ZTS_EU_Discount_Type__c' + '=' + contractTemplateDetail.ZTS_EU_Discount_Type__c;
url = url + ',' + 'ZTS_EU_Fiscal_Year__c' + '=' + contractTemplateDetail.ZTS_EU_Fiscal_Year__c;
url = url + ',' + 'ZTS_EU_End_Date__c' + '=' + date.parse(endDateString);
url = url + ',' + 'StartDate' + '=' + date.parse(startDateString);
}
Now the variable "discountValueFinal" contains the comma for french locale, the URL is created as -
/lightning/o/Contract/new?defaultFieldValues=AccountId=001F000001IgAPH,ZTS_EU_Related_Contract_Template__c=a1V3k000005AKO7EAO,ZTS_EU_Discount__c=1,00,ZTS_EU_BusinessUnit__c=a0oF000000DYx9UIAT,ZTS_EU_Type__c=Annexe,ZTS_EU_Discount_Type__c=Fixed Discount,ZTS_EU_Fiscal_Year__c=2020,ZTS_EU_End_Date__c=2020-10-31 00:00:00,StartDate=2020-10-01 00:00:00
Here you can see ",00" is present inside it which is creating problem.
No access to field 00. Either the field was removed from the entity or access to this field was removed
Please help to get rid of this.