Overview
Posts a new activity entry on a object. Object properties are defined in ActivityEntry.string $ActivityStream.Post(activity: ActivityEntry)
Arguments
Returns
Id of the activity entry.Example
Creating a basic activity for everyone.
$ActivityStream.Post({ objectId : $Xml.Evaluate('Id') objectType : 'customer', content: 'Customer ' + $Xml.Evaluate('Name') + ' is updated.' });
Example
Creating a activity to display only to administrators.
$ActivityStream.Post({ objectId : $Xml.Evaluate('Id') objectType : 'customer', content: 'Customer is updated.', targets: [ $Membership.Administrator ] });
Example
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 } ] });
Example
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') ] });
Example
Create a new activity on a case
$ActivityStream.Post({ objectId : $Xml.Evaluate('CaseId') objectType : 'case', content: 'Customer is updated.' });
Types
ActivityEntry
Activity entry{
// Specifies the type of activity.
@type : string
// Specifies the actor of activity.
actor : ( string | Identity )
// Array of activity attachments.
attachments : Array<( string | ActivityEntryAttachment )>
// Specifies the id of object that activity is related to. Required.
objectId : string
// Specifies the type of object that activity is related to. Required.
objectType : string
// Specifies the date time of activity. Default value is current date time.
publishedAt : DateTimeOffset
}
ActivityEntryAttachment
Attachment of an activity{
// Type of the attachment. Default value is "file".
@type : ( "file" | "link" | "video" )
// File id of the attachment
id : string
}