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

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