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 :
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

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans