web
You’re offline. This is a read only version of the page.
close
Skip to main content
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
    RE: Plugin's Target missing attributes

    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,084 Moderator on at
    RE: Plugin's Target missing attributes

    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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans