Skip to content

Post

Posts a new activity entry for a specified object. The properties of the activity are defined in the ActivityEntry interface.

1
$ActivityStream.Post(activity: ActivityEntry):string

Parameters

ActivityEntry activity
    The activity entry to post.

Returns

The ID of the newly created activity entry.

Remarks

Creating a basic activity for everyone:

1
2
3
4
5
$ActivityStream.Post({
    objectId : $Xml.Evaluate('Id'),
    objectType : 'customer',
    content: 'Customer ' + $Xml.Evaluate('Name') + ' is updated.'
});

Creating an activity to display only to administrators:

1
2
3
4
5
6
$ActivityStream.Post({
    objectId : $Xml.Evaluate('Id'),
    objectType : 'customer',
    content: 'Customer is updated.',
    targets: [ $Membership.Administrator ]
});

Create a new activity to display only to administrators and accounting, and notify accounting specifically:

1
2
3
4
5
6
$ActivityStream.Post({
    objectId : $Xml.Evaluate('Id'),
    objectType : 'customer',
    content: 'Customer is updated.',
    targets: [ { targetId: $Membership.Administrator }, { targetId : $Membership.FindIdentity('Accounting'), notify: true } ]
});

Create a new activity with a file attachment:

1
2
3
4
5
6
7
$ActivityStream.Post({
    objectId : $Xml.Evaluate('Id'),
    objectType : 'customer',
    content: 'Customer is updated.',
    targets: [ { targetId: $Membership.Administrator } ],
    attachment: [ $Xml.Evaluate('BillFileId') ]
});

Create a new activity on a case:

1
2
3
4
5
$ActivityStream.Post({
    objectId : $Xml.Evaluate('CaseId'),
    objectType : 'case',
    content: 'Customer is updated.'
});

Types

ActivityEntry

Represents a single entry in the activity stream.

@type : string
The type of activity being performed (e.g., "share", "update", "assign").

actor : ( string | Identity )
Specifies the actor (user or system) performing the activity.

attachments : Array<( string | ActivityEntryAttachment )>
An array of attachments related to the activity. Attachments can be specified as

objectId : string
The ID of the object that the activity is related to. This is a required property.

objectType : string
The type of object that the activity is related to (e.g., "case", "customer"). This is a required property.

publishedAt : DateTimeOffset
The date and time when the activity occurred. Defaults to the current date and time.

targets : Array<ActivityTarget>
Target audience for the activity.

ActivityEntryAttachment

Represents an attachment to an activity stream entry.

@type : ( "file" | "link" | "video" )
The type of attachment. Defaults to "file".

  • "file": Represents a file attachment.
  • "link": Represents a URL link.
  • "video": Represents a video.

id : string
The file ID of the attachment.

ActivityTarget

Defines the target audience for an activity, specifying who should see the activity. At least one of type or targetId is required.

@type : ( "Identity" | "Everyone" | "Members" | "Public" )
Specifies the type of target audience. Defaults to "Identity".

  • "Identity": Targets a specific user or group identity.
  • "Everyone": Targets all authenticated users.
  • "Members": Targets all members of a channel.
  • "Public": Targets everyone, regardless of authentication status.

notify : boolean
Specifies whether a push notification should be sent to the target audience. Defaults to

targetId : string
The ID of the target identity, used when