Hi, I was asked to add a button to my form near a field (not on the ribbon) can I do it in a supported way ? the button after clicked will call a function that will get data from server side (if that's matters)
thanks
Hi, I was asked to add a button to my form near a field (not on the ribbon) can I do it in a supported way ? the button after clicked will call a function that will get data from server side (if that's matters)
thanks
Hi Partner,
you can use the Web resource to achieve this and create a button on the Form, reference link: community.dynamics.com/.../adding-a-button-to-a-form
As describe above go with HTML web resources to create the button, you can implement your service side logic in plugin. Call the plugin from CRM action , on button click you can call Action directly.
Another way to create Rest Services and or use Web API if you are trying to fetch CRM records.
Hi Sahara,
Hope you are doing well.
We can add button on any form using web resource (HTML page), please follow the below steps:
1. Navigate to Settings > Solutions > Customize the solution.
2. Click on web resources and add new HTML web resource.
3. Put your HTML code with button and JavaScript. Save and publish.
4. Go to edit form and Insert web resource created above.
We can also use https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/query-data-web-api to get data from server. Use below code to call web api.
var req = new XMLHttpRequest();
req.open("PATCH", Xrm.Page.context.getClientUrl() + "/api/data/v9.1/contacts(" + contactId + ")", true);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function() {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 204) {
//Success - No Return Data - Do Something
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send(JSON.stringify(entity));
}
Best Regards,
Mobeen Mohsin
Dynamics CRM Consultant
Hi,
You can achieve this by creating a custom button in WebResource and after that, you can add the WebResource to the form. Please follow the below blogs to achieve the same:
https://mscrmtutorials.com/create-a-custom-html-button-in-dynamics-365/
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,235 Most Valuable Professional
nmaenpaa 101,156