Applies to: SharePoint online and On-premises (2013, 2016, 2019 and SE)
Description:
In Custom Actions, we can update hyperlink column in add and update list item actions. If we put the full URL as the value to update, then the same URL will be shown as the display value of hyperlink column. However, frequently requirement is to have a different display text which is hyperlinked to the URL.
This article describes updating hyperlink column with link URL and link title in add or update item actions in Custom Actions. This is done using ‘strcat’ function so that both URL and title can be set.
Sample use case:
- This custom action uses ‘Asset Type’ and ‘Assets’ list.
- ‘Asset Type’ list has ‘Asset Info Link’ and ‘Asset Info Title’ single line of text columns.
- ‘Assets’ list has ‘Asset Info’ hyperlink column.
- Configure custom action in ‘Asset Type’ list to create Asset with ‘Asset Info’ hyperlink.
- In this custom action, we have mapped ‘Asset Info’ hyperlink column with ‘Asset Info Link’ as the URL and ‘Asset Info Title’ as the display text.
Custom Action:
Go to ‘Asset Type’ list à List Settings à Crow Canyon Custom Actions and configure the custom action as shown below:
Define a variable:
Define a variable ‘varSeparator’ with default value as comma and space (, ) as shown below. This variable will be used in ‘Create Asset’ action to update the ‘Asset Info’ hyperlink column.
2. Configure add item action to create an ‘Asset’.
Column mappings of ‘Asset Info’:
When mapping a value to hyperlink column, we can specify it as “<URL>,<Title>” to set separate values for the URL and the display value of the hyperlink.
Sample output: