Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Answered

query expression order is not working

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

  • Nando07 Profile Picture
    Nando07 55 on at
    RE: query expression order is not working

    Hello Rashid ,

    It's working . thank you for your help

  • Verified answer
    Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: query expression order is not working

    Hi,

    Thank you for yoru query.

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

    Updated line:

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

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,645 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans