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

query expression order is not working

(0) ShareShare
ReportReport
Posted on by 55

Hello,

In Javascript ,i Am trying to query data using the following code ;

var selectedOptionset = Xrm.Page.getAttribute("crm_type").getSelectedOption();

var optionValue = selectedOptionset.value;

var ConditionRequest1 = new Sdk.Query.ConditionExpression("incident",
"crm_type",
Sdk.Query.ConditionOperator.Equal,
new Sdk.Query.OptionSets([optionValue]));




var queryIncidentBorn = new Sdk.Query.QueryExpression("incident");
queryIncidentBorn.addColumn("incidentid","createdon");

queryIncidentBorn.addCondition(ConditionRequest1);
queryIncidentBorn.addOrder("createdon", OrderType.Ascending);



results = Sdk.Sync.retrieveMultiple(queryIncidentBorn);

i have  got an errorr that the ordertype is not defined

  • Verified answer
    Wahaj Rashid Profile Picture
    11,323 on at

    Hi,

    Thank you for yoru query.

    Please change "OrderType.Ascending" to "Sdk.Query.OrderType.Ascending".

    Updated line:

    queryIncidentBorn.addOrder("createdon", Sdk.Query.OrderType.Ascending);

  • Nando07 Profile Picture
    55 on at

    Hello Rashid ,

    It's working . thank you for your help

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Syed Aqib Raza Profile Picture

Syed Aqib Raza 96

#2
11manish Profile Picture

11manish 90 Super User 2026 Season 2

#3
ParthPatel249 Profile Picture

ParthPatel249 80

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans