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)

Plugin's Target missing attributes

(0) ShareShare
ReportReport
Posted on by 30

Hello,

I have an entity called Student with two attributes - an OptionSet field called Status and a Lookup field called Faculty.

On a record update (Post-Op) I'd like to trigger a plug-in whenever the Status changes to a certain value.

The record to be updated has a Faculty attached to it already.

My code is as follows - 

        Entity studentTarget = context.InputParameters["Target"] as Entity;
            new_student student = studentTarget.ToEntity<new_student>();
            if (student.Contains("new_faculty") && student.new_Faculty != null && student.new_Status.Value == 3)
            {
// some logic
}

But the Faculty attribute returns null. 

P.S. When registering a new step to the plug-in , in Filtering Attributes, I included both Faculty and Status attributes.

What could be the problem here?

Is it because the Faculty doesn't change that the attribute returns null? If so, how can I resolve this problem?

Thank you

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Kokulan Profile Picture
    18,054 on at

    Hi

    I would first check if the attribute is passed in the entity image before converting to new_student.

    you could try something like this 

    var hasAttribute =  studentTarget.Attributes.Contains("new_faculty")
    throw new InvalidPluginExecutionException("Faculty attribute passed? : " + hasAttribute); }

    If this exception displays true for attribute passed, the problem is in the mapping to early bound class.

  • Verified answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    in the update message the target contains only the attributes that changed. If you need to access other fields you need to register an image

    more details here

    https://community.dynamics.com/crm/b/thinkdynamicdodynamic/archive/2018/01/21/pre-image-and-post-image-in-dynamics-crm

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