5 answers
- 10-1
We removed the Single quote from the Account name but again we received error for another Account name. Why Exalate is not supporting special characters? Is there any way to resolve this issue.
Error Detail Message:
Bad response when GET to /services/data/v54.0/query/?q=SELECT+Global_Industry__c%2cCompany_Revenue__c+FROM+Account+WHERE+Name=%27FARO Consulting & Solutions, LLC.%27 - 400 [{"message":"\nAccount WHERE Name='FARO Consulting \n ^\nERROR at Row:1:Column:85\nline 1:85 mismatched character '' expecting '''","errorCode":"MALFORMED_QUERY"}]- Sherine
Could someone please look into this issue?
- Javier Pozuelo
Hello Sherine,
The error you are encountering is due to a "Malformed Query". This is commonly caused by incorrect handling or escaping of special characters in the Salesforce SOQL (Salesforce Object Query Language) query.
Per the SOQL documentation, the only reserved characters are the single quote and the backslash characters. I will update you tomorrow on how to resolve this
- Sherine
Hi, Do we have an update on how to resolve this?
- Javier Pozuelo
Hello Sherine,
I apologize for the delay in response. I have a couple of questions: What Jira are you using? Also, the error is coming from a trigger or the Outgoing Sync of Salesforce? If so, could you provide the Outgoing Sync script or the Trigger?
- Sherine
Hi Javier,
We use Jira Data Center and the error we get from Outgoing sync of Salesforce.
Outgoing script:
if(replica.AccountId != null)
{
def Account_Info = httpClient.get("/services/data/v54.0/query/?q=SELECT+Global_Industry__c%2cCompany_Revenue__c+FROM+Account+WHERE+Name=%27${replica.AccountId}%27")
replica.AccountGlobal=Account_Info.records.Global_Industry__c[0]
replica.Accountcompanyrevenue=Account_Info.records.Company_Revenue__c[0]
//debug.error("${contact_name2.records.Global_Industry__c}")
}
else
{
replica.AccountGlobal = "None"
replica.Accountcompanyrevenue = "None"
} - Javier Pozuelo
Could you replace def Account_Info with the following and test it?
def Account_Info = httpClient.get("/services/data/v54.0/query/?q=SELECT+Global_Industry__c%2cCompany_Revenue__c+FROM+Account+WHERE+Name='${replica.AccountId}'")
- Sherine
Hi Javier,
I tried the script you added above but still I get the following message.
Bad response when GET to /services/data/v54.0/query/?q=SELECT+Global_Industry__c%2cCompany_Revenue__c+FROM+Account+WHERE+Name='Coeur d'Alene Tribe' - 400 [{"message":"\nWHERE Name='Coeur d'Alene Tribe'\n ^\nERROR at Row:1:Column:90\nline 1:90 mismatched character '' expecting '''","errorCode":"MALFORMED_QUERY"}]
- Javier Pozuelo
Hello Sherine,
Let's try something else, we will try escaping the single quote by doing the following:
def escapedAccountId = replica.AccountId.replaceAll("'", "\\\\'") def query = "/services/data/v54.0/query/?q=SELECT+Global_Industry__c%2cCompany_Revenue__c+FROM+Account+WHERE+Name='${escapedAccountId}'" def Account_Info = httpClient.get(query)
Let me know how it goes
- Sherine
Thank you Javier for your help. I tried the script you added above and I get the following error
Bad response when GET to /services/data/v54.0/query/?q=SELECT+Global_Industry__c%2cCompany_Revenue__c+FROM+Account+WHERE+Name='FARO Consulting & Solutions, LLC.' - 400 [{"message":"\nAccount WHERE Name='FARO Consulting \n ^\nERROR at Row:1:Column:85\nline 1:85 mismatched character '' expecting '''","errorCode":"MALFORMED_QUERY"}]
- Javier Pozuelo
I can see that it's giving an error with a different account name, the previous error was with the following value: 'Coeur d'Alene Tribe'. Did the solution that I provided fixed the error with that value?
- Sherine
yes the solution solved the other account name with single quotes
Add your comment... - 10-1
Hi,
Still face the same issue. Tried the following: 'Coeur d\' Alene Tribe' but still get the same error message.
Thank you
Add your comment... - 10-1
The Single quote must be escaped using backslash, so try the following: 'Coeur d\' Alene Tribe'
Add your comment... - 10-1
Do we have any update here?
Add your comment... - 10-1
Could someone please look into this issue?
Add your comment...
We receive the below error in Salesforce when trying to Sync from Salesforce to JIRA: