Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Need a trigger when I add or remove languages in Language Settings

Posted on by Microsoft Employee

Hi,

I need a trigger when I add or remove languages in Language Settings. The trigger can be in Plugin Registration.

3187.language.png

How can get that trigger?

In LanguageLocale: statuscode and statecode doesn't change even the language is active. Please see following screenshot of "English US" language. I am surprise with it.

API-Data.png

Please suggest to me!

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Need a trigger when I add or remove languages in Language Settings

    Hi Kokulan,

    Value of Statecode is same for all the languages listed regardless of active/deactive. As per your suggestion, I have deactivated the language but value is still same. You can also see using your Dynamics instance API "domain/.../languagelocale". You will find that all the languages has same value for Active/Deactive. I think there is any other mechanism behind this but not getting actual behavior.

    Please suggest your thoughts!

  • Suggested answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: Need a trigger when I add or remove languages in Language Settings

    Hi

    If you look the above Statecode values, 0 is for Active.

    Could you deactivate a language and see if the code change to 1

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Need a trigger when I add or remove languages in Language Settings

    Hi Kokulan,

    Initially I thought the same to create a plugin on "update" of "statecode" or "statuscode". But when I looked at data using API, it doesn't show "1" for "Active" statuscode even the language is active. I have added screenshot of "English US" language which is already active in my CRM but it still say "0"/"null" for that language. And this value is same for all the languages. Please review screenshot that I just added in question.

    Please suggest.

  • Suggested answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: Need a trigger when I add or remove languages in Language Settings

    Hi

    If you only want your code to work when its activated or DeActicated, you could use the SetState message as thats more appropriate and will only trigger when state changes.

    To answer your question of which field and what value you should be using, please see below for the Statecode and Statuscode

    EntitySchemaName IsCustomizable SchemaName Type OptionValue OptionDescription
    LanguageLocale no Code String
    LanguageLocale no Language String
    LanguageLocale no LanguageLocaleId Uniqueidentifier
    LanguageLocale no LocaleId Integer
    LanguageLocale no Name String
    LanguageLocale no OrganizationId Lookup
    LanguageLocale no Region String
    LanguageLocale no statecode State 0 Active
    LanguageLocale no statecode State 1 Inactive
    LanguageLocale no statuscode Status 1 Active
    LanguageLocale no statuscode Status 2

    Inactive

     

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Need a trigger when I add or remove languages in Language Settings

    Hi Kokulan,

    If I use "Update" in Message Name, which field(attribute) I need to use to identify whether language is activate or deactivate? There 2 fields statecode and statuscode. But both the fields have same value for all the language. I need a field which I can use in Plugin to identify the operation.

    Please guide.

  • Suggested answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: Need a trigger when I add or remove languages in Language Settings

    Hi

    You could create a Plugin on LanguageLocale and it supports the following messages

    Message Name Primary Entity
    Retrieve LanguageLocale
    RetrieveMultiple LanguageLocale
    SetState LanguageLocale
    Update LanguageLocale

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Need a trigger when I add or remove languages in Language Settings

    Hi Goutam,

    Thanks for the idea. But I need a trigger when user activate/deactivate any language from CRM. Actually, I want to call a plugin when add and remove data in my custom entity based on active/de active operation.

    Please suggest,

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Need a trigger when I add or remove languages in Language Settings

    Hi ,

    You can not trigger any action on change of language , however you can get the user language id using "userSettings.languageId" from global context. So try to pass this value to your plugin.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans