Skip to main content

Assigning Codes

To assign codes to an object, it first must be supported, that is, it has a lookup from the Record Code (seven20__Record_Code__c) object to the Code (seven20__Code__c). Each object also has a corresponding Lightning Web Component that can be added to the record page through the Lightning App Builder. See supported objects for specifics. Additionally, the component is also available on the Contact previews within Hotlists, Search and Match.

The component to assign codes is displayed on the record page as a card. The component shows codes that are already assigned to the record. Clicking the Configure Codes button opens up a modal that allows for the addition and removal of codes. Regardless of the categorisation method in use, the codes will be displayed in an expandable tree format, allowing the user to easily browse categories and find the codes they are looking for.

The codes displayed can be filtered using the search bar at the top of the modal. Codes can be selected/deselected using their individual checkboxes and it also possible to select/deselect entire categories at once by using the checkbox in the relevant parent node.

Selected codes, including those already assigned to a record, are also displayed as pills in a side panel on the right of the modal. Individual codes can be removed by clicking their x icon, or en masse via the Remove All button. Any changes made to code selections are reflected in the expandable tree, and vice versa.

info

Filtering is only applied to the lowest level of codes, not to Categories or Parent Codes.

Inactive Codes

If a code is flagged as inactive it will not be available to assign to records; if an inactive code is already assigned to a record it will be displayed but visually indicated as inactive in the Configure Codes modal so that it can be removed from the record, if required.

Display Categories

If a given record has a code assigned to it, the Display Categories button will appear. Clicking this button produces a modal that displays each code sorted alphabetically by category. Codes without a category will appear at the bottom of the list in the No Category section. The presence of this button is controlled by a design time attribute, with the button toggled off by default.

Supported objects

The following objects are supported:

Object NameRecord Code LookupFlexipage Component Name
Accountseven20__Account__cAccount Codes
Contactseven20__Contact__cContact Codes
seven20__Job__cseven20__Job__cJob Codes
seven20__Job_Lead__cseven20__Job_Lead__cJob Lead Codes
note

Custom objects/lookups are not supported.

Mass assigning Codes

For the below objects it is possible to mass assign Codes via a List View mass action:

Object NameList View Action Name
AccountMass Code
ContactMass Code
seven20__Job__cMass Code
seven20__Job_Lead__cMass Code

Mass Code is also available as an action for Contacts within Search.

note

If a record already has one of the selected Codes assigned, such duplicates will be ignored and all other Codes will still be assigned.

Custom code assignment

Record codes can be created through custom functionality, such as flows or by dataloading, if required. Simply create a new record in the seven20__Record_Code__c object with the following fields:

Field NameDescription
seven20__Code__cThe Id of the Code record to assign
seven20__Account__cThe Id of the record to assign to
seven20__Contact__cThe Id of the record to assign to
seven20__Job__cThe Id of the record to assign to
seven20__Job_Lead__cThe Id of the record to assign to
danger

A record code must only have one of the non-Code lookups populated.

caution

Uniqueness is enforced for Record Codes, errors will be added to duplicated records on insert/update. Partial success should be allowed in apex/flow when assigning Codes en-masse, to prevent non-duplicated records being blocked.

Flow Accessible Configure Codes UI

A flow accessible version of Seven20's Code hierarchy selector named Code Hierarchy Selector is available for use in custom flows, allowing for the same look and feel as the Configure Codes UI used in the packaged Seven20 Lightning Web Components.

Flow InputDescription
Object API NameThe Object API Name that the Codes (seven20__Code__c) are being assigned against; determines what Codes are available for selection
Selected CodesA text collection representing the Ids of the seven20__Code__c SObjects that are selected in the hierarchy, available for input and output

The output from the component can be retrieved from the Selected Codes variable mentioned above. This can be done either automatically or manually - see the Salesforce Flow Element: Action documentation for further guidance. The flow must then use the output retrieved from Selected Codes to assign codes to the selected record(s).

When using the component to configure Codes in the context of a single record, any existing Code assignments should be retrieved and a collection of their Ids passed into the Selected Codes variable. If the user deselects any of these previously assigned Codes, the flow will need to handle the deletion of the relevant Record Codes in addition to creating any new ones.