Hello all,
I am trying to copy a project including the named resources. The "Copy Project" in the ribbon menu only lets me copy without the named ressources.
The documentation states that an action "msdyn_CopyProjectV3" exists that can be used to copy a project including the named resources (Develop project templates with Copy Project | Microsoft Learn). I have tried to recreate the button in JS:
var Sdk = window.Sdk || {}; Sdk.CopyWithRessourcesRequest = function () { }; Sdk.CopyWithRessourcesRequest.prototype.getMetadata = function () { var metadata = { boundParameter: null, operationName: "msdyn_CopyProjectV3", operationType: 0 /* Function */, parameterTypes: { "SourceProject": { "typeName": "mscrm.crmbaseentity", "structuralProperty": 5 /* EntityType */, }, "Target": { "typeName": "mscrm.crmbaseentity", "structuralProperty": 5 /* EntityType */, }, "ReplaceNamedResources": { "typeName": "Edm.Boolean", "structuralProperty": 1 /* EntityType */, }, }, }; return metadata; }; // Copies the current project and opens the copied project in the same window // require.js has been loaded by the command bar before making this call async function copyProject(primaryControl, entityId) { console.log("Copy project: " entityId); if (entityId) { var newProjectId = await Xrm.WebApi.createRecord("msdyn_project",{msdyn_subject:"TEST"}); var copyWithRessourcesRequest = new Sdk.CopyWithRessourcesRequest(); var sourceId = { "@odata.type": "Microsoft.Dynamics.CRM.msdyn_project", "quoteid": entityId }; var targetId = { "@odata.type": "Microsoft.Dynamics.CRM.msdyn_project", "quoteid": newProjectId }; copyWithRessourcesRequest.SourceProject = sourceId; copyWithRessourcesRequest.Target = targetId; copyWithRessourcesRequest.ReplaceNamedResources = false; await Xrm.WebApi.online.execute(copyWithRessourcesRequest); } }
But when I call this function I get the following error:
Resource not found for the segment 'msdyn_CopyProjectV3'. Is this function not available in "Project Service Automation"?