Skip to content

Commit 870a692

Browse files
authored
Merge pull request #161 from AlexaCRM/kb-users
Add user related articles to the KB
2 parents 7f10fad + e45305a commit 870a692

File tree

7 files changed

+64
-5
lines changed

7 files changed

+64
-5
lines changed

datapress/knowledge_base/devInfo/users/bind_user_via_api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: How to bind a user using WP API
3-
sidebar_position: 6
3+
sidebar_position: 30
44
slug: /knowledge-base/bind-user-via-api
55
tags:
66
- Knowledge base
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: Accessing bound user contact details
3+
sidebar_position: 25
4+
slug: /knowledge-base/bound-user-details
5+
tags:
6+
- Knowledge base
7+
- DataPress
8+
- Retrieve
9+
- User Binding
10+
---
11+
12+
If you need to access information about the currently logged-in user in PHP. It can be easily done by using **UserService** class that has methods to return the current user information including the linked CRM record (if available).
13+
14+
Once the bound contact is retrieved, **WebApiClient** class can be used to access additional information. Connection required for the toolkit to work properly is provided by the **ConnectionService** class.
15+
16+
```php
17+
use AlexaCRM\Nextgen\ConnectionService;
18+
use AlexaCRM\Nextgen\UserService;
19+
use AlexaCRM\Xrm\ColumnSet;
20+
use AlexaCRM\Xrm\EntityReference;
21+
22+
$userService = UserService::instance();
23+
24+
if ($userService->isBound()){
25+
$contact = $userService->getBoundRecord();
26+
27+
/** @var EntityReference $accountRef */
28+
$accountRef = $contact['parentcustomerid'];
29+
$account = ConnectionService::instance()->getClient()->Retrieve('account', $accountRef->Id, new ColumnSet(['accountnumber']));
30+
$accountNum = $account['accountnumber'];
31+
}
32+
```

datapress/knowledge_base/devInfo/users/bound_users.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: How to display a list of bound users in WordPress
3-
sidebar_position: 5
3+
sidebar_position: 20
44
slug: /knowledge-base/bound-users
55
tags:
66
- Knowledge base

datapress/knowledge_base/devInfo/users/crm_dev.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Automating User Management in PowerApps with Flows
3-
sidebar_position: 8
3+
sidebar_position: 50
44
slug: /knowledge-base/user-management-in-powerapps
55
tags:
66
- User Management

datapress/knowledge_base/devInfo/users/manage_user.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Manage users
3-
sidebar_position: 4
3+
sidebar_position: 10
44
slug: /knowledge-base/manage-users
55
tags:
66
- Knowledge base
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: Editing user profile
3+
sidebar_position: 27
4+
slug: /knowledge-base/user-editing
5+
tags:
6+
- Knowledge base
7+
- DataPress
8+
- Binding
9+
- User
10+
---
11+
12+
If a page is bound to a contact table then passing contact identifier in the query string will set the `binding` object and allow record editing using, for example, a Gravity form that relies on the record binding.
13+
14+
Allowing user to edit their own Dataverse record is slightly different. We already know the contact id and shouldn’t pass it via the query string.
15+
16+
This can be used, for example, to build a page that uses Gravity Form for user profile editing.
17+
18+
```php
19+
// Let's assume that profile page ID is 42
20+
add_filter( 'integration-cds/binding/bound-record', function( $record, $post ) {
21+
if ( $post->ID !== 42 ) {
22+
return $record;
23+
}
24+
25+
return \AlexaCRM\Nextgen\UserService\UserService::instance()->getBoundRecord();
26+
}, 10, 2 );
27+
```

datapress/knowledge_base/devInfo/users/wp_users_table.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: WordPress Users Table
3-
sidebar_position: 7
3+
sidebar_position: 40
44
slug: /knowledge-base/wp-users-table
55
tags:
66
- Knowledge base

0 commit comments

Comments
 (0)