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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

sql query in computed column field for data entity

(0) ShareShare
ReportReport
Posted on by 339

Hi Experts,

I have created a string unmapped computed column to the data entity for that field i have added a method which contains sql query, i have attached the sql server query below

select  TRACKINGTYPE,* from WORKFLOWTRACKINGTABLE
 join WORKFLOWTRACKINGWORKITEM on WORKFLOWTRACKINGTABLE.RECID = WORKFLOWTRACKINGWORKITEM.WORKFLOWTRACKINGTABLE  
 join WORKFLOWWORKITEMTABLE on WORKFLOWTRACKINGWORKITEM.WORKFLOWWORKITEMTABLE = WORKFLOWWORKITEMTABLE.RECID
 where WORKFLOWWORKITEMTABLE.REFRECID = 5637339576 order by WORKFLOWTRACKINGWORKITEM.CREATEDDATETIME desc

in the above query where WORKFLOWWORKITEMTABLE.REFRECID = 5637339576 // this is recid related to sales order.

below is my method in visual studio,

public static str getWorkflowStatus()
    {                
        str sqlspt  = 'select TRACKINGTYPE from WORKFLOWTRACKINGTABLE join WORKFLOWTRACKINGWORKITEM on WORKFLOWTRACKINGTABLE.RECID = WORKFLOWTRACKINGWORKITEM.WORKFLOWTRACKINGTABLE join WORKFLOWWORKITEMTABLE on WORKFLOWTRACKINGWORKITEM.WORKFLOWWORKITEMTABLE = WORKFLOWWORKITEMTABLE.RECID where WORKFLOWWORKITEMTABLE.REFRECID = '  SysComputedColumn::returnField(tableStr(SalesOrderHeaderV2Entity), tableStr(SalesTable), fieldStr(SalesTable, RecId));
        return sqlspt;
    }

Now i need help to write the "Order by WORKFLOWTRACKINGWORKITEM.CREATEDDATETIME desc" in Visual studio method.

Can anyone help me to solve this?

Thanks,

With regards,

srihari.

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Srihari,

    Why are you returning this field as a computed column? You can join the tables in the entity and return this field.

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Srihari,

    You can check a similar example (with joins and order by) in DirPartyBaseEntity.electronicLogisticsLocation

  • Srihari.molaka Profile Picture
    339 on at

    Hi Sergei,

    Thanks for your reply,

    please can i know how can we manage the computed column for incremental push.

    I mean incremental push will work for computed columns?

    with regards,

    srihari.

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Shrihari,

    Computed column data sources are not included in change tracking activation, so it will not work if data is not changed on data sources in entity itself.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans