Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Answered

How to get owner field in current context

Posted on by 255

Hi all,

i want to trigger one plugin on change of owner filed on case

i have written code and registered step on assign message.

will i get owner id field in current context?

can anybody share code and steps how to trigger plugin on change of owner field and get the owner field in current context.

  • Mona Chavan Profile Picture
    Mona Chavan 255 on at
    RE: How to get owner field in current context

    Hi Pravin,

    after using context.inputparameters["Assignee"]

    this gives me only id of the updated owner

    i want name of owner this gives me null in name property.

    how can go for using post image?

  • Mona Chavan Profile Picture
    Mona Chavan 255 on at
    RE: How to get owner field in current context

    Thnaks Pravin,

    can you please explain why we are using Entity Reference there?

  • Mona Chavan Profile Picture
    Mona Chavan 255 on at
    RE: How to get owner field in current context

    Thnaks Pravin,

    can you please explain why we are using Entity Reference there?

  • Verified answer
    Pawar Pravin  Profile Picture
    Pawar Pravin 5,227 on at
    RE: How to get owner field in current context

    Both the values you would get into context only

    pastedimage1575454329591v2.png

  • Mona Chavan Profile Picture
    Mona Chavan 255 on at
    RE: How to get owner field in current context

    Thanks

    I am facing one problem while registering this plugin on Assign.

    if i write Entity Reference there i am not able to take Current Entity record Id.i need case id further to get its related records by passing case id in fetch.

    what shall i do in this case?

  • Suggested answer
    Pawar Pravin  Profile Picture
    Pawar Pravin 5,227 on at
    RE: How to get owner field in current context

    Hmmm. As mentioned above you should have to check entityreference in place of entity.

    if (context.InputParameters.Contains("Target") &&

                        context.InputParameters["Target"] is EntityReference)

  • Mona Chavan Profile Picture
    Mona Chavan 255 on at
    RE: How to get owner field in current context

    I have this line in my code

    if(context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)

    my plugin is on Assign message

    after debugging code i get result false for above if condition

    can anybody clarify this

  • Suggested answer
    Pawar Pravin  Profile Picture
    Pawar Pravin 5,227 on at
    RE: How to get owner field in current context

    Hi Mona,

    You could get it using entity reference as like:

    EntityReference assigneeRef =

                          (EntityReference)context.InputParameters["Assignee"];

    Please refer below url for more details:

    thinkingincrm.blogspot.com/.../consume-assign-sdk-message-in-crm-2011.html

  • Mona Chavan Profile Picture
    Mona Chavan 255 on at
    RE: How to get owner field in current context

    I have to write plugin on change of owner id field which will take some related entity records and send email to newly assigned owner.

    i am done retrieving related records but not able to get updated owner in current context can anybody please help me .

  • Mona Chavan Profile Picture
    Mona Chavan 255 on at
    RE: How to get owner field in current context

    which assembly reference i need to add for Moniker ?

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans