Skip to content

Post

Posts a new activity entry on a object. Object properties are defined in ActivityEntry.

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

Parameters

ActivityEntry activity

Returns

Id of the 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 a 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 with exclusively notify the accounting.

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

Activity entry

@type : string
Specifies the type of activity.

actor : ( string | Identity )
Specifies the actor of activity.

attachments : Array<( string | ActivityEntryAttachment )>
Array of activity attachments.

objectId : string
Specifies the id of object that activity is related to. Required.

objectType : string
Specifies the type of object that activity is related to. Required.

publishedAt : DateTimeOffset
Specifies the date time of activity. Default value is current date time.

ActivityEntryAttachment

Attachment of an activity

@type : ( "file" | "link" | "video" )
Type of the attachment. Default value is "file".

id : string
File id of the attachment