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

When I insert entity1 fileds value it will auto insert into entity2 fields?

$
0
0

Hi,

both entity in a relation.

If insert value in entity-1 fields then through plugin code it will put into entity-2 fields. Both entity field value same.

Here the code which i written , but not working:

Entity mtarecord = new Entity("ntuc_mtatransactionrecords");

EntityReference mtaid = (EntityReference)entity["ntuc_requestid"];

Guid mtaguid = mtaid.Id;

mtarecord["ntuc_mtarequestid"] = new EntityReference("ntuc_mta_request", mtaguid); //entity["ntuc_mtaid"];                                                                            //EntityReference mtalinid = new EntityReference("ntuc_mtalineitem", (Guid)entity["ntuc_mtalineitemid"]);

EntityReference mtalinid = new EntityReference("ntuc_mtalineitem", entity.Id);

mtarecord["ntuc_mtalineid"] = mtalinid;  

                               mtarecord["ntuc_nric"] = entity["ntuc_nric"];

                               mtarecord["ntuc_cardno"] = entity["ntuc_cardno"];

                               mtarecord["ntuc_name"] = entity["ntuc_name"];

                               mtarecord["ntuc_contact"] = entity["ntuc_contact"];

                               mtarecord["ntuc_txndate"] = new DateTime?(Convert.ToDateTime(entity["ntuc_txndate"]).Date);

                               mtarecord["ntuc_linkpoints"] = entity["ntuc_linkpoints"];

                               mtarecord["ntuc_amount"] = Amount;

                               OptionSetValue typeofaction = new OptionSetValue(((OptionSetValue)entity["ntuc_typeofaction"]).Value);

mtarecord["ntuc_typeofaction"] = typeofaction;

                               OptionSetValue pooltype = new OptionSetValue(((OptionSetValue)entity["ntuc_pooltype"]).Value);

mtarecord["ntuc_pooltype"] = pooltype;

                               EntityReference recpoolid = new EntityReference("ntuc_mtatransactionmapping", poolguid);

mtarecord["ntuc_pool"] = recpoolid;

                               mtarecord["ntuc_referenceno"] = entity["ntuc_referenceno"];

                               mtarecord["ntuc_merchantname"] = entity["ntuc_merchantname"];

                               mtarecord["ntuc_comments"] = entity["ntuc_comments"];

                               mtarecord["ntuc_remarks"] = entity["ntuc_remarks"];

                               mtarecord["ntuc_location"] = entity["ntuc_location"];

                               OptionSetValue costcharge = new OptionSetValue(((OptionSetValue)entity["ntuc_costchargeto"]).Value);

mtarecord["ntuc_costchargeto"] = costcharge;

                               service.Create(mtarecord);  


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images