web
You’re offline. This is a read only version of the page.
close
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 ?

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Omar,

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

  • Omar Abdelhamed Dev Profile Picture
    105 on at

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

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    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

    it's working ,, thanks a lot Gunjan

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans