AddTextAttachment method: PTNotification class

Syntax

AddTextAttachment(URLIdentifier, FileName, IsUserSpecific)

Description

Use this method to add an attachment to a text message, but the attachment should be limited to one. If the attachment count is not limited to one, the URL to access the attachments will be long and may be split into multiple messages thereby making it difficult to access the file. The method creates a URL to access the attachment. The URL is iScript based, and you should ensure that necessary permissions are granted to the users to access the iScript library. If the access is not granted, users will not be able to download the attachment.

When a user clicks the URL that they receive, the user is authenticated. If the authentication is successful, a verification process checks whether the URL is created for the logged in user. On successful verification, the attachment is streamed to the user. The attachment is first copied from the repository to a temporary store and then streamed to the user. On completing the streaming process, the file is cleared from the temporary store.

This method does not evaluate whether the attachment exists in the specified URL. Whether the file exists in the specified URL is validated when a user accesses the file.

Parameters

Parameter Description

URLIdentifier

Specify a URL Identifier.

FileName

Specify the name of the file that you want to attach, as a string. You must include the file extension as well.

FileName can include %UserId% as a template variable, which at runtime is replaced with the actual user ID of the recipient.

IsUserSpecific

This parameter, as a Boolean value, controls how the URL is generated.

  • True - The application class dynamically creates URL for each user. Use this option when recipients are passed as a role or when multiple recipients are specified.

  • False - The application class creates URL without user context. The generated URL is valid for any PeopleSoft user with permissions to access the web library.

Returns

A Boolean value, True if an attachment is added to the text message; False otherwise.

Example

&bRetCode = &objBroadcast.AddTextAttachment(@("URL.URLIDENTIFIER"), "%UserId%_attachment.pdf", true );