`. For example:
```xml
```
## Adding a button
Add the logic for the button in the `WSDConfigurableCardDataInjector` script include. Make sure to add the logic inside the `extendCardsData` method. For example:
```javascript
/* Adding functionality for a custom button */
extendCardsData: function(cards) {
cards.forEach(function(card) {
if (card.type === 'space') {
card.data.actions.secondary.push({
label: 'Custom Action',
id: 'custom_action',
action: 'custom_action',
isDisabled: false,
type: 'secondary'
});
}
}
});
```
**Note:** Buttons are displayed in the `Primary action buttons` section of the card.
## Adding a field
In the template \(macro\) XML code, add a `
` element in the section that requires a new field.
You can then add the logic to populate the field value in the `WSDConfigurableCardDataInjector` script include. For example:
```xml
{{ data.usable_size_sq_meter }}m square
```
```javascript
/* Custom logic to populate the field value */
cards.forEach( function(card) {
if (card.type ==='space') {
var spaceGr.get(card.data.sysId)) {
card.data.usable_size_sq_meter = spaceGr.getValue('usable_size_sq_meter');
}
}
});
```
## Adding a redirect button
You can add redirection buttons \(e.g. to a KB article or external portal\) on WSD location cards using the `action == 'redirect'` and a URL. You can use the target attribute to open the link in the same tab or a new tab.
```javascript
cards.forEach(function(card) {
if (card.type === 'space') {
// Internal KB article (same tab)
card.data.actions.secondary.push({
label: 'Custom Action',
id: 'custom_action',
action: 'custom_action',
label: gs.getMessage('Workplace guidelines'),
id: 'kb_guidelines',
action: 'redirect',
url: '/kb?id=kb_article_view&sysparm_article=KB0012345',
isDisabled: false,
type: 'secondary'
});
// External portal (new tab)
card.data.actions.secondary.push({
label: gs.getMessage('Catering portal'),
id: 'catering_portal',
action: 'redirect',
url: 'https://catering.example.com/order',
target: '_blank',
isDisabled: false,
type: 'secondary'
});
}
});
```
## Adding custom logic for a card
You can add custom logic for a card in the `WSDConfigurableCardDataInjector` script include.
In the `extendCardsData` method, add the custom logic to provide data for the new section to the card. For example, to modify the card title based on a building name:
```javascript
extendCardsData: function(cards) {
/* Modify card title based on the building display name */
cards.forEach(function(card) {
if (card.data.building && card.data.building.displayValue === 'HQ') {
card.data.title = '[HQ] ' + card.data.title;
}
});
return cards;
},
```
## Hiding an element
In the template \(macro\) XML code, delete the XML tag for the section that you want to remove, or surround it in a comment block. For example:
```xml
```
After hiding the element, make sure that you remove the custom logic, or surround it in a comment block. For example:
```javascript
/* The following method is in a comment block, therefore is not run on the card */
/* cards.forEach( function(card) {
if (card.type ==='space') {
var spaceGr.get(card.data.sysId)) {
card.data.usable_size_sq_meter = spaceGr.getValue('usable_size_sq_meter');
}
}
}); */
```
**Parent Topic:**[Workplace Core references](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/employee-service-management/workplace-core/wsd-references.md)
**Related topics**
[Components installed with Workplace Core]()
[Properties installed with Workplace Core]()
[Workplace Profile Location Assignment form]()
[Workplace location assignment anomaly types]()
[Reserve a space form]()