Skip to content

$ActivityStream

Allows to push system generated activities on domain activity stream. It has the following methods.

$ActivityStream.Push

string $ActivityStream.Push ( activity )

Pushes a new activity and returns id number of activity.

Arguments

Object activity Activity object. See remarks

Remarks

This method creates a new activity on domain activity stream. Activity object consists on following properties.

Activity Properties

Actor
Actor of activity that who is caused. If not specified displayed as "System".

Object Id
Id of object that activity occurs on. Required.

Object Type
Type of object. (e.g. customer, product) . Required.

Type
Type of activity. (e.g. create, update, comment) If not specified "share" term is used.

Published At
Date of activity is occurs. If not specified current date is used.

Targets
Array of targets that activity displayed to or exclusively notified.Targets can be specified as generic types or specific identity. If not specified "Everyone" is used.

Content
Descriptive text of activity.

Attachment
Array of attachments like files, links.

Examples

Creating a basic activity for everyone.

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

Creating a activity to display only to administrators.

$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 with exclusively notify the accounting.

$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 file attachment.

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