Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Unanswered

Integrate with Microsoft Dynamics CRM API using ASP.NET Core

Posted on by 8
hellow all :
 
Iam biggner developer in company and they ask me to build app in asp.net to print purchase order from d365 finOps  so ,
 
1- register app in AAD.
my program by GPT chat help 
// in appsettings.json file {  /DynamicsCRM/: {    /BaseUrl/: https://your-crm-instance.api.crm.dynamics.com/api/data/v9.0//,    /ClientId/: /your-client-id/,    /ClientSecret/: /your-client-secret/,    /TenantId/: /your-tenant-id/  }}// in DynamicsCRMService.cs file using System.Net.Http;using System.Net.Http.Headers;using System.Threading.Tasks;using Microsoft.Extensions.Configuration;using Newtonsoft.Json;public class DynamicsCRMService{    private readonly HttpClient _httpClient;    public DynamicsCRMService(IConfiguration configuration, HttpClient httpClient)    {        _httpClient = httpClient;        var dynamicsCRMConfig = configuration.GetSection(/DynamicsCRM/);        _httpClient.BaseAddress = new System.Uri(dynamicsCRMConfig[/BaseUrl/]);        _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(/application/json/));    }    public async Task<string> GetPurchaseOrders()    {        var response = await _httpClient.GetAsync(/purchaseorders/);        response.EnsureSuccessStatusCode();        return await response.Content.ReadAsStringAsync();    }}//in program file builder.Services.AddHttpClient<DynamicsCRMService>();builder.Services.AddScoped<DynamicsCRMService>();// DynamicsCRMService controller using Microsoft.AspNetCore.Mvc;using System.Threading.Tasks;[ApiController][Route(/[controller]/)]public class PurchaseOrderController : ControllerBase{    private readonly DynamicsCRMService _dynamicsCRMService;    public PurchaseOrderController(DynamicsCRMService dynamicsCRMService)    {        _dynamicsCRMService = dynamicsCRMService;    }    [HttpGet]    public async Task<IActionResult> GetPurchaseOrders()    {        var purchaseOrders = await _dynamicsCRMService.GetPurchaseOrders();        return Ok(purchaseOrders);    }}
there is no error but not any result in https://localhost:5001/purchaseorder
  • Komi Siabi Profile Picture
    Komi Siabi 12,666 Most Valuable Professional on at
    Integrate with Microsoft Dynamics CRM API using ASP.NET Core
    Hi,
     
    You want to be able to print an Invoice report from a PO. 
     
    Is this PO created in D365 FinOps or from CRM?
     
  • Integrate with Microsoft Dynamics CRM API using ASP.NET Core
     
    is there function to print PO as invoice report . they need to print as invoice to contract department .
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,900 Super User 2024 Season 2 on at
    Integrate with Microsoft Dynamics CRM API using ASP.NET Core
    Hi,
     
    I don't know if the coding generated by Chat GPT is reliable. As you are using a CRM API, I can't help you. My experience is mainly with Finance and Operations (both technical is functional). I have some functional knowledge of CRM, but not on the technical programming side. Still I wonder how purchase order details from FinOps would be needed to be retrieved with a CRM API.
  • Integrate with Microsoft Dynamics CRM API using ASP.NET Core
    thanks mr.andre 
    I think it is not available to them in d365 because they use manual way by excel sheet (import data from d365 by OData and make some queries to print purchase order) this way take long time, So they ask me to build app to get data from d365 and print in specific format.
    Now my ask is the program, right? why don’t run with me?
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,900 Super User 2024 Season 2 on at
    Integrate with Microsoft Dynamics CRM API using ASP.NET Core
    Hi Community user,
     
    Your question confuses me. You talk about a CRM API, Dynamics 365 FinOps and some coding generated by GPT.
    In case you would need to print a purchase order from Dynamics 365 Finance and Operations, you can use this application. What is the exact business issue you are asked to solve? Why a separate ASP.NET application and what is the relation with CRM?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,900 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,275 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans