PowerPlatform-DataverseServiceClient icon indicating copy to clipboard operation
PowerPlatform-DataverseServiceClient copied to clipboard

RequestId is not send via the web api

Open meghuizen opened this issue 4 years ago • 4 comments

I want to add a request id, which I can pickup in the plugins to do business logic on. This is logic I already had when using the old API client.

Example Code

CreateResponse crResp = (CreateResponse)myServiceClient.Execute(new CreateRequest
                        {
                            Target = myEntity,
                            RequestId = MySharedGuidWithAPlugin
                        });

In my plugin code I'm using

((IExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext))).RequestId

However I'm not able to pick that up in the plugin. Is this something which still needs to be integrated?

meghuizen avatar Dec 01 '21 12:12 meghuizen

Request ID's are set via the WebAPI request's and you can see them via a fiddler trace. You can cross check the behavior by setting UseWebAPI = false on the client before you send your request.

Adding @JimDaly for comment here as well.

MattB-msft avatar Dec 01 '21 16:12 MattB-msft

If your purpose is to have some information in your plug-in, you can use the tag to add a value which will be available as a shared variable in your plug-in. See Add a Shared Variable from the Web API

Since this question is related to DataverseServiceClient and is using IOrganizationService interface, I expect the actual style in which you would pass it would be like this Add a shared variable from the Organization Service

JimDaly avatar Dec 01 '21 17:12 JimDaly

Thanks @JimDaly for the extra explanation regarding that. Will take that into account and maybe change that. Currently we use the RequestID as "legacy" from when a plugin triggers an action on another entity, where in the other plugin needs a different execution path because of that.

@MattB-msft Thanks for your comment. I might try to attach Fiddler to it tomorrow, however I did cross check it by explicitely using UseWebAPI on false and that fixed my issue. I will however double check this tomorrow to know for certain I didn't miss anything.

meghuizen avatar Dec 01 '21 18:12 meghuizen

As a follow up, we confirmed that the Request ID is being passed via the webAPI leg, and we are researching the server side disconnect there.

If you want to continue to use RequestID for now, and do now want to switch to Tag, Please continue to set UseWebAPI to false until we get it patched server side.

MattB-msft avatar Dec 08 '21 16:12 MattB-msft

Cleaning up this issue, This was resolved in the last year.. this was missed for cleanup.

MattB-msft avatar Jul 20 '23 17:07 MattB-msft