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

september

01sep10:00 am10:30 amEnsuring Quality and Compliance for Batch Manufacturers in Life Sciences

01sep12:00 pm12:30 pmIs it Worth It to Move to the Cloud? A Look at Considerations for Current Agribusinesses Using Dynamics GP

01sep2:00 pm2:45 pmWhat’s New in Dynamics 365 Finance and Supply Chain

09sep11:00 am12:00 pmConfab Live with Stoneridge – Data Strategy and Reporting – Mining Decision Making Insights

15sep10:00 am11:00 amSolving the Biggest Challenges in Agribusiness Through Innovation and Technology

22sep12:00 am12:30 pmSimplifying Payroll and HR Management with ADP Workforce Now

22sep10:00 am10:30 amStreamlining Batch Manufacturing with Technology

22sep2:00 pm2:30 pmProcess Automation for Microsoft Dynamics D365 for Business Central, Finance and Operations and GP

23sep11:00 am12:00 pmConfab LIVE with Stoneridge - Riding the Wave 2 Release – Key Features Coming to Dynamics 365 this October

29sep10:00 am11:00 amTop Five Reasons Why NOW is the Right Time to Move from Salesforce to Dynamics 365 Customer Engagement

29sep12:00 pm12:45 pmUnderstanding Job Costing and Tax Management in Business Central

29sep2:00 pm3:00 pmDigitalizing Horticulture & Agriculture - How to Sell Plants Online and Simplify Business Management

30sep12:00 pm4:00 pmSecurity and Permissions Training for D365 Business Central or Dynamics NAV

october

06oct10:00 am10:30 amPreview of D365 Business Central Fall Release Features and Functionality

06oct12:00 pm12:30 pmInsider's Guide to New Features Available in the Fall Release of D365 Finance and Supply Chain

07oct11:00 am12:00 pmConfab LIVE with Stoneridge - Dataverse and Dynamics in Review – Let’s Get Technical

21oct11:00 am12:00 pmConfab LIVE with Stoneridge - Dataverse and Dynamics in Review – Let’s Get Functional

26oct(oct 26)9:00 am28(oct 28)5:00 pmStoneridge Connect Leadership and Community Conference

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