Dynamic translator not working as expected when called from a businessrule
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 12:38 PM
Hi all,
We have a business rule calling the Google translator api to translate a field value from different languages to English. Below is the code
var gr = GlideRecord("asmt_metric_result");
gr.addEncodedQuery('metric.metric_type.evaluation_method=survey^sys_id=afc4d440db8e715023d73423e29619d5');
gr.query();
while (gr.next()) {
var sobj = sn_dt_api.DynamicTranslation.getTranslation(gr.string_value.toString(), {
"targetLanguages": ["en"],
"additionalParameters": [{
"parameterName": "texttype",
"parameterValue": "plain"
}],
"translator": "Google"
});
var trans = sobj.translations[0].translatedText.toString();
gs.info("Translated text: " + trans);
gr.u_string_value_english = trans;
gr.setWorkflow(false);
gr.autoSysFields(false);
gr.update();
}
It was working fine for the past 1 year and started returning an error as below from the past one week
sn_google_trans: Error while translating the text to language using Google Cloud Translator. Error:Request had insufficient authentication scopes.Response received:{
"error": {
"code": 403,
"message": "Request had insufficient authentication scopes.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
"domain": "googleapis.com",
"metadata": {
"service": "translate.googleapis.com",
"method": "google.cloud.translation.v3.TranslationService.TranslateText"
}
}
]
}
}
I thought it is an issue with the Oauth credential setup, but we are getting the tokens as usual. Any inputs on how to trouble shoot this issue is appreciated.
PS: Yes, we the Dynamic translation spoke properly installed and configured.
0 REPLIES 0
