Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

Query::insert_recordset() with changeCompany not working.

(1) ShareShare
ReportReport
Posted on by 326
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 326 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 326 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 230,503 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

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans