# Shorten String Transform

**URL:** <https://developer.sailpoint.com/discuss/t/shorten-string-transform/76934>\
**Category:** Transforms\
**Tags:** transforms, community-developed, sailpoint-identity-security\
**Created:** [August 15, 2024, 7:55pm UTC](https://developer.sailpoint.com/discuss/t/shorten-string-transform/76934 "2024-08-15T19:55:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sup3rmark](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sup3rmark/32/36229_2.png) [@sup3rmark](https://developer.sailpoint.com/discuss/u/sup3rmark)\
**Post date:** [August 15, 2024, 7:55pm UTC](https://developer.sailpoint.com/discuss/t/shorten-string-transform/76934/1 "2024-08-15T19:55:18Z")

</div>

![Marketplace-Gradient](https://global.discourse-cdn.com/sailpoint/original/2X/1/191c2f240e254f15cbe18d38dc782da3bcc9172b.jpeg)

  

| | | |
| --- | --- | --- |
| 🗒 | **Description** | This transform returns up to the first X characters of the specified string. This is useful for situations where the string may contain fewer characters than the specified length, which currently causes an error with the existing `substring` primitive. |
| ⚖ | **Legal Agreement** | **By using this CoLab item, you are agreeing to SailPoint’s [Terms of Service](https://developer.sailpoint.com/discuss/tos) for our developer community and open-source CoLab.** |
| 🛠 | **Repository Link** | [colab-transforms/transforms/shorten-string at main · sailpoint-oss/colab-transforms · GitHub](https://github.com/sailpoint-oss/colab-transforms/tree/main/transforms/shorten-string) |
| 📖 | **New to Transforms in the CoLab?** | [Read the getting started guide for Transforms in the CoLab.](https://developer.sailpoint.com/discuss/t/getting-started-with-transforms-in-the-colab/13428) |
| 🏥 | **Supported by** | [Community Developed](https://developer.sailpoint.com/discuss/t/colab-support-models/17095#community-developed-busts_in_silhouette-3) |

# Overview

This transform returns up to the first X characters of the specified string. This is useful for situations where the string may contain fewer characters than the specified length, which currently causes an error with the existing `substring` primitive.

# Requirements

An existing value that you want only the first part of. This can be an identity attribute, an account attribute, or a value generated from another transform.

# Guide

To use this transform, modify the attribute being referenced to point to the desired target (an identity attribute, an account attribute, or a value generated from other transforms), and update the `$length` value specified on Line 11 to reflect the desired length.
