web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Plugins for two enties

(1) ShareShare
ReportReport
Posted on by 160

Hi

I have 2 entities "Payment Transection" and "membership". i want to change the membership status to "Active" when membership status is changed(or created) to "Paid". I m facing problems when m trying to update the status of membership. 

if (!context.InputParameters.ContainsKey("Target"))

throw new InvalidPluginExecutionException("No target found");
var entity = context.InputParameters["Target"] as Entity;

if (entity.LogicalName == "tpamm_paymenttransaction")
{
if (entity.Contains("statecode") && entity["statecode"] != null)
{
OptionSetValue status = (OptionSetValue)entity["statecode"];
int selectedTopicValue = status.Value;


if (selectedTopicValue == 0)
{
entity["tpamm_aggg"] = 23;    //this code is working upto this line. aggg field is 23 after saving.


var entity2 = new Entity("tpamm_MemberShip");

if (entity2.LogicalName == "tpamm_membership")
{


if (entity2.Contains("tpamm_status"))
{
entity2["tpamm_status"] = 239730001;
entity2["statuscode"] = 1;

}

}

I have the same question (0)
  • happysingh0009 Profile Picture
    160 on at

    these two tables are connected through lookup. the transection entity have membershipID lookup from membership table

  • Verified answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    Hi,

    Where is service.update(entity2) code which will update the second entity?

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • happysingh0009 Profile Picture
    160 on at

    Thank you for your reply.

  • Suggested answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    Hi,

    If your issue is resolved then please mark my answer verified by clicking on Yes under Did this answer your question?

    78206.PNG

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Hamza H Profile Picture

Hamza H 140 Super User 2026 Season 1

#2
Nagaraju_Matta Profile Picture

Nagaraju_Matta 128

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 70 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans