CRM2013系統預設的許多實體都已經有了影象的選擇,如 右上角可以設定當前使用者的頭像。

客戶、聯絡人等都可以,下面將介紹一下此項新功能:

一、實體中新建影象欄位,其中系統自動命名entityinage,因此每個實體最多隻能有一個影象欄位。(此處感覺是由於這個欄位設計功能不全,目前只做頭像的作用,因此只有一個,如果你想顯示附件中的圖片,此欄位是無法實現的)

二、設定顯示

新建後,需開啟窗體屬性,在“顯示”選項卡中,選中“在窗體中顯示影象”。然後儲存釋出就可以在記錄中看到影象欄位。

關於圖片欄位具體資訊,請參考下面的SDK資料:

Entity images

Certain system entities have image attributes. You can add image attributes to custom entities. When an entity has an image attribute, you can set the PrimaryImageAttribute property to control whether the image will be shown in the application. When the image is shown in the application users of the web application can upload pictures for the entity record. The following system entities have image attributes. Those marked with an asterisk are enabled by default to show them in the application.

Account *

KbArticle

Campaign

Incident

Competitor *

Connection

Contact *

Contract

TransactionCurrency

EmailServerProfile

Goal

Invoice

Lead *

Mailbox

OpportunityProduct

SalesOrder

Organization

Product *

Publisher *

Queue

Resource *

SalesLiterature

Territory

SystemUser *

The SchemaName of the entity image attribute is always EntityImage. When an image attribute is added to an entity some additional attributes are created to support it as shown in the following table.

Schema Name Attribute Type Name Description

EntityImage_Timestamp

BigIntType

The value represents when the image was last updated and is used to help make sure that the latest version of the image is downloaded and cached on the client.

EntityImage_URL

StringType

An absolute URL to display the entity image in a client.

The URL is composed this way:

  Copy Code
{0}/image/download.aspx?entity={1}&attribute={2}&id={3}&timestamp={4}
  • 0 : The organization URL
  • 1 : The entity logical name
  • 2 : The attribute logical name
  • 3 : The EntityImageId value.
  • 4 : The EntityImage_Timestamp value

For example:
https://myorg.crm.dynamics.com/image/download.aspx?attribute=entityimage&entity=contact&id={ECB6D3DF-4A04-E311-AFE0-00155D9C3020}&timestamp=635120312218444444

EntityImageId

UniqueIdentifierType

The unique identifier of the image

Note
Clients that do not use the current .NET assemblies need to include SdkClientVersion with a value of ‘6.0.0.0’ or higher in order to receive ImageAttributeMetadata attributes. More information: SdkClientVersion.

When you use RetrieveMultiple or Retrieve the EntityImage is not included when the ColumnSet.AllColumns property is set to true. Because of the potential size of data in this attribute, to return this attribute you must explicitly request it.

To update images set the value of the EntityImage to a byte[] that contains the content of the file. All images are displayed in a 144x144 pixel square. Images will be cropped and resized to reduce the size of the data before being saved.

  • Images with at least one side larger than 144 pixels are cropped on center to 144x144.
  • Images with both sides smaller than 144 are cropped square to their smallest side.