Project Server Entities Configuration using PowerShell Script- Creating Graphical Indicator Custom Fields
In my previous blog I talked about a complete PowerShell script for creating custom fields and one level lookup tables using Project Server PSI services. The uncovered part is to create a Graphical Indicator custom field. So, here I will be explaining how to add a graphical indicator custom field in project server.
In the XML file, which contain the detail for adding the enterprise project server fields the structure for representing the graphical indicator is
Thus, to create a graphical indicator
- We have used an attribute IsIndicator whose value need to be set as “Yes” .
- Add the
child which will contain the Indicator value to be displayed and the Image ID of the image to be used for that value as indicator.
To get the Image Id for the values perform following steps:
- Login to PWA
- Go to Server Settings->Enterprise Data->Enterprise Custom Fields and Lookup Tables->New Custom Field
- On New Custom Field page under Values to Display select Graphical Indicators.
- Do F12 of the page and then expand the image dropdown and using the Select Element option of the F12 window select the required image icon. The corresponding image information will get highlighted.
- To get the image ID for creating the custom field we must increase the image index value by 1. e.g. In below screenshot the name for cross image is cf_54p.png. So, the Image Id to be used for PowerShell scripting will be 55.
The PowerShell script for adding the graphical indicator is as follows:
In above code if the IsIndicator attribute value for a custom field in the XML has the value “Yes” then it is an indicator custom field. To set the indicator values to be added we parse through each of the Indicator child and generate a string assigned to $IndicatorList variable which is then assign to MD_PROP_GRAPHICAL_INDICATOR property of custom field row.
Now the import part is the string we are creating for the indicator values to set.
+“[[== “+$Invalue.Value+" ][“+$Invalue.ImageID+“]]"
The string is formed as
- First put 2 open square brackets then 2 equal to (=) sign.
- After that give a tab space and add the value to be displayed.
- Then give 2 tab spaces and a closing square bracket.
- Opening square bracket and the Image ID to be displayed.
- At last 2 closing square brackets.
If tab space does not work in the PowerShell IDE. You can create the string using a text editor and paste it in your script.
Thus, your graphical indicators will get easily added with these simple steps using PowerShell scripting.
Hope my both blogs were helpful to you. Happy PowerShell Scripting!!