You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/developer/common-data-service/create-auto-number-attributes.md
+26-26Lines changed: 26 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
-
title: "Create auto-number attributes (Microsoft Dataverse) | Microsoft Docs"# Intent and product brand in a unique string of 43-59 chars including spaces
3
-
description: "Learn about creating auto-number attribute in the same way you create a string attribute using the StringAttributeMetadata class except that you use the new AutoNumberFormat property. Use the AutoNumberFormat property to define a pattern that includes sequential numbers and random strings by composing placeholders, which indicates the length and type of values that are generated."
4
-
keywords: "Auto-number attributes"# 115-145 characters including spaces. This abstract displays in the search result.
2
+
title: "Create autonumber attributes (Microsoft Dataverse) | Microsoft Docs"# Intent and product brand in a unique string of 43-59 chars including spaces
3
+
description: "Learn about creating autonumber attribute in the same way you create a string attribute using the StringAttributeMetadata class except that you use the new AutoNumberFormat property. Use the AutoNumberFormat property to define a pattern that includes sequential numbers and random strings by composing placeholders, which indicates the length and type of values that are generated."
4
+
keywords: "Autonumber attributes"# 115-145 characters including spaces. This abstract displays in the search result.
With Microsoft Dataverse, you can add an auto-number attribute for any entity. Currently, you can add the attribute programmatically. There is no user interface to add this type of attribute. The topic explains how you can programmatically create an auto-number attribute and set a seed value for sequential elements. In addition, the topic shows how to set the sequence number for the next record if you need to reset the seed at any time later.
23
+
With Microsoft Dataverse, you can add an autonumber attribute for any entity. Currently, you can add the attribute programmatically. The topic explains how you can programmatically create an autonumber attribute and set a seed value for sequential elements. In addition, the topic shows how to set the sequence number for the next record if you need to reset the seed at any time later.
24
24
> [!NOTE]
25
25
>The setting of the seed is optional. There is no need to call the seed if you don’t need to reseed.
26
26
27
27
28
-
You can create an auto-number attribute in the same way you create a string attribute using the **StringAttributeMetadata** class except that you use the new **AutoNumberFormat** property. Use the **AutoNumberFormat** property to define a pattern that includes sequential numbers and random strings by composing placeholders, which indicates the length and type of values that are generated. The random strings help you to avoid duplicates or collisions, especially when offline clients trying to create auto-numbers.
28
+
You can create an autonumber attribute in the same way you create a string attribute using the **StringAttributeMetadata** class except that you use the new **AutoNumberFormat** property. Use the **AutoNumberFormat** property to define a pattern that includes sequential numbers and random strings by composing placeholders, which indicates the length and type of values that are generated. The random strings help you to avoid duplicates or collisions, especially when offline clients trying to create autonumbers.
29
29
30
-
When creating an auto-number attribute, the **StringAttributeMetadata.FormatName** property or the **StringAttributeMetadata.Format** property values must be Text. Since these are the default values you will typically not set this property. You cannot create an auto-number attribute that uses any other special kind of format such as Email, Phone, TextArea, Url or any other [existing formats](https://msdn.microsoft.com/library/microsoft.xrm.sdk.metadata.stringformatname.aspx).
30
+
When creating an autonumber attribute, the **StringAttributeMetadata.FormatName** property or the **StringAttributeMetadata.Format** property values must be Text. Since these are the default values you will typically not set this property. You cannot create an autonumber attribute that uses any other special kind of format such as Email, Phone, TextArea, Url or any other [existing formats](https://msdn.microsoft.com/library/microsoft.xrm.sdk.metadata.stringformatname.aspx).
31
31
32
32
The sequential segment is generated by SQL and hence uniqueness is guaranteed by SQL.
33
33
34
34
> [!NOTE]
35
-
>You can modify an existing format text attribute to be an auto-number format.
35
+
>You can modify an existing format text attribute to be an autonumber format.
36
36
37
-
In the legacy web client, when adding a control on a form bound to an auto-number attribute, the control is disabled automatically and behaves as read-only in the form where end-users cannot edit the control. In the Unified Interface, controls bound to an auto-number attribute need to explicitly be set as disabled. If you do not set the initial attribute value on the form, the value is set only after you save the entity. Auto-numbering can be applied to attribute field values in views, grids and so on.
37
+
In the legacy web client, when adding a control on a form bound to an autonumber attribute, the control is disabled automatically and behaves as read-only in the form where end-users cannot edit the control. In the Unified Interface, controls bound to an autonumber attribute need to explicitly be set as disabled. If you do not set the initial attribute value on the form, the value is set only after you save the entity. Autonumbering can be applied to attribute field values in views, grids and so on.
38
38
39
39
### Examples
40
-
The following examples show how to create a new auto-number attribute named **new\_SerialNumber** for a custom entity named **new\_Widget** which will have a value that looks like this: **WID-00001-AB7LSFG-20170913070240**.
40
+
The following examples show how to create a new autonumber attribute named **new\_SerialNumber** for a custom entity named **new\_Widget** which will have a value that looks like this: **WID-00001-AB7LSFG-20170913070240**.
41
41
Using the Organization service with SDK assemblies **CreateAttributeRequest** and **StringAttributeMetadata** classes:
42
42
43
43
```csharp
@@ -155,28 +155,28 @@ The table shows the string length value for the random and sequential placeholde
155
155
<tr>
156
156
<td><code>{RANDSTRING:MIN_LENGTH}</code></td>
157
157
<td>The value of <b>MIN_LENGTH</b> is between 1 and 6.</td>
158
-
<td>When you save the entity, the auto-number attribute generates the random string with the defined length if the value is between 1 and 6. If you use the <b>MIN_LENGTH</b> value as 7 or beyond 7, you get to see an Invalid Argument error.</td>
158
+
<td>When you save the entity, the autonumber attribute generates the random string with the defined length if the value is between 1 and 6. If you use the <b>MIN_LENGTH</b> value as 7 or beyond 7, you get to see an Invalid Argument error.</td>
159
159
</tr>
160
160
<tr>
161
161
<td><code>{SEQNUM:MIN_LENGTH}</code></td>
162
162
<td>The minimum value of the <b>MIN_LENGTH</b> is 1. The number continues to increment beyond the minimum length.</td>
163
-
<td>When you save the entity, the auto-number attribute works fine and continue to work fine for larger values of <b>MIN_LENGTH</b>.</td></table>
163
+
<td>When you save the entity, the autonumber attribute works fine and continue to work fine for larger values of <b>MIN_LENGTH</b>.</td></table>
164
164
165
-
For sequential value placeholders, the **MIN_LENGTH** is a minimum length. If you set the value to be 2, the initial value will be 01, and the 100th entity value will be 100. The number will continue to increment beyond the minimum length. The value in setting the length for sequential values is to establish a consistent length for the auto-generated value by adding additional 0s to the initial value. It will not limit the absolute value. Random value placeholders will always be the same length.
165
+
For sequential value placeholders, the **MIN_LENGTH** is a minimum length. If you set the value to be 2, the initial value will be 01, and the 100th entity value will be 100. The number will continue to increment beyond the minimum length. The value in setting the length for sequential values is to establish a consistent length for the autogenerated value by adding additional 0s to the initial value. It will not limit the absolute value. Random value placeholders will always be the same length.
166
166
167
167
Because the sequential values can get larger than the minimum length allotted for them, you should not adjust the **StringAttributeMetadata.MaxLength** property to match the length of your formatted value. There is little value in doing this and it could cause an error in the future if the value exceeds the **MaxLength** value. Make sure you leave enough room for a realistic range of sequential values.
168
168
169
169
> [!NOTE]
170
170
> There is no validation of the placeholder values when you create the attribute. The error appears only when you try to save an entity instance that uses an incorrectly configured **AutoNumberFormat** value.
171
-
> For example, if you specify the length of the random string more than 6, the first person creating a new entity instance gets an **Invalid Argument** error when they first try to save the entity containing the new auto-number attribute.
171
+
> For example, if you specify the length of the random string more than 6, the first person creating a new entity instance gets an **Invalid Argument** error when they first try to save the entity containing the new autonumber attribute.
172
172
173
-
## Update auto-number attributes
173
+
## Update autonumber attributes
174
174
175
-
If you create an auto-number attribute with an incorrect configuration or you want to modify an existing auto-number attribute, you can update the attribute the **AutoNumberFormat** value.
175
+
If you create an autonumber attribute with an incorrect configuration or you want to modify an existing autonumber attribute, you can update the attribute the **AutoNumberFormat** value.
176
176
177
-
The following code snippet explains you to retrieve, modify, and update the auto-number attribute.
177
+
The following code snippet explains you to retrieve, modify, and update the autonumber attribute.
178
178
179
-
To modify an existing auto-number attribute, you must retrieve the attribute using the **RetrieveAttributeRequest** class.
179
+
To modify an existing autonumber attribute, you must retrieve the attribute using the **RetrieveAttributeRequest** class.
180
180
181
181
```csharp
182
182
// Create the retrieve request
@@ -190,14 +190,14 @@ RetrieveAttributeRequest attributeRequest = new RetrieveAttributeRequest
retrievedAttributeMetadata.AutoNumberFormat="CAR-{RANDSTRING:5}{SEQNUM:6}"; //Modify the existing attribute by writing the format as per your requirement
By default, all auto-number sequential values start with 1000 and use 0 as the prefix depending on the length. In this way, the length of the value is always same. If you want to change the initial value, you need to change the initial seed value using the API below to set the next number that are used for the sequential segment.
212
+
By default, all autonumber sequential values start with 1000 and use 0 as the prefix depending on the length. In this way, the length of the value is always same. If you want to change the initial value, you need to change the initial seed value using the API below to set the next number that are used for the sequential segment.
213
213
214
214
For example, when the length of the sequential number is 5, you may want to start with an initial value of 10000 instead of the default value of 00001.
215
-
If you want to choose a different starting value after creating the auto-numbering attribute, use the **SetAutoNumberSeed** message. Use the **SetAutoNumberSeedRequest** class when using the SDK assemblies and **SetAutoNumberSeed** action when using the Web API.
215
+
If you want to choose a different starting value after creating the autonumbering attribute, use the **SetAutoNumberSeed** message. Use the **SetAutoNumberSeedRequest** class when using the SDK assemblies and **SetAutoNumberSeed** action when using the Web API.
216
216
217
217
The **AutoNumberSeed** message has the following parameters:
218
218
@@ -221,13 +221,13 @@ The **AutoNumberSeed** message has the following parameters:
221
221
|:----------|:----------|:----------|
222
222
|EntityName|string|The logical name of the entity that contains the attribute you want to set the seed on.|
223
223
|AttributeName|string|The logical name of the attribute you want to set the seed on.|
224
-
|Value|int|Next auto-number value for the attribute.|
224
+
|Value|int|Next autonumber value for the attribute.|
225
225
226
226
> [!NOTE]
227
227
> Setting the seed only changes the **current number value** for the specified attribute in the current environment. It does not imply a common **start value** for the attribute. The seed value is not included in a solution when installed in a different environments. To set the starting number after a solution import, use **SetAutoNumberSeed** message in the target environment.
228
228
229
229
### Examples
230
-
The following samples set the seed to 10000 for an auto-number attribute named **new\_SerialNumber** for a custom entity named **new\_Widget**.
230
+
The following samples set the seed to 10000 for an autonumber attribute named **new\_SerialNumber** for a custom entity named **new\_Widget**.
231
231
232
232
Using the Organization service with SDK assemblies **SetAutoNumberSeedRequest** class:
233
233
```csharp
@@ -268,7 +268,7 @@ OData-Version: 4.0
268
268
269
269
### Auto Number Manager
270
270
271
-
**[Auto Number Manager](https://www.xrmtoolbox.com/plugins/Rappen.XrmToolBox.AutoNumManager/)** for XrmToolBox is a community driven tool for Dataverse that provides a UI to set, update and remove auto number format on new or existing attributes.
271
+
**[Auto Number Manager](https://www.xrmtoolbox.com/plugins/Rappen.XrmToolBox.AutoNumManager/)** for XrmToolBox is a community driven tool for Dataverse that provides a UI to set, update and remove autonumber format on new or existing attributes.
272
272
Please see the [Developer tools](developer-tools.md) topic for community developed tools and [anm.xrmtoolbox.com](https://anm.xrmtoolbox.com) for more information about Auto Number Manager.
@@ -44,13 +39,12 @@ Each entity has a unique name defined when it is created. This name is presented
44
39
|`LogicalName`|All lower-case version of the schema name. i.e. account|
45
40
|`LogicalCollectionName`|All lower-case version of the collection schema name. i.e. accounts|
46
41
|`EntitySetName`|Used to identify collections with the Web API. By default, it is the same as the logical collection name.<br />It is possible to change the Entity Set name by programmatically updating the metadata. But this should only be done before any Web API code is written for the entity. More information: [Web API types and operations > Change the name of an entity set](/dynamics365/customer-engagement/developer/webapi/web-api-types-operations#change-the-name-of-an-entity-set)|
47
-
48
-
>[!NOTE]
42
+
>[!NOTE]
43
+
>`EntitySetName` is automatically generated by changing the `EntityName` to the plural of that name. Example: EntityName: Car EntitySetName: Cars. When manually creating a new entity the `EntitySetName` can be changed. System created `EntitySetName`(s) will always be the plural of the `EntityName` and these cannot be changed through the client interface or APIs. This includes system entities as well as entitles created for many to many relationship intersects.<p/>
49
44
> When you create a custom entity, the name you choose will be prepended with the customization prefix value of the solution publisher associated with the solution that the entity was created within. Other than the entity set name, you cannot change the names of an entity after it is created. If you want consistent names for metadata items in your solution, you should create them in the context of a solution you create associated with a solution publisher that contains the customization prefix you want to use. More information : [Solution publisher](/power-platform/alm/solution-concepts-alm#solution-publisher)
50
45
51
46
Each entity also has three properties that can display localized values:
52
47
53
-
54
48
|Name |Description |
55
49
|---------|---------|
56
50
|`DisplayName`|Typically, the same as the schema name, but can include spaces. i.e. Account|
Copy file name to clipboardExpand all lines: powerapps-docs/developer/common-data-service/org-service/entity-operations-query-data.md
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: "Query data using the Organization service (Microsoft Dataverse) | Microsoft Docs"# Intent and product brand in a unique string of 43-59 chars including spaces
3
3
description: "Introduces the different ways to query data using Microsoft Dataverse SDK assemblies."# 115-145 characters including spaces. This abstract displays in the search result.
4
4
ms.custom: ""
5
-
ms.date: 10/31/2018
5
+
ms.date: 12/10/2020
6
6
ms.reviewer: "pehecke"
7
7
ms.service: powerapps
8
8
ms.topic: "article"
@@ -41,6 +41,8 @@ Both of these methods will return an <xref:Microsoft.Xrm.Sdk.EntityCollection> t
41
41
42
42
> [!NOTE]
43
43
> To ensure best performance, each query request can return a maximum of 5000 entity records. To return larger result sets you must request additional pages.
44
+
>
45
+
> All filter conditions for string values are case insensitive.
This sample shows how to validate a change of state of an entity and set a state of an entity. You can download the sample from [here](https://github.com/microsoft/PowerApps-Samples/tree/master/cds/orgsvc/C%23/ValidateandExecuteSavedQuery).
23
+
This sample shows how to validate a change of state of an entity and set a state of an entity. You can download the sample from [here](https://github.com/microsoft/PowerApps-Samples/tree/master/cds/orgsvc/C%23/ValidateAndSetRecordState).
0 commit comments