Skip to main content

Notifications

Announcements

No record found.

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

Job class to update" item model group "in inventModelGroupItem Table i'm facing issues !

(1) ShareShare
ReportReport
Posted on by 206
Hi every one!I have a requirement to change itemmodelgroup of item from /inventModelGroupItem/ table. Ihave to select UPDATE model group only where item type is /Item/ for all items. Item type is coming from Invent Table so Ihave to join the tables and then select /inventModelGroupItem/ for update.when i run thi class i face the error /Cannot edit a record in Relationship between items and item model groups (InventModelGroupItem). The record has never been selected/.  I have added the following code :
 InventModelGroupItem  inventModelGroupItem;        EcoResProduct         ecoresproduct;        InventTable           inventTable;        ttsBegin;                 while select forUpdate inventModelGroupItem            where inventModelGroupItem.ItemId != ''            join inventTable            where inventModelGroupItem.ItemId         == inventTable.ItemId            &&    inventModelGroupItem.ItemDataAreaId == 'QTS'            &&    inventTable.ItemType   == ItemType::Item        inventModelGroupItem.ModelGroupId = 'WA';        inventModelGroupItem.update();            ttsCommit;        info(/completed/);
 
 
  • Verified answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 9,818 Super User 2024 Season 2 on at
    Job class to update" item model group "in inventModelGroupItem Table i'm facing issues !
    Hi,
     
    make sure you pointed to the legal entity QAS
    otherwise you can use changeCompany('USMF')
    try this :
            while select forUpdate inventModelGroupItem            
                where inventModelGroupItem.ItemId != ''            
                join inventTable            
                where inventModelGroupItem.ItemId         == inventTable.ItemId            
                &&    inventModelGroupItem.ItemDataAreaId == inventTable.DataAreaId
                &&    inventTable.ItemType   == ItemType::Item 
            {
    
            }
    Best regards,
    Mohamed Amine MAHMOUDI

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans