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,...
Unanswered

CRM Plugin - Check inventory data

(0) ShareShare
ReportReport
Posted on by 25

Hello,

I am working on a plugin for CRM on-prem v8. 

The plugin should be checking the quantities of the products which are added via another form.

So there is an Order form and the products are listed in another form, let's call it Order Lines. Order form does not have a direct field for use of EntityReference, so I am using the QueryExpression with the Order forms GUID, to get the Order Lines. In the Order Lines form, I have products with quantities and I need to check those quantities in another form that contains aggregated quantities of each product. 

I am calling this plugin on the "Update" message, PreOperation, from the Order form.

What is the best way to do it? Can I use the results from the QueryExpression together with the EntityReference?

Columnset columns:

{[sc_product, Microsoft.Xrm.Sdk.EntityReference}

{[sc_location, Microsoft.Xrm.Sdk.EntityReference}

Here is the code so far:

QueryExpression orderlineQuery = new QueryExpression { EntityName = "sc_salesorderline", ColumnSet = new ColumnSet(new string[] {"sc_product","sc_location","sc_quantity"}) };
                    orderlineQuery.Criteria = new FilterExpression();
                    orderlineQuery.Criteria.AddCondition("sc_salesorderno", ConditionOperator.Equal, new Guid(target.Attributes["sc_salesorderid"].ToString()));
                    orderlineQuery.Criteria.AddCondition("statuscode", ConditionOperator.Equal, "1");
                    var result = service.RetrieveMultiple(orderlineQuery);
                    trace.Trace("REsult "   result.ToString());
                    if (result.Entities.Count > 0)
                    {
                        foreach(var results in result.Entities)
                        {

                        }
                    }

I have the same question (0)

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 196 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 129

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans