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

june

02jun2:00 pm2:30 pmBusiness Intelligence for Batch Manufacturers

16jun10:00 am10:30 amHow AP automation can speed up month-end close in D365 Finance

17jun11:00 am12:00 pmConfab Live with Stoneridge – Real Time Marketing Strategies for Success

23jun10:00 am10:30 amThe Modern Manufacturer: Cost Accounting in D365

30jun10:00 am10:30 amAP Automation Checklist for a 2022 Rebound

30jun2:00 pm2:30 pmAchieving Success: How Technology Is Helping Nonprofits Thrive

july

01jul11:00 am12:00 pmConfab Live with Stoneridge – Dataverse Virtual Entities

14jul12:00 pm12:30 pmBeyond Reporting - What Business Intelligence Can Do For Your Agribusiness

15jul11:00 am12:00 pmConfab Live with Stoneridge – Integration Strategies for End User Success

21jul10:00 am10:30 amThe Modern Manufacturer: Manufacturing Software in the Real World

21jul12:00 pm1:00 pmIs it Worth it to Upgrade to Dynamics 365 Finance and Supply Chain Management? - Everything AX Users Need to Consider

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