Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

how to change the crm 4.0 code with crm 2013 late bound code

Posted on by

Hello All,

                Below is my code in 4.0 

//Create the ConditionExpression.
CrmSDK.ConditionExpression condition = new CrmSDK.ConditionExpression();

//Set the condition for the retrieval to be when the project value is for the current project.
condition.AttributeName = "new_payratesid";
condition.Operator = CrmSDK.ConditionOperator.Like;
condition.Values = new string[] { EntityGUID };

//Create the FilterExpression.
CrmSDK.FilterExpression filter = new CrmSDK.FilterExpression();

//Set the properties of the filter.
filter.FilterOperator = CrmSDK.LogicalOperator.And;
filter.Conditions = new CrmSDK.ConditionExpression[] { condition };

//Create the Order Expression for sorting

CrmSDK.OrderExpression orderEffDate = new CrmSDK.OrderExpression();
orderEffDate.AttributeName = "new_effectivedate";
orderEffDate.OrderType = OrderType.Ascending;

CrmSDK.OrderExpression orderExpDate = new CrmSDK.OrderExpression();
orderExpDate.AttributeName = "new_expirydate";
orderExpDate.OrderType = OrderType.Ascending;

//Create the QueryExpression object.
CrmSDK.QueryExpression query = new CrmSDK.QueryExpression();

//Set the properties of the QueryExpression object.
query.EntityName = CrmSDK.EntityName.new_payrate.ToString();
query.ColumnSet = cols;
query.Criteria = filter;
query.Orders = new OrderExpression[] {orderEffDate, orderExpDate};

I want to change the above code as per crm 2013 using late bound , please kindly let me know how to change the above code.

Note:- Specifically i want to change the orderby code.

please kindly suggest me the best solution.

*This post is locked for comments

  • EmployeeOcta Profile Picture
    EmployeeOcta on at
    RE: how to change the crm 4.0 code with crm 2013 late bound code

    Thanx for your awesome suggestion , i have kept my code as it is and it's working fine for me.

    i have deployed the code on UAT for testing ones the issue gets resolved i will mark this as answer.

  • EmployeeOcta Profile Picture
    EmployeeOcta on at
    RE: how to change the crm 4.0 code with crm 2013 late bound code

    above things i have understand for orderexpression ,and as per your suggestion i have changed the code and it's working fine.

    but for "filter.AddCondition("new_payratesid", ConditionOperator.Equal, entityId);"

    this code i didn't understand what are you talking about.

    as the original code is using the like operator.

    please kindly elaborate that.

    Thanx in advance

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans