Skip to content

MobileCRM.Services.ChatService.subscribeToEntityChannel

rescocrm edited this page May 15, 2023 · 8 revisions

Subscribes current user to a channel specified by related entity.

Use reference to resco_chattopic entity to specify a shared channel.

Arguments

Argument Type Description
regardingEntity MobileCRM.Reference Reference to an entity that has to be subscribed/unsubscribed.
subscribe Boolean Determines whether to subscribe or unsubscribe entity channel.
callback Function The callback function which is called asynchronously in case of success.
errorCallback function(errorMsg) The errorCallback which is called in case of error.
scope Object The scope for callbacks.

This example demonstrates how subscribe current chat user to an entity channel.

function joinChannel(entityRef) {
	/// <param name="entityRef" type="MobileCRM.Reference">
	/// Reference to an entity whose channel we want to join.
	/// </param>
	MobileCRM.Services.ChatService.getService(function (service) {
		service.subscribeToEntityChannel(entityRef, true, function () {
			MobileCRM.UI.MessageBox.sayText("You've joined the channel " + entityRef.primaryName);
		}, MobileCRM.bridge.alert);
	}, MobileCRM.bridge.alert);
}
Clone this wiki locally