Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Retrive All Projects childs and childs of childs

(0) ShareShare
ReportReport
Posted on by 105

in project managment i wanna get all projects childs and childs of childs 

for ex proj1 - proj1-1 - proj1-1-1 - proj1-2


* proj proj1-1 , proj1-2 childs of proj1

*  proj1-1-1 child of proj1-1

i wanna retrive all in one query ,, any help ?

  • Omar Abdelhamed Dev Profile Picture
    105 on at
    RE: Retrive All Projects childs and childs of childs

    it's working ,, thanks a lot Gunjan

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Retrive All Projects childs and childs of childs

    Hi Omar,

    You can try with a job like this and check if that works for you.

    static void displayProjHierarchy(Args _args)
    {
        ProjTable   projTableParent, projTableLoc;
        List projList;
        Enumerator  en;
        str         projStr;
        List getChildProjectsFromRootProject(ProjId _projId, List _projList)
        {
            ProjTable   projTable;
    
            while select projTable
                  where projTable.ParentId == _projId
            {
                _projList.addEnd(projTable);
    
                if (projTable.ProjBudgetManagement == ProjBudgetManagement::None && ProjTable::child(projTable.ProjId))
                {
                    getChildProjectsFromRootProject(projTable.ProjId, _projList);
                }
            }
    
            return _projList;
        }
        
        
        while select projTableParent        
                where projTableParent.ParentId  == '' 
        {
            projStr = projTableParent.ProjId;
            projList = new List(Types::Record);
            getChildProjectsFromRootProject(projTableParent.ProjId , projList);
            
            en = projList.getEnumerator();
            
            while (en.moveNext())
            {            
                projTableLoc = en.current();                                
                projStr  = ">"   projTableLoc.projId;             
            }
            
            info(projStr);        
        }
        
        
    }

  • Omar Abdelhamed Dev Profile Picture
    105 on at
    RE: Retrive All Projects childs and childs of childs

    you can say i need to display them in info .. how can i find all childs and sub childs

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Retrive All Projects childs and childs of childs

    Hi Omar,

    Where are you going to display the result of this query you are trying to write?

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

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,459 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,066 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans