Hi, here we are going to learn about how to display Installed Packages details in visualforce page
Apex Class:
public class Details {
public List<Publisher> records1 {get; set;}
public boolean displayPopup {get; set;}
public Details(){
records1 = [SELECT Id,Name,NamespacePrefix,MajorVersion,MinorVersion,DurableId FROM Publisher WHERE IsSalesforce = false];
}
public void showPopup() {
displayPopup = true;
}
public void closePopup() {
displayPopup = false;
}
}
VisualForce Page:
<apex:page controller="Details" >
<style>
.custPopup{
z-index: 9999;
background:#F8F8F8;
position: absolute;
align:center;
}
</style>
<apex:form>
<apex:commandButton value="Show Installed Packages" action="{!showPopup}"/>
<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
<apex:pageBlock title="Installed Packages Details" >
<apex:pageblockTable value="{!records1}" var="p">
<apex:column headerValue="Publisher Name" value="{!p.Name}"/>
<apex:column headerValue="NamespacePrefix" value="{!p.NamespacePrefix}"/>
<apex:column headerValue="Version">{!p.MajorVersion}.{!p.MinorVersion}</apex:column>
<apex:column headerValue="DurableId" value="{!p.DurableId}"/>
</apex:pageblockTable>
</apex:pageBlock>
<apex:commandButton value="Close" action="{!closePopup}" style="height:auto;
width:auto;
text-align:center;
font-size:10px;
border-radius:5px;
margin-left:300px;"/>
</apex:outputPanel>
</apex:form>
</apex:page>
Output:
Note: Click the “Show Installed Packages” button then popup window will show installed packages details.