Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions Server-Side Components/Server Side/Record as Link/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Record as a Link Utility

The **Record as a Link Utility** is a versatile tool designed to dynamically render records as clickable links in any HTML field for any table. This utility allows you to choose specific fields to display, making it ideal for use cases such as notifications, generating PDFs, and more.

## Features

- Dynamically render records based on selected table and fields.
- Generate clickable links for seamless navigation.
- Compatible with various use cases like notifications, reports, and document generation.

## Use Cases

- **Notifications**: Display dynamic links to records in notification messages for any record in serviceNow
- **PDF Generation**: Embed clickable record links in generated PDFs.
- **Custom Applications**: Use in any HTML field to enhance interactivity.

## How to Use

Use the utility as used given code and merge it with other html. example attached for reference.


## Example Usage for PDF Generation

```javascript
var recordToLinkUtil = new RecordToHTML("incident", "1c741bd70b2322007518478d83673af3",
"incident: ${number}-${short_description}",true);

var html = '<h1>Incident Link is genearted</h1>\n' + recordToLinkUtil.toString();
var fileName = 'Test File with RecordLink';
var tableName = 'incident';
var recordSysId = "a623cdb073a023002728660c4cf6a768";

// Generate PDF and attach
var pdfResult = new sn_pdfgeneratorutils.PDFGenerationAPI().convertToPDF(
html,
tableName,
recordSysId,
fileName,
''
);
```

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function getLink() {
var recordToLinkUtil = new RecordToHTML("YOUR_TABLE_NAME", "RECORD_SYS_ID",
"CUSTOM_TEXT_TO_ADD_BEFORE_LINK: ${number}-${short_description}", true);
return recordToLinkUtil.toString();
}


Loading