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;
}
}