cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
hajekj
MVP

Using Win and Lose Opportunity actions in Unbound Action of CDS Current Environment connector

Has anyone been able to successfully use WinOpportunity / LoseOpportunity actions from within Unbound Action in CDS Current Environment Connector?

 

It appears that you need to pass opportunityid@odata.bind there instead of opportunityclose _opportunityid_value which the actions offers you, because you end up with following error:

 

{
  "code": "0x0",
  "message": "CRM do not support direct update of Entity Reference properties, Use Navigation properties instead.",
  "innererror": {
    "message": "CRM do not support direct update of Entity Reference properties, Use Navigation properties instead.",
    "type": "Microsoft.Crm.CrmHttpException",
    "stacktrace": "   at Microsoft.Crm.Extensibility.OData.TypeConverters.EntityReferenceAttributeTypeConverter.ConvertToCrmTypeInternal(Guid edmTypeValue, String operationName)\r\n   at Microsoft.Crm.Extensibility.OData.TypeConverters.EdmTypeConverterBase`2.ConvertToCrmType(Object edmTypeValue, String operationName)\r\n   at Microsoft.Crm.Extensibility.OData.TypeConverters.EdmEntityTypeConverter.SetStructuralPropertyToXrmEntity(Entity entity, EntityMetadata entityMetadata, String crmAttributeName, IEdmProperty edmProperty, Object propertyValue)\r\n   at Microsoft.Crm.Extensibility.OData.TypeConverters.EdmEntityTypeConverter.ConvertToCrmTypeInternal(EdmEntityObject edmTypeValue, String operationName)\r\n   at Microsoft.Crm.Extensibility.OData.TypeConverters.EdmTypeConverterBase`2.ConvertToCrmType(Object edmTypeValue, String operationName)\r\n   at Microsoft.Crm.Extensibility.ODataV4.Converters.TypeConverters.OnDemandEdmEntityTypeConverter.ConvertToCrmTypeInternal(EdmEntityObject edmTypeValue, String operationName)\r\n   at Microsoft.Crm.Extensibility.OData.TypeConverters.EdmTypeConverterBase`2.ConvertToCrmType(Object edmTypeValue, String operationName)\r\n   at Microsoft.Crm.Extensibility.OData.RequestResponseConverter.AddSDKRequestParameterFromEdmOperationParameter(IEdmModel edmModel, IEdmOperation edmOperation, ParameterCollection parameterCollection, KeyValuePair`2 parameter, Tuple`2 messagePair, ExecutionContext context)\r\n   at Microsoft.Crm.Extensibility.OData.RequestResponseConverter.GetRequestParamsFromOperationRequest(IEdmModel edmModel, IEdmOperation edmOperation, Dictionary`2 parameters, Dictionary`2 boundParameters, Tuple`2 messagePair, Dictionary`2 offlineData, ExecutionContext context)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataServiceDataProvider.ExecuteOperation(CrmODataExecutionContext context, EdmOperation edmOperation, Dictionary`2 parameters, Dictionary`2 boundParameters)\r\n   at Microsoft.Crm.Extensibility.OData.ActionController.ProcessOperationRequest(String operationName, Dictionary`2 operationParameters, EntityReference entityReference, String boundEntityName, String boundEntityType)\r\n   at Microsoft.Crm.Extensibility.OData.ActionController.<>c__DisplayClass9_0.<PostUnboundAction>b__0()\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataUtilities.<>c__DisplayClass10_0`2.<InvokeActionAndLogMetric>b__0()\r\n   at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties)\r\n   at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
  }
}

 

So what should be the correct way to call this action from within Flow?

1 ACCEPTED SOLUTION

Accepted Solutions

Sorry, forgot to update this back, but the ticket is now closed with the following:

 

After reviewing and troubleshooting this issue critically, I escalated same to the backend team for more taction on the experience. We were informed by the team that the issues were a known issue and they are actively working on this feature to have it working as expected. When we get information on the release timeline, we will be sharing this with you.

View solution in original post

10 REPLIES 10
abm
Super User
Super User

Hi @hajekj 

 

Could you please post a screen shot of your flow configuration?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Sure, here it is:

 

hajekj_0-1596453742911.png

 

The Prilezitost value is: outputs('UpdateOpportunity')?['body/opportunityid'] (it is a valid GUID which exists in the target system). The action itself is defined as:

{
    "inputs": {
        "host": {
            "connectionName": "shared_commondataserviceforapps",
            "operationId": "PerformUnboundAction",
            "apiId": "/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps"
        },
        "parameters": {
            "actionName": "WinOpportunity",
            "item/OpportunityClose/_opportunityid_value": "@outputs('UpdateOpportunity')?['body/opportunityid']",
            "item/Status": -1
        },
        "authentication": "@parameters('$authentication')"
    }
}
abm
Super User
Super User

Hi @hajekj 

 

Try 

 

/opportunity(00000000-0000-0000-0000-000000000001)


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

I have tried it, but it expects Guid:

 

Flow save failed with code 'OpenApiOperationParameterValidationFailed' and message 'Input parameter 'item' validation failed in workflow operation 'Perform_an_unbound_action': The parameter with value '"/opportunity(4d900673-1eef-e911-a812-000d3ab366f6)"' in path 'item/OpportunityClose/_opportunityid_value' with type/format 'String' is not convertible to type/format 'String/uuid'.'.

 

I tried going around it by passing it from a variable but ended up with similar error:

 

The 'inputs.parameters' of workflow operation 'Perform_an_unbound_action' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'item/OpportunityClose/_opportunityid_value' is required to be of type 'String/uuid'. The runtime value '"/opportunity(4d900673-1eef-e911-a812-000d3ab366f6)"' to be converted doesn't have the expected format 'String/uuid'.

 

Hi @hajekj 

 

I did tried and got the same error. Not sure what's causing this error. Worth raising a ticket with Power Automate Support.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Have ticket #120072825000215 open, will post back with results.

is there any update on ticket #120072825000215?

Sorry, forgot to update this back, but the ticket is now closed with the following:

 

After reviewing and troubleshooting this issue critically, I escalated same to the backend team for more taction on the experience. We were informed by the team that the issues were a known issue and they are actively working on this feature to have it working as expected. When we get information on the release timeline, we will be sharing this with you.

The workaround I used for successfully closing out an opportunity was the following:

  • In Dynamics, create a process ACTION on opportunity entity. (Same process to create a traditional workflow in Dynamics, just select Action instead of workflow.) Within the action Use the "Change Status" step to set the status to Won or Lost. Activate action in your target environment
  • From Flow, select CDS - Perform a bound action. Entity = Opportunity / Action = Your newly created action from step 1. Input your opportunity id value from previous steps

 

Anonymous
Not applicable

Has there been any update on Microsoft fixing this issue? I am currently trying to use the unbound action - LoseOpportunity. I am still getting the error that you got.

Helpful resources

Top Kudoed Authors
Users online (3,263)