Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

SQL Statement in CIL returns wrong data

(0) ShareShare
ReportReport
Posted on by 621

Hi

We do have customized code where I try to get a record via sql statement

select forupdate mytable where mytable .extNum == '000052' && mytable .dataAreaid == 'TRV'

The record exist in mytable

Running the code in a job to verify it works....running it in a class called in CIL it never gets the record

Any suggestions?

  • CRSW Profile Picture
    621 on at
    RE: SQL Statement in CIL returns wrong data

    ah thx for the advice. I will check this

  • CRSW Profile Picture
    621 on at
    RE: SQL Statement in CIL returns wrong data

    as I mentioned. in the job YES. In CIL not

  • Verified answer
    Martin Dráb Profile Picture
    232,866 Most Valuable Professional on at
    RE: SQL Statement in CIL returns wrong data

    Your code looks wrong to me. If the table is company-specific, therefore it has DataAreaId, and your intention is updating TRV company data from another company, you forgot crossCompany keyword:

    select crossCompany forUpdate mytable
    	where mytable.ExtNum == '000052'
    	   && mytable.DataAreaIdd == 'TRV';

    Maybe you're running your job and your CIL code in two different companies.

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: SQL Statement in CIL returns wrong data

    Hi CRSW,

    Did you try debugging it to check if the statement returns a record?

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,099 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans