Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Unanswered

Query::insert_recordset() with changeCompany not working.

Posted on by 306
Hi,
 
I am using query::insertRecordSet() to the one of the business process requirement.
 
query is inserting always against first company record in the change company loop, eventhough company context is changing, 
 
Reason here is, source table dataareaid column is not resetting, but instead query::insertRecordSet(), if am using insertrecordset means,
each change company iteration, i can reset the table buffer.
 
If am using the query::insertRecordSet(), how to reset the table buffer.
 
the below code always doing insertion against 1200 legal entity only.
 
   public void insertion(Common _target, Map _fieldMapping, Query _query, QueryRun _queryRun)
   {
       changecompany ('1200')
       {
           Query::insert_recordset(_target, _fieldMapping, _query);
       }
       changecompany ('1100')
       {
           Query::insert_recordset(_target, _fieldMapping, _query);
       }
       
   }
  • Query::insert_recordset() with changeCompany not working.
    Hmm... that's unexpected....
    Have you tried creating a new buffer for each company call? I can send you some example code if you want.
  • vigneshvaran Profile Picture
    vigneshvaran 306 on at
    Query::insert_recordset() with changeCompany not working.
    Thanks Jonas, target also i set as null, but doesn't works.
  • vigneshvaran Profile Picture
    vigneshvaran 306 on at
    Query::insert_recordset() with changeCompany not working.
    Thanks Martin for the reply, inside in the above sample code, which buffer u will assign as null.
     
  • Martin Dráb Profile Picture
    Martin Dráb 228,706 Most Valuable Professional on at
    Query::insert_recordset() with changeCompany not working.
    Try assigning null to the buffer (inside the changeCompany block).
  • Query::insert_recordset() with changeCompany not working.
    You will either have to set your _target to null before you insert, or create a new buffer for each company.

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…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 228,706 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans