Skip to main content

Notifications

Announcements

No record found.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans