Skip to content

Commit a798c25

Browse files
committed
Add new section
1 parent 92d65bd commit a798c25

File tree

1 file changed

+45
-1
lines changed
  • powerapps-docs/developer/model-driven-apps/clientapi/reference/Xrm-WebApi

1 file changed

+45
-1
lines changed

powerapps-docs/developer/model-driven-apps/clientapi/reference/Xrm-WebApi/updateRecord.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,51 @@ Xrm.WebApi.offline.updateRecord("account", "5531d753-95af-e711-a94e-000d3a11e605
163163
}
164164
);
165165
```
166-
166+
### Update associations to the related entities of type Activity
167+
168+
To update association to the related entities of type Activity, set the value of single-valued navigation properties using the `@odata.bind` annotation to another record.
169+
170+
**Update Opportunity field on task**
171+
172+
```JavaScript
173+
// define the data to update a record
174+
var data =
175+
{
176+
"[email protected]": "/opportunities(61a0e5b9-88df-e311-b8e5-6c3be5a8b200)"
177+
}
178+
// update the record
179+
Xrm.WebApi.updateRecord("task", "5531d753-95af-e711-a94e-000d3a11e605", data).then(
180+
function success(result) {
181+
console.log("Task updated");
182+
// perform operations on record update
183+
},
184+
function (error) {
185+
console.log(error.message);
186+
// handle error conditions
187+
}
188+
);
189+
```
190+
**Update Regarding field on task**
191+
192+
```JavaScript
193+
// define the data to update a record
194+
var data =
195+
{
196+
"[email protected]": "/accounts(61a0e5b9-88df-e311-b8e5-6c3be5a8b200)"
197+
}
198+
// update the record
199+
Xrm.WebApi.updateRecord("task", "5531d753-95af-e711-a94e-000d3a11e605", data).then(
200+
function success(result) {
201+
console.log("Task updated");
202+
// perform operations on record update
203+
},
204+
function (error) {
205+
console.log(error.message);
206+
// handle error conditions
207+
}
208+
);
209+
```
210+
167211
### Related topics
168212

169213
[Xrm.WebApi](../xrm-webapi.md)

0 commit comments

Comments
 (0)