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/model-driven-apps/clientapi/reference/Xrm-WebApi/createRecord.md
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: "createRecord (Client API reference) in model-driven apps| MicrosoftDocs"
3
3
description: Includes description and supported parameters for the createRecord method.
4
4
author: lancedMicrosoft
5
5
ms.author: lanced
6
-
ms.date: 08/22/2022
6
+
ms.date: 04/29/2024
7
7
ms.reviewer: jdaly
8
8
ms.topic: reference
9
9
applies_to: "Dynamics 365 (online)"
@@ -28,7 +28,7 @@ contributors:
28
28
|`entityLogicalName`|String|Yes|Logical name of the table you want to create. For example: `account`.|
29
29
|`data`|Object|Yes|A JSON object defining the columns and values for the new table record. See [Examples](#examples)|
30
30
|`successCallback`|Function|No|A function to call when a record is created. See [Return Value](#return-value)|
31
-
|`errorCallback`|Function|No|A function to call when the operation fails. An object with the following properties will be passed:<br /> - `errorCode`: Number. The error code.<br /> - `message`: String. An error message describing the issue.|
31
+
|`errorCallback`|Function|No|A function to call when the operation fails. An object with the following properties is passed:<br /> - `errorCode`: Number. The error code.<br /> - `message`: String. An error message describing the issue.|
> Creating records with a primary image is not supported for offline mode. Primary images can only be set with create in online mode. Other image columns cannot be set with create. [Learn more about Primary images](../../../../data-platform/image-column-data.md#primary-images)
79
+
77
80
### Create related table records along with the primary record
78
81
79
-
You can create tables related to each other by defining them as navigation properties values. This is known as *deep insert*. In this example, we will create a sample account record along with the primary contact record and an associated opportunity record.
82
+
You can create tables related to each other by defining them as navigation properties values. This pattern is known as *deep insert*. In this example, we create a sample account record along with the primary contact record and an associated opportunity record.
80
83
81
84
> [!NOTE]
82
85
> Creating related table records in a single create operation is not supported for offline mode.
@@ -123,7 +126,7 @@ To associate new table records to existing table records, set the value of singl
123
126
> [!NOTE]
124
127
> The names of single-valued navigation properties are not always the same as the `LogicalName` for the lookup attribute. You should make sure you are using the `Name` attribute value of the `NavigationProperty` element in the Web API $metadata service document. More information: [Web API Navigation Properties](../../../../data-platform/webapi/web-api-navigation-properties.md)
125
128
126
-
Here is code example:
129
+
Here's code example:
127
130
128
131
The following example creates an account record, and associates it to an existing contact record to set the latter as the primary contact for the new account record:
> Instead of using `@odata.bind` annotation example above, the deprecated **lookup** object with case-sensitive properties (`logicalname` and `id`) is still supported for existing customizations. However, it is recommended to use `@odata.bind` annotation for both online and offline scenario instead of using this deprecated object.
156
+
> Instead of using `@odata.bind` annotation example shown previously, the deprecated **lookup** object with case-sensitive properties (`logicalname` and `id`) is still supported for existing customizations. However, it is recommended to use `@odata.bind` annotation for both online and offline scenario instead of using this deprecated object.
154
157
155
158
The following example uses the deprecated method to create an account record, and associate it to an existing contact record to set the latter as the primary contact for the new account record from mobile clients when working in the offline mode:
title: "Image web resources (model-driven apps) | Microsoft Docs"# Intent and product brand in a unique string of 43-59 chars including spaces
3
-
description: "Learn about using image web resources to make images available for use"# 115-145 characters including spaces. This abstract displays in the search result.
4
-
author: sriharibs-msft
5
-
ms.author: srihas
6
-
ms.date: 04/01/2022
2
+
title: "Image web resources (model-driven apps)"
3
+
description: "Learn about using image web resources to make images available for use."
4
+
author: chmoncay
5
+
ms.author: chmoncay
6
+
ms.date: 04/26/2024
7
7
ms.reviewer: jdaly
8
-
ms.topic: "article"
8
+
ms.topic: article
9
9
ms.subservice: mda-developer
10
10
search.audienceType:
11
11
- developer
@@ -17,43 +17,69 @@ contributors:
17
17
18
18
Use image web resources to make images available for use in model-driven apps.
19
19
20
-
There are 5 types of image web resources:
21
-
* PNG Format
22
-
* JPG Format
23
-
* GIF Format
24
-
* ICO Format
25
-
* Vector Format (SVG)
20
+
There are five types of image web resources:
21
+
22
+
- PNG Format
23
+
- JPG Format
24
+
- GIF Format
25
+
- ICO (Windows icon format) Format
26
+
- SVG (Scalable Vector Graphics) format
26
27
27
28
> [!NOTE]
28
29
> Vector Format (SVG) web resources were added with the model-driven apps.
29
30
30
-
31
-
<aname="BKMK_Capabilities"></a>
32
31
33
-
## Capabilities of image web resources
34
-
With image web resources you can add images where you need them. Common uses include the following:
32
+
## Capabilities of image web resources
33
+
34
+
With image web resources, you can add images where you need them. Common uses include:
35
35
36
-
- Custom table icons
37
-
- Icons for custom ribbon controls and `SiteMap` subareas
38
-
- Decorative graphics for forms and webpage web resources.
39
-
- Background images that are used by CSS web resources.
36
+
- Custom table icons.
37
+
- Icons for custom ribbon controls and `SiteMap` subareas.
38
+
- Decorative graphics for forms and webpage web resources.
39
+
- Background images that are used by CSS web resources.
Use Vector Format (SVG) web resources for any icon presented in the application. Vector images are defined as Scalable Vector Graphics (SVG) an XML-based vector image format. The advantage of SVG over other image web resources is scale, smaller in size, and if the fill color is removed the model-driven app can control the icon color to avoid contrast issues. When defining the SVG or before uploading it into the web resource please remove any "fill color" attributes. We recommend using SVG over other image types like PNG and JPG. You can define one vector image and re-use it rather than provide multiple sizes of images. You will use these in with a new <xref:Microsoft.Xrm.Sdk.Metadata.EntityMetadata>.<xref:Microsoft.Xrm.Sdk.Metadata.EntityMetadata.IconVectorName> property to define the icon for a custom table instead of the `IconLargeName`, `IconMediumName`, or `IconSmallName` properties.
43
+
## Working with Scalable Vector Graphics (SVG)
44
+
45
+
Use Vector Format (SVG) web resources for any icon presented in the application. Vector images are defined as Scalable Vector Graphics (SVG), an XML-based vector image format. We recommend using SVG over other image types like PNG and JPG because they have better accessibility, smaller in file size, and can scale with their container.
46
+
47
+
### Better accessibility
48
+
49
+
Model-driven apps can control the icon color to avoid contrast issues when SVG's don't contain hex values for colors. Using the [currentColor](https://developer.mozilla.org/docs/Web/CSS/color_value#currentcolor_keyword) can help ensure that the correct theme colors are used.
SVG files are typically smaller than raster type images, such as jpg or png.
58
+
59
+
### Scale with their container
60
+
61
+
You can reuse a single SVG rather than provide multiple sizes of images. Use SVG web resources in the [EntityMetadata.IconVectorName](xref:Microsoft.Xrm.Sdk.Metadata.EntityMetadata.IconVectorName) property to define the icon for a custom table instead of the `IconLargeName`, `IconMediumName`, or `IconSmallName` properties.
62
+
63
+
### Best practices
64
+
65
+
Ensure that a default size is set through the [svg](https://developer.mozilla.org/docs/Web/SVG/Element/svg) element [width](https://developer.mozilla.org/docs/Web/SVG/Attribute/width), [height](https://developer.mozilla.org/docs/Web/SVG/Attribute/height), and [viewBox](https://developer.mozilla.org/docs/Web/SVG/Attribute/viewBox) attributes.
66
+
67
+
Where possible, remove any hard coded fill colors and don't use embedded style sheets and classes within the SVG. Embedded stylesheets could leak styles if other SVG files are referencing that same class. Use the style attribute to assign values instead. For example:
> Vector Format (SVG) web resources are treated like the [Script (JScript)](./script-jscript-web-resources.md) web resources, and carry the same security risks as JavaScript web resources because SVG files allow JScript embedding.
47
-
48
-
<aname="BKMK_Limitations"></a>
49
75
50
-
## Limitations of image web resources
51
-
Like all web resources, image web resources use the security context. Only licensed users who have the necessary privileges can access them.
## Reference an image web resource from a webpage web resource
56
-
All web resources can use relative URLs to reference each other. In the following example, for the webpage (HTML) web resource new_/content/contentpage.htm to reference the image web resource new_/Images/image1.png, add the following HTML code to new_/content/contentpage.htm:
76
+
## Limitations of image web resources
77
+
78
+
Image web resources use the security context like all web resources. Only licensed users who have the necessary privileges can access them.
79
+
80
+
## Reference an image web resource from a webpage web resource
81
+
82
+
All web resources can use relative URLs to reference each other. In the following example, for the webpage (HTML) web resource new_/content/contentpage.htm to reference the image web resource new_/Images/image1.png, add the following HTML code to new_/content/contentpage.htm:
57
83
58
84
```html
59
85
<imgsrc="../Images/image1.png" />
@@ -62,45 +88,32 @@ Like all web resources, image web resources use the security context. Only licen
62
88
63
89
## Reference an image web resource from a form
64
90
65
-
#### Add an image to a form
66
-
67
-
1. Navigate to the form editor for a table.
68
-
69
-
2. Select where you want to add the image in the form.
70
-
71
-
3. On the **Insert tab**, select **Web Resource**.
72
-
73
-
4. On the **General** tab, select the web resource image that you want to add.
74
-
75
-
5. Specify a name for the web resource. You can also specify a label and alternative text.
91
+
### Add an image to a form
76
92
77
-
6. On the **Formatting** tab, you can define:
93
+
1. Navigate to the form editor for a table.
94
+
1. Select where you want to add the image in the form.
95
+
1. On the **Insert tab**, select **Web Resource**.
96
+
1. On the **General** tab, select the web resource image that you want to add.
97
+
1. Specify a name for the web resource. You can also specify a label and alternative text.
98
+
1. On the **Formatting** tab, you can define:
78
99
79
-
- The number of columns the images should use.
80
-
81
-
- The number of rows the images should use, or if it should automatically expand to use available space.
82
-
83
-
- The size of the image using the following options:
100
+
- The number of columns the images should use.
101
+
- The number of rows the images should use, or if it should automatically expand to use available space.
102
+
- The size of the image using the following options:
84
103
85
104
-**Stretch to fit**
86
-
87
-
-**Stretch to fit (maintain aspect ratio)**
88
-
105
+
-**Stretch to fit (maintain aspect ratio)**
89
106
-**Original**
90
-
91
107
-**Specific**
92
108
93
-
- If you select "Specific," you can enter the desired height and width in pixels.
94
-
95
-
7. Select **OK**.
109
+
- If you select "Specific," you can enter the desired height and width in pixels.
96
110
97
-
8. You must save your changes and publish the form before users can see the image in the form.
1. You must save your changes and publish the form before users can see the image in the form.
100
113
101
114
## Reference an image web resource from a ribbon element or from the Site Map subarea
102
115
103
-
Use the `$webresource:` directive to specify a web resource image to use as an icon in the ribbon or in the application navigation using Site Map. The following sample shows how to specify icons for a button in the ribbon.
116
+
Use the `$webresource:` directive to specify a web resource image to use as an icon in the ribbon or in the application navigation using Site Map. The following sample shows how to specify icons for a button in the ribbon.
@@ -109,13 +122,14 @@ Use the `$webresource:` directive to specify a web resource image to use as an i
109
122
> [!NOTE]
110
123
> Using the `$webresource:` directive adds a solution dependency that prevents the referenced image web resources from being deleted as long as they are used by another solution component.
111
124
112
-
### See also
113
-
[Web resources](web-resources.md)
114
-
[Using Web Page (HTML) web resources](webpage-html-web-resources.md)
115
-
[Using Style Sheet (CSS) web resources](css-web-resources.md)
116
-
[Using JavaScript web resources](script-jscript-web-resources.md)
117
-
[Using Data (XML) web resources](data-xml-web-resources.md)
118
-
[Using Stylesheet (XSL) web resources](stylesheet-xsl-web-resources.md)
125
+
### See also
126
+
127
+
[Web resources](web-resources.md)
128
+
[Using Web Page (HTML) web resources](webpage-html-web-resources.md)
129
+
[Using Style Sheet (CSS) web resources](css-web-resources.md)
130
+
[Using JavaScript web resources](script-jscript-web-resources.md)
131
+
[Using Data (XML) web resources](data-xml-web-resources.md)
132
+
[Using Stylesheet (XSL) web resources](stylesheet-xsl-web-resources.md)
0 commit comments