Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Plugins for two enties

$
0
0

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;

}

}


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>