Skip to content

Conversation

Copy link
Contributor

Copilot AI commented May 20, 2025

Overview

This PR adds a new JavaScript library contactLibrary.js that provides functions for working with Microsoft Dataverse 'contact' table as described in the Power Apps Web API documentation.

Features

The library includes the following functionality:

  • Base HTTP functions with OAuth 2.0 authentication
    • GET, POST, PATCH, and DELETE operations
  • Contact CRUD operations
    • getContact: Retrieve contact by ID with optional field selection
    • createContact: Create new contacts
    • updateContact: Update existing contacts
    • deleteContact: Delete contacts
  • Specialized contact functions
    • setContactFullName: Set fullname to firstname+lastname
    • listActiveContacts: List active contacts with filtering options

Implementation Details

  • All functions use the fetch API for HTTP requests
  • All API calls require an OAuth 2.0 Bearer token for authentication
  • Functions follow a consistent promise-based pattern for async operations
  • Comprehensive JSDoc comments for all functions

Example Usage

// Get a contact
const contact = await getContact('https://yourorg.crm.dynamics.com', 'contact-guid', token);

// Update fullname based on first and last name
await setContactFullName('https://yourorg.crm.dynamics.com', 'contact-guid', 'John', 'Doe', token);

// List active contacts
const activeContacts = await listActiveContacts('https://yourorg.crm.dynamics.com', token);

This library serves as a reusable component for Power Platform applications that need to interact with contact records in Dataverse.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@ljrain ljrain marked this pull request as ready for review May 20, 2025 16:32
@ljrain ljrain merged commit f3512ec into main May 20, 2025
1 check passed
Copilot AI changed the title [WIP] Add contactLibrary.js for Dataverse contact table routines (get, update, create, delete, set fullname) Add contactLibrary.js for Microsoft Dataverse contact table operations May 20, 2025
Copilot AI requested a review from ljrain May 20, 2025 16:49
Copilot finished work on behalf of ljrain May 20, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants