Skip to content

Latest commit

 

History

History
92 lines (76 loc) · 2.52 KB

recalculateprice-action.md

File metadata and controls

92 lines (76 loc) · 2.52 KB
title description ms.date ms.topic author ms.author ms.reviewer ms.custom
RecalculatePrice Action - Developer Guide
Programmatically trigger the out-of-the-box price calculation for Opportunity, Quote, Sales Order or Invoice entities.
08/09/2023
article
lavanyakr01
lavanyakr
lavanyakr
dyn365-sales

RecalculatePrice Action

This action is used to trigger out of the box price calculation for Opportunity, Quote, Sales Order or Invoice entities. This action is applicable for both server and client invocations.

License and role requirements

Requirement type You must have
License Dynamics 365 Sales Premium or Dynamics 365 Sales Enterprise
More information: Dynamics 365 Sales pricing
Security roles System customizer
More information: Predefined security roles for Sales

Parameters

Name Type Required Description
entityLogicalName String Yes Entity logical name
entityId GUID Yes Entity GUID

Examples

Server Invocation

Request

POST [Organization URI]/api/data/v9.1/RecalculatePrice
{
    "entityLogicalName": "quote",
    "entityId":"91F3EDB0-213B-E911-8190-000D3AFD8945"
}

Response

HTTP/1.1 204 No Content
OData-Version: 4.0

Client Invocation

function RecalculatePrice(formContext) {
    var recalculatePriceRequest = {
        entityId: formContext.data.entity.getId(),
        entityLogicalName: formContext.data.entity.getEntityName(),
        Target: parameters.Target,
        getMetadata: function () {
            return {
                boundParameter: null,
                parameterTypes: {
                    "entityId": {
                        "typeName": "Edm.Guid",
                        "structuralProperty": 5,
                    },
                    "entityLogicalName": {
                        "typeName": "Edm.String",
                        "structuralProperty": 1,
                    },
                },
                operationType: 0,
                operationName: "RecalculatePrice"
            };
        }
    };
    Xrm.WebApi.online.execute(recalculatePriceRequest).then(
        function success(result) {
            if (result.ok) {
                //Success
            }
        },
        function (error) {
            Xrm.Utility.alertDialog(error.message);
        }
    );
}

[!INCLUDEfooter-include]