Skip to content

Post

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

$ActivityStream.Post(activity: @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.

attachment : ( string | @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. | ( string | @type : ...
The type of attachment. Defaults to "file".

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

id : ...
The file ID of the attachment. ) )
Optional activity attachments. The server consumes the singular

content : string
Human-readable activity content shown to the target audience.

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 : ( string | @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 | ( string | @type : ...
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 : ...
Specifies whether a push notification should be sent to the target audience. Defaults to

targetId : ...
The ID of the target identity, used when ) )
Target descriptors or identity IDs; built-in audience names such as ):string

Parameters

@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.

attachment : ( string | @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. | ( string | @type : ...
The type of attachment. Defaults to "file".

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

id : ...
The file ID of the attachment. ) )
Optional activity attachments. The server consumes the singular

content : string
Human-readable activity content shown to the target audience.

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 : ( string | @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 | ( string | @type : ...
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 : ...
Specifies whether a push notification should be sent to the target audience. Defaults to

targetId : ...
The ID of the target identity, used when ) )
Target descriptors or identity IDs; built-in audience names such as activity
    The activity entry to post.

Returns

The ID of the newly created activity entry.

Remarks

objectId must be a GUID and objectType is required. When objectType is workitem or case, the proxy resolves the stream channel from that runtime object rather than trusting caller-provided channel fields. @type defaults to share, publishedAt defaults to the current server time, and caller-provided rootId, parentId, and channelId fields are discarded.

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.Id ]
});

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

1
2
3
4
5
6
7
8
9
$ActivityStream.Post({
    objectId : $Xml.Evaluate('Id'),
    objectType : 'customer',
    content: 'Customer is updated.',
    targets: [
        { targetId: $Membership.Administrator.Id },
        { targetId: $Membership.FindIdentity('Accounting').Id, 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.Id } ],
    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.'
});

See Also