CPQ – Display PSL Assignees

If you haven’t noticed, Salesforce removed the “Manage Licenses” link from the CPQ Installed Package listing. Here’s an easy Visualforce page that shows these license assignments. The intention here is to enhance this page to allow for assigning/unassigning licenses.

Class

public with sharing class CPQPSLAssignments {
    public List<PermissionSetLicenseAssign> CPQPSLRecords {get; set;}
    public boolean hasCPQ {get; set;}
    
    public List<PermissionSetLicenseAssign> AAPSLRecords {get; set;}
    public boolean hasAA {get; set;}
    
    public CPQPSLAssignments() {
        CPQPSLRecords = [select Assignee.Id, Assignee.Name, PermissionSetLicense.MasterLabel from PermissionSetLicenseAssign where PermissionSetLicense.MasterLabel in ('Salesforce CPQ License')];
        hasCPQ = CPQPSLRecords.size() > 0;
        
        AAPSLRecords = [select Assignee.Id, Assignee.Name, PermissionSetLicense.MasterLabel from PermissionSetLicenseAssign where PermissionSetLicense.MasterLabel in ('Salesforce CPQ AA License')];
        hasAA = AAPSLRecords.size() > 0;
    }
}

Visualforce Page

<apex:page controller="CPQPSLAssignments">
<apex:pageBlock title="CPQ PSL Assignments">
  <apex:pageBlockTable value="{!CPQPSLRecords}" var="Record" rendered="{!hasCPQ}">
   <apex:column >
    <apex:facet name="header">Actions</apex:facet>
       <a href='/udd/Licensing/assignPermissionSetLicense.apexp?userId={!Record.Assignee.Id}' target="_blank">Edit</a>
   </apex:column>
   <apex:column >
    <apex:facet name="header">Account Name</apex:facet>
       <a href='/{!Record.Assignee.Id}?noredirect=1&isUserEntityOverride=1' target="_blank"><apex:outputText value="{!Record.Assignee.Name}"/></a>
   </apex:column>
  </apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title="Advanced Approvals PSL Assignments" rendered="{!hasAA}">
  <apex:pageBlockTable value="{!AAPSLRecords}" var="Record">
   <apex:column >
    <apex:facet name="header">Actions</apex:facet>
       <a href='/udd/Licensing/assignPermissionSetLicense.apexp?userId={!Record.Assignee.Id}' target="_blank">Edit</a>
   </apex:column>
   <apex:column >
    <apex:facet name="header">Account Name</apex:facet>
       <a href='/{!Record.Assignee.Id}?noredirect=1&isUserEntityOverride=1' target="_blank"><apex:outputText value="{!Record.Assignee.Name}"/></a>
   </apex:column>
  </apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

Reference

D P

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.