+ Start a Discussion
Avik DattaAvik Datta 

Need to show User license data

We are having user license related list under Company Information as below.

User License list

I need to show that information only in a VF page. It is fine if we can able to show only this section of Company information.

Anybody is having any idea on this.Please reply.
Abhishek BansalAbhishek Bansal

Please folllow the below steps to show the UserLicense Information in VF page.

Step 1 : Create a new class with name "UserLicensePageController" and paste belwo code in it and then save :
public class UserLicensePageController {

    public List<UserLicense> userLicenseList { get; set; }
    public UserLicensePageController(){
        userLicenseList = new List<UserLicense>();
        userLicenseList = [Select Name from UserLicense];

Step 2 : Now create a VF page and paste below code in it :
<apex:page controller="UserLicensePageController">
    <apex:form >
        <apex:pageBlock title="">
            <apex:pageBlockTable value="{!userLicenseList}" var="userLicense">
                <apex:column headerValue="Name" value="{!userLicense.Name}"/>
                <!--<apex:column headerValue="Status" value="{!userLicense.Status}"/>
                <apex:column headerValue="Total Licenses" value="{!userLicense.TotalLicenses}"/>
                <apex:column headerValue="Used Licenses" value="{!userLicense.UsedLicenses}"/>-->

Click Save and then click on Preview button 
You will see a VF page containing UserLicenese detail of your ORG.

In this example i have only shown name field.
Please add more columns in query and VF page to show other fields of UserLicense Object.

Let me know if you need more help on this.

Avik DattaAvik Datta
Thanks Abhishek for your input. But we also follow same approch but if you check that there are no such field TotalLicenses,UsedLicenses in UserLicense Object. So we are unable to fetch that value in VF page. 
Avik DattaAvik Datta
Anyone have any Idea on this???