REST message in a specific language

Frank Silveira
Tera Contributor

Hello Experts, 

 

I have a REST call, triggered by a business rule when the record is updated, where a payload is created based on the record that triggered the rule and then sent to an external service.

Right now my problem is that, since the business rule is triggered by the user, the payload is being created based on the language of that user (fields like "category" that have translated values).

I want those fields to be sent always in the same language. I've tried using the impersonation in the business rule script but when testing it it would always log me out of the instance.

Do you have any suggestions on how can I achieve this?

 

Thank you in advance.

5 REPLIES 5

Hm, that is weird. It should even say it is a wrong language if it does not exist: 

SebastianL_2-1689077968371.png

 

 

//Stores the current language and prints it
var curLang = gs.getSession().getLanguage(); 
gs.info(curLang);

//Setting new language for the session
gs.getSession().setLanguage("it"); //Sets a new language for the current session

//Checking we have set the language correctly and prints the new one out.
var newLang = gs.getSession().getLanguage(); 
gs.info(newLang);

//Setting it back to original and checking it is reset correctly
gs.getSession().setLanguage(curLang); 
gs.info('Original Language: ' + gs.getSession().getLanguage());

 

It should look like this; 

SebastianL_1-1689077903836.png

 

 


Best regards,
Sebastian Laursen