Pass Company, Language in D365 JSON Custom Service

In D365 FO we have multiple service Endpoints to integrate with D365 FO.

In SOAP based Custom Service we have used CallContext to pass the Company, Language.
Based on the value system will run on respective company, language.

In JSON based Custom Service, how to set the Company, Language for specific operation ?

There is no standard data contract similar to CallContext. You need to implement this logic by yourself. Add parameters for company and language to your data contract class and then use changeCompany and infolog.language() in your service operation.

Thanks Martin,

For Company I agree with you for ChangeCompany, If 2 different language users are using instantly conflict may occur by overwriting each user language. For example infolog.language(‘en-us’) as User 1, infolog.language(‘fr’) as User 2. It may contradict with each other.

Hmm, I agree that two users may use two different languages, but I still don’t see any problem. What language you use when calling a web service isn’t necessarily related to any user, and if you want to take language from a user, you want to select a single user, don’t you?
The web service should be called in the context of a single user - trying to have two “current” users at the some time doesn’t make a good sense and it’s not supported by F&O. For example, if a record is created, CreatedBy field will be populated with a single user ID. It’s not possible to say that the record was created by two different users.

Let me rephrase my terminology here. It’s not 2 users(D365 Users), it’s a D365 service operation called by 2 different external system in parallel. One App sendings as ‘en-us’ and another app sending as ‘fr’. Also I agree with you any number of call will use the AAD App user as created by user across the service in D365 FO.

Each call will get its language in a parameter and sets the language of its session. So there won’t be any conflict.