Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add retrieve description #102

Merged
merged 3 commits into from
Dec 27, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions datapress/knowledge_base/devInfo/retrieve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: How to retrieve Dataverse records using Web API twig functions
sidebar_position: 17
slug: /knowledge-base/retrieve-records
tags:
- Knowledge base
- DataPress
- Twig
---

Follow this example to retrieve multiple records:

```php
{% set records =
retrieve_multiple(
entity:'contact',
select:["fullname","ownerid"],
filter: {"contactid":"ae8bca63-706a-ed11-9561-000d3a227751"},
order: {"fullname":"desc"},
expand:"ownerid",
top:2,
includeCount: null,
skip: null,
skipToken:null
) %}

<ul>
{% for record in records %}
<li> <b>Name: </b>{{record["fullname"]}}|{{record["ownerid"].Name}}</li>
{% endfor %}
</ul>
```

Here is an example of how to retrieve a single record:

```php
{% set record1 =
retrieve(
entity:'account',
guid: 'fa7eadd1-f343-ed11-bba2-6045bd8e5463',
select:["accountid","name","ownerid"],
expand:"ownerid"
)
%}

<li><b>ID:</b> {{record1["accountid"]}} <b>Name: </b>{{record1["name"]}} |{{record1["ownerid"].Name}}</li>
```

Loading