Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

PrimaryEntityId getting set to Guid.Empty when context is being obtained in the Plugin #565

Answered by BetimBeja
vijayrit asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @vijayrit
PrimaryEntityId gets read from the Target entity:

if (ctx.InputParameters["Target"] is Entity)
{
var target = (Entity)ctx.InputParameters["Target"];
A.CallTo(() => context.PrimaryEntityId).ReturnsLazily(() => target.Id);
A.CallTo(() => context.PrimaryEntityName).ReturnsLazily(() => target.LogicalName);
}
else if (ctx.InputParameters["Target"] is EntityReference)
{
var target = (EntityReference)ctx.InputParameters["Target"];
A.CallTo(() => context.PrimaryEntityId).ReturnsLazily(() => target.Id);
A.CallTo(() => context.PrimaryEnt…

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by vijayrit
Comment options

You must be logged in to vote
8 replies
@vijayrit
Comment options

@BetimBeja
Comment options

@jordimontana82
Comment options

@vijayrit
Comment options

@jordimontana82
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants