web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Secure config and insecure config problem

(0) ShareShare
ReportReport
Posted on by

I would like to create an entity and I want to read the configs inside my plugin through that. But the problem is, there should be some way for my plugin to identify which record in that entity should read depending upon the operation (i.e post / pre).

Can anyone suggest me some helpful workaround to suffice my requirement.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    ScottDurow Profile Picture
    21 on at

    Hi,

    Are you asking how to get access to the secure and insecure config in your plugin code?

    To get access you simply need to add a new constructor to your plugin (that inherits from IPlugin):

    public SomePluginConstructor(string unsecureConfig, string secureConfig)

    The difference between secure and unsecure is that the secure config will not be exported with a solution.

    hth

  • PavanKiranKumar2 Profile Picture
    on at

    Hi Scott,

    I am not asking how to use secure an unsecure config inside plugin. I want to access the data which I place in secure and insecure config from another custom entity.

    e.g... on account creation plugin I need some secure config data.. I will get that from some custom entity "cust".

    But the question is I need a generic way where in any plugin which fires at any time should be able to read appropriate config content which has given by the user through UI..

    Any help would be highly appreciable..

  • Suggested answer
    ScottDurow Profile Picture
    21 on at

    Ah sorry - I see.

    Well, this probably would be best implemented using a Configuration entity that you store name/value keys. Since the Plugin context runs under the scope of the SYSTEM user, you can can create an OrganizationService passing null:

    IOrganizationService service =   factory.CreateOrganizationService(null);

    Then use a QueryByAttribute Request to get the config with a specific key - msdn.microsoft.com/.../gg334708.aspx

    hth

  • Suggested answer
    ScottDurow Profile Picture
    21 on at

    I also meant to say - because the SYSTEM user has access to all records - there would be reason to give the user access to the Configuration entity.

  • PavanKiranKumar2 Profile Picture
    on at

    How can key value pair suffice this requirement..

    Please clarify this example.

    1. Plugin firing on Pre operation on account entity on creation of record it should get one config value.

    2. Plugin firing on Post-operation on account entity on updation of record it should get other config value.

    key can by any one.. either entity on which it is firing, or type of operation, or action taking place.

    But for the above requirement how can we do that.

  • Suggested answer
    ScottDurow Profile Picture
    21 on at

    Hi,

    You will need to define a set of keys that are named something like

    <EntityName>_<Message>_<OperationStage>

    In your plugins you can use the context to dynamically construct this key value using the context:

    context.PrimaryEntityName + "_" + context.MessageName + "_"+ context.Stage

    So each entity/message/stage combination will have a different key and so they will pick up a different config value from the name/value pairs.

    Does that make sense?

  • PavanKiranKumar2 Profile Picture
    on at

    Yes.. It is clear.. let me give a try on that.

  • Anjali Raj Profile Picture
    on at

    As Scott said defining a set of keys in below manner should work.

    <EntityName>_<Message>_<OperationStage

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans