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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Object reference not set to an instance of an object, when calling a custom action to send email notification

(0) ShareShare
ReportReport
Posted on by 62

Hello everyone, 

I am posting this question with a desperate need of help,

And to give you some context, we have a custom Action that sends email notifications and I have a plugin that calls that custom action and sends email notification.

It works when called from an administrator user and at top of Organization, but when I try to execute it from a different user from a child BU with different priviledges, I get the error. "Object reference not set to an instance of an object".

That 2nd user has still access to the parameters needed to send the notification, notification config ref, ent. logical and ID ( Regarding Case )

Any ideias what might be causing this, please?

Logs from plugin:

Custom Action:

pastedimage1658751102499v1.png

Plugin Calling the action: 

      try
            {
                OrganizationRequest req = new OrganizationRequest("noesis_NotifyOnDemand");

                req["Target"] = notificationConfigRef;
                req["NotificationConfiguration"] = notificationConfigRef;
                req["EntityLogicalName"] = targetEntityReference.LogicalName;
                req["EntityId"] = targetEntityReference.Id.ToString();
                req["CreateAsDraft"] = createAsDraft;
                req["SplitToRecipients"] = splitToRecipients;

                TracingService.Trace($"Requesting Notification...\nParameters: {JsonConvert.SerializeObject(req.Parameters)}");

                OrganizationResponse response = Dynamics365Context.Execute(req);

                return response;
            }
            catch (Exception ex)
            {
                TracingService.Trace($"***Exception*** - Requesting Notification... Message: {ex.Message}, InnerException: {ex.InnerException}");
                throw new InvalidPluginExecutionException($"Exc. Message: {ex.Message}"); 
            }

Successfull Call

Target: incident | 818f1d1e-b10b-ed11-b822-00155d20085f

Service Provider not null

Plugin Execution Context not null

Organization Service Factory not null

Organization Service not null

IncidentManager is null? : False

PreImage is null? : False

START -- CheckAndExecuteCaseTypeOptions

Case Type Config: ebf093f8-15e8-ec11-b853-00155da304b1

Returned Case Type Options count: 7

SKIP -- Case Status != CTO Status: WaitingforInfo != Open? True

SKIP -- Case Status != CTO Status: WaitingforInfo != WorkInProgress? True

Found a CTO with matching status reason : WaitingforInfo and with Notification Configuration [Case Flow] - Notificações SmartPOS d601ba5e-12e8-ec11-b853-00155da304b1

Requesting Notification...

Parameters: [{"Key":"Target","Value":{"Id":"d601ba5e-12e8-ec11-b853-00155da304b1","LogicalName":"noesis_notificationconfiguration","Name":"[Case Flow] - Notificações SmartPOS","KeyAttributes":[],"RowVersion":null}},{"Key":"NotificationConfiguration","Value":{"Id":"d601ba5e-12e8-ec11-b853-00155da304b1","LogicalName":"noesis_notificationconfiguration","Name":"[Case Flow] - Notificações SmartPOS","KeyAttributes":[],"RowVersion":null}},{"Key":"EntityLogicalName","Value":"incident"},{"Key":"EntityId","Value":"818f1d1e-b10b-ed11-b822-00155d20085f"},{"Key":"CreateAsDraft","Value":false},{"Key":"SplitToRecipients","Value":false}]

Notification was sent successfully. ActivityIds a9bbc067-0b0c-ed11-b822-00155d20085f

END -- CheckAndExecuteCaseTypeOptions -- END

ERROR LOG

Target: incident | 818f1d1e-b10b-ed11-b822-00155d20085f

Service Provider not null

Plugin Execution Context not null

Organization Service Factory not null

Organization Service not null

IncidentManager is null? : False

PreImage is null? : False

START -- CheckAndExecuteCaseTypeOptions

Case Type Config: ebf093f8-15e8-ec11-b853-00155da304b1

Returned Case Type Options count: 7

SKIP -- Case Status != CTO Status: Pendingthirdparties != Open? True

SKIP -- Case Status != CTO Status: Pendingthirdparties != WorkInProgress? True

SKIP -- Case Status != CTO Status: Pendingthirdparties != WaitingforInfo? True

Found a CTO with matching status reason : Pendingthirdparties and with Notification Configuration [Case Flow] - Notificações SmartPOS d601ba5e-12e8-ec11-b853-00155da304b1

Requesting Notification...

Parameters: [{"Key":"Target","Value":{"Id":"d601ba5e-12e8-ec11-b853-00155da304b1","LogicalName":"noesis_notificationconfiguration","Name":"[Case Flow] - Notificações SmartPOS","KeyAttributes":[],"RowVersion":null}},{"Key":"NotificationConfiguration","Value":{"Id":"d601ba5e-12e8-ec11-b853-00155da304b1","LogicalName":"noesis_notificationconfiguration","Name":"[Case Flow] - Notificações SmartPOS","KeyAttributes":[],"RowVersion":null}},{"Key":"EntityLogicalName","Value":"incident"},{"Key":"EntityId","Value":"818f1d1e-b10b-ed11-b822-00155d20085f"},{"Key":"CreateAsDraft","Value":false},{"Key":"SplitToRecipients","Value":false}]

***Exception*** - Requesting Notification... Message: Object reference not set to an instance of an object., InnerException:

Thank you, 

Best regards

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Do you have a plugin that handles your noesis_NotifyOnDemand message?

  • Guido Preite Profile Picture
    54,086 Moderator on at

    probably is the action itself that generate the exception, not the code you wrote to call the action.

    You should check inside the action code if there are some custom activities called and the code there

    hope it helps

  • Suggested answer
    T1sh0 Profile Picture
    62 on at

    Thank you all for the suggestions. I have found out that this user was missing ReadAccess on Mailbox entity and therefore the plugin that sends notification returned "Object reference not set to an instance of an object." when trying to find the mailbox

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 162 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 134

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 55 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans