Using PSAResourceTable in Dynamics AX Project Management and Accounting Module

by | Updated August 15, 2016 | Development, Dynamics AX

The PSAResourceTable is used often in the Project Management & Accounting module.  It holds a list of valid worker resources and is used when assigning workers to tasks.  What isn’t immediately clear is how to use it.  The first problem is that it is used like a temp table, but it isn’t defined as a temp table.  Instead, it has a Guid field called UserSesssion that controls who will see the records.  You also won’t easily find any insert statements inserting records into the table.  That is where the ProjProjectResourceList class comes in.  This class is responsible for populating the PSAResourceTable and deleting the records when you are done.

To see this in action you will first need to add some workers as project resources.  Go to Project management and accounting/Common/Project resources/Resources and click the Resource button on the Action Pane.
New Resource

 

Add a few resources by choosing appropriate values for each field and press OK.  When you are done you should see something like this.
Resources_PSAResourceTable

Now we can query the PSAResourceTable for our resources.
private void findResources()

{

PSAResourceTable resources;

HcmWorker hcmWorker;

 

ProjIProjectResourceList resourceList;

guid userSession;

utcDateTime startDateTime;

utcDateTime endDateTime;

// This Guid is used to filter the table to just our results.

userSession = newGuid();

// Construct the ProjProjectResourceList

resourceList = ProjProjectResourceList::construct(userSession);

  // These dates are used to filter the workers

startDateTime = DateTimeUtil::getSystemDateTime();

endDateTime = DateTimeUtil::maxValue();

 

// Populate the PSAResourceTable

resourceList.getResources(startDateTime, endDateTime);

 

// Now we can query the table for our resources.

while select Resource, ResourceCalendar, ResourceDataArea, LegalEntity from resources

where resources.UserSession == userSession

&& resources.ResourceSet == ProjResourceSet::Cache

  join HcmWorker

where HcmWorker.RecId == resources.Resource

{

info(HcmWorker.name());

}

// Our records will remain in the table until we clear them out because this

   // isn’t a real temp table.

resourceList.clearResources();

resourceList.clearResourceSet();

}

 

Make sure you call clearResources and clearResourceSet when you are finished with the table so you don’t pollute it with orphaned records.

Related Posts

  • I recently came across an issue dealing with project validation in Dynamics AX. Displayed here are a couple setup features in the project management and accounting module and  some tips that might help…

  • Microsoft Dynamics AX 2012 offers robust functionality designed to more effectively manage compensation across entire organizations.  Compensation is managed using compensation plans in combination with eligibility rules to restrict enrollment…

  • Over on the AX Support site on MSDN, Daniel Durrer has taken the time to keep tabs on the latest builds for Microsoft Dynamics AX 4.0, 2009 and 2012.  I…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events

october

07oct12:00 pm1:00 pmThe Three Paths to Business Central from Dynamics GP

08oct11:00 am12:00 pmConfab with Stoneridge - Livestream - The Vision and Strategy of Microsoft Business Systems

14oct10:00 am10:30 amThe Modern Manufacturer - Managing Complex Cost Modeling

14oct12:00 pm12:30 pmGenerating Custom Inspection or Process Forms

19octAll Day22Stoneridge Connect Fall 2020

22oct11:00 am12:00 pmConfab with Stoneridge - Livestream - Stoneridge Connect Recap

28oct10:00 am10:30 amThe Modern Manufacturer - Engineering Change Management: Introduction of NEW Functionality for Manufacturers Using Dynamics 365

november

18nov10:00 am10:30 amThe Modern Manufacturer - Tears and Trauma of MRP

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X