Open custom page from modern command button

 JS code

function openPriceuploadpage(primaryControl, firstSelectedItemId, selectedEntityTypeName)
{
    // price upload page
    var pageInput = {
        pageType: "custom",
        name: "cd_pricelist_a8ed3",
        entityName: selectedEntityTypeName, // "sample_review"
        recordId: firstSelectedItemId // "{087AA308-B321-E811-A845-000D3A33A3AC}"
    };
    var navigationOptions = {
        target: 2,
        position: 1,
        height: 300,
        width: 300,
        title: "Pricelist Upload"
    };
    Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(
        function () {
            // Refresh the main form when the dialog is closed
            primaryControl.data.refresh();
        }
    ).catch (
        function (error) {
            // Handle error
        }
    );
}


Custom page On start to get the GUID of the current record if we use the below code we can get only GUID not as object.

Set(varlabID,GUID(Mid(Param("recordId"),2,Len(Param("recordId"))-2)));Set(labId,LookUp(Labs,Lab=varlabID))

Modern command button configurations:



Comments

Popular posts from this blog

Create a grounded prompt in AI Builder - Dataverse(preview)- Use prompt in a cloud flow

Clone Quote and Opportunity records in D365 CRM through power automate, custom page - Set the current user as owner

How to update 100000(hundred thousand) records with power automate flow by using chunk expression, Split the list and pass onto child flows.