ClosePlan License Assignment

Introduction

ClosePlan Package licensing uses a site-wide configuration for all Subscribers instead of a per-seat configuration. This means, technically, that every user has access to the package.

Site-wide configuration overcomes Salesforce licensing issues inherent in Lightning Experience which are yet to be solved.

Instead of full site-wide licensing, ClosePlan uses internal Licensing to provide Users with access to ClosePlan modules. Previously, access was driven through permission sets, which worked well and Customers started to provision users automatically without a need to manually find and provision using the User Manager. However in either a manual or automated approach, ClosePlan would not be able to enforce any license limits based on what has been contracted.

As a result, the ClosePlan User Manager is used. The User Manager controls and provides visibility into provisioned Users within the subscriber's organization over time. As a result, automated provisioning has been removed because subscribers cannot access or manipulate license data.

To automate User Provisioning, we provide APEX APIs.

Technical Requirements

  • Apex Invocable

  • Flows / Process Builder Invocable

  • Bulkified

  • ClosePlan Package/User License not required for running User

Limitations

  • Only Users with ManageProfilesPermissionsets or AssignPermissionSets permission will be able to successfully invoke APIs to assign/modify user license.

API Reference

User Management APIs provide the ability to retrieve user license information or assign or change user licensing using the scopes

API methods are provided through global TSPC.CPUserManagement class.

Retrieving User License

Following methods allow accessing User ClosePlan license information through APEX

getUserLicense()

Signature

global static UserLicense getUserLicense()

global static UserLicense getUserLicense(Id userId)

UserLicense Class

TSPC.CPUserManagement.UserLicense

Global Properties

Property

Type

Description

Property

Type

Description

userId

ID

Readonly;

status

string

Readonly;

level

string

Readonly;

accessSuite

string

Readonly;

accessDealPlaybook

string

Readonly;

accessDealScorecard

string

Readonly;

accessDealRelations

string

Readonly;

hasAnyAccess

boolean

Readonly; True if at-least one module has at-least read access

Modifying User License

Following methods allow to modify user ClosePlan license through APEX, Flows or Process Builder.

API methods to modify ClosePlan user licenses can be invoked only in the context of the user who has “Manage Profiles and Permission Set“ or “Assign Permission Sets” permission granted. For instance, invoking API methods as a result of user profile update by the user without sufficient permissions would be canceled.

In order to assign users with ClosePlan licenses, the organization must have spare licenses of the given type available. In case licenses are depleted, the allocation will be canceled without any warning for the whole batch.

Users who have been suspended will be automatically skipped. If you want to change the license for these users, use ClosePlan User Manager.

setUserLicense()

Signature

global static void setUserLicense(UserLicenseRequest[] requests)

Parameters

Property

Type

Description

Property

Type

Description

requests

UserLicenseRequest[]

List of UserLicenseRequest objects

 

UserLicenseRequest Class

TSPC.CPUserManagement.UserLicenseRequest

Properties

Property

Type

Description

Property

Type

Description

user

User

  • Required

  • Record must include UserType and IsActive fields

scopes

string

  • Required

  • Accepts a list of space-delimited scopes

  • If the user already has specific access granted, but not specified the update’s scope, such access will be removed

Scopes

Scopes refer to scope type followed by the modifier class. Types can represent the app or module they grant access to or additional access modifier.

Type of scopes

The list of modules includes app-wide suite or module-based deal, and account. There are only two classes of access:

  • read: read access to all the ClosePlan module data.

  • full: modifying data in any way e.g. creating, editing, or deleting.

Note that not every combination of suite and module accesses is valid as they can be mutually exclusive.

 

Additional types currently include only the level with two classes available:

  • user: standard access for end-users. If level not specified, level:user will be applied by default if not level not set yet (license create)

  • admin: elevated access, which grants read/write access to ClosePlan admin section

 

In order to remove/deactivate user, use remove scope as an only value. Note that removal will be ignored if other scopes are added for the user at the same time.

Available scopes

  • level:admin

  • level:user

  • suite:full

  • suite:read

  • deal.playbook:full

  • deal.playbook:read

  • deal.scorecard:full

  • deal.scorecard:read

  • deal.relations:full

  • deal.relations:read

  • remove

 

Examples

Using APEX

// Get users based on user name or any other logic String[] userNames = new String[]{'user@yourorg.com'}; // User fields Id, UserType, IsActive are required User[] users = [SELECT Id, UserType, IsActive FROM User WHERE Username IN: userNames AND isActive=true]; // Build Licence Request List TSPC.CPUserManagement.UserLicenseRequest[] ulrs = new TSPC.CPUserManagement.UserLicenseRequest[]{}; for(User u : users){ TSPC.CPUserManagement.UserLicenseRequest ulr = new TSPC.CPUserManagement.UserLicenseRequest(); ulr.user = u;e // set scopes based on available scopes. // If level scope is ommited, new assignments will default to level:user while // already provisioned users will keep their current level. ulr.scopes = 'suite:full level:user'; ulrs.add(ulr); } // Execute TSPC.CPUserManagement.setUserLicense(ulrs);

 

Using Flows

The following example shows how to create Flow to assign ClosePlan license automatically whenever new user is Created

  1. Setup > Process Automation > Flows

  2. Click New Flow

  3. Select Record-Triggered Flow

  4. Click Create

  5. Click Object and select User

    1. You can define any conditions you like

      1. Although it's handled by the Service, you could add UserType equals Standard, because only Standard Users are supported.

    2. Or change the Condition Requirements list to None to execute every time

    3. Click Done

  6. Click Circle Plus sign to Add Element

    1. Select Action

    2. Search for ClosePlan: Set User License and select it

    3. Use Assign ClosePlan License as an action Label. API Name will be autofilled.

    4. Populate the Scopes field based on the available scope list above according to your needs.

      1. We will use suite:full in our case to provide user with full suite access.

    5. Populate User field with {!$Record}. This value will be always the same.

    6. Click Done



  7. Click Save

    1. fill Label (ie: 'ClosePlan: License assignment flow') and API Name

    2. Click Save

  8. Finally, click Activate