The functionality and idea descriped in this blog post are done with PSA Version 2.4.X. Also I must thank the Microsoft-Support Engineers for their input for this Article!
Currently there is no oob solution shipped which enables PSA Users to close completed Project Contracts. Out of the box it is only possible to Confirm or Close as Lost.
Even though the Project Contracts are the same Entity as Sales Orders they have a different logic behind (see Actuals and Facts). Project Service uses a different Form and also in addition different attributes. One particular example is the Status and Status Reason of Project Contracts as for this purpose other equivalent attributes with the msdyn Publisher are used.
Default Sales Orders use the following attributes:
As these fields are system fields they "stay" for PSA in the Background and are used when closing a Project Contract as lost. (There might be some other uses but I never discovered it)
PSA Project Contracts use the fields msdyn_psastate and msdyn_psastatusreason.
These fields are Option Sets and by default visible on the form with some limitations. Both are visible on the Project Contract in the Header but only the Contract Status Reason is editable . The Contract Status Reason (msdyn_psastatusreason) is visible on the main form too but only the following statuses can be selected:
By looking into the properties of the existing Option Set even other Status Reasons can be seen.
Label | Value |
Draft | 192350000 |
In review | 192350001 |
On hold | 192350002 |
Confirmed | 192350003 |
Completed | 192350004 |
Lost | 192350005 |
Abandoned | 192350006 |
The first 3 values can be selected by the user. The value for Confirmed is selected when confirming a Project Contract and the value for Lost is used if a Project Contract is closed as lost (see the button). But what about the Status Reasons Completed and Abandoned?
Oob these fields are hidden (or filtered) by the function initializePSAStatusReasonLookup which is called on Load from the Webressource ContractInitialization.js.
Like in my last blog covering the Project Entity - you can modify the Webressource / Script to make the other options available.
! ! ! Please create a copy of this Webresource and do not modify the original as editing will prevent this component from being updated automatically by Microsoft. Instead modify the copy and ad the library to the Form like the original Webresource ! ! !
Open Webressource ContractInitialization.js. At the start of line 16 in the script you might see the following definitions:
If you want to add f. e. the Completed status reason add the following lines:
You can copy and paste these lines for the Completed status reason:
msdyn.contract.defaults.completedStatusReason = 192350004;
msdyn.contract.defaults.supportedContractStatusReason[msdyn.contract.defaults.completedStatusReason] = true;
For Abandoned status reason add these lines:
msdyn.contract.defaults.abandonedStatusReason = 192350006;
msdyn.contract.defaults.supportedContractStatusReason[msdyn.contract.defaults.abandonedStatusReason] = true;
As you can see in this sample the Completed Status reason is now available:
BEWARE by using the Complete status reason brings it's downside too as it locks all the other fields of the record by oob-Script...
Feel free to use this information for enhancing and customizing your PSA System.
Here are some additional thoughts and ideas from my side:
Coders could think about a Plugin or a Script for achieving this (Personally I prefer a Script). For no-code-custimizing you can modify this attribute with a Workflow too to reopen the Project Contract. The Workflow doesn't need a modified Script however so you can also leave the above descriped modifications out and close the Project Contract directly as Completed by the Workflow. Or you can add a custom button to the ribbon which triggers the Script or the Workflow.
You can also change the status of the record in addition to fully reflect the status of the Business Case (e. g. status of the record fullfilled, PSA Contract Status Reason Completed; record set to read-only). For some reason completely fullfilling a Project Contract let's you still changing the PSA Contract Satus Reason which should be overridden by BR or Script.
Happy Tooling!
*This post is locked for comments