web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

cross domain web api call from CRM using JavaScript

(0) ShareShare
ReportReport
Posted on by 94

i want to validate address for that i have made web api call onsave.

wen i call to cross domain api for validate data at that time i am facing below issue.

Access to fetch at 'api.easypost.com/.../addresses' from origin 'toastmastersdevtrng.crm.dynamics.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

working fine in postman.

my code is below.

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Accept", "application/json");
myHeaders.append("authorization", "Basic ---------------------");
myHeaders.append("crossDomain", "true");
myHeaders.append("Access-Control-Allow-Origin", "">devtrng.crm.dynamics.com/");
myHeaders.append("Access-Control-Allow-Credentials", "true");
myHeaders.append("Access-Control-Allow-Methods", "POST");
myHeaders.append("Access-Control-Allow-Headers", "Overwrite, Destination, Content-Type, Depth, User-Agent, Translate, Range, Content-Range, Timeout, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, Location, Lock-Token,DAV, content-length, Allow");
myHeaders.append("Access-Control-Max-Age", "3600");

var raw = JSON.stringify({"street1":"9127 S Jamaica St","street2":"","city":"Englewood","state":"CO","zip":"80112","country":"United States","verify":["delivery"]});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("">api.easypost.com/.../addresses", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Please help to archive this.

Thanks in advance!!

I have the same question (0)
  • Suggested answer
    NODAL Profile Picture
    860 on at

    Hi Maulik,

    D365 actually does not allow calls to cross domain APIs, you have following alternatives.

    1)Plugin/Custom workflow

    2)PCF control

    Thanks,

    Ketan

  • Suggested answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    Hi,

    Check below article which is implemented for CRM 2013. But you can try in your instance to check it if works.

    xrmdynamicscrm.wordpress.com/.../

    Please mark my answer verified if i were helpful

  • Maulik Lakhani Profile Picture
    94 on at

    doesn`t help..

  • Maulik Lakhani Profile Picture
    94 on at

    We need to verify api response with user before record going to save so any best option?

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Hamza H Profile Picture

Hamza H 142 Super User 2026 Season 1

#2
Nagaraju_Matta Profile Picture

Nagaraju_Matta 128

#3
11manish Profile Picture

11manish 119

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans