Asked by:
CRM 4.0 Plugin to CRM 2013

Question
-
I am newbie in CRM and just while I starting CRM customization we are upgrading from CRM 4.0 to CRM 2013. I must customize some plugin to CRM 2013 but I have difficulty to understand CRM 4.0 coding. Please can any CRM angel help me.
Here I attach a snip from long coding where I have difficulty to understand.
First one: CRM 4.0 Coding
try { TargetCreateDynamic tcd = new TargetCreateDynamic(); CreateRequest createRequest = new CreateRequest(); tcd.Entity = seminarprodukt; createRequest.Target = tcd; Response bla = cs.Execute(createRequest);
My coding for this snip:
try { TargetCreateDynamic tcd = new TargetCreateDynamic(); CreateRequest createRequest = new CreateRequest(); Entity entityToCreate = new Entity("seminarproduct"); createRequest.Target = entityToCreate;//tcd; CreateEntityResponse response = (CreateEntityResponse)service.Execute(createRequest);
Second one:
else if (context.PostEntityImages.Contains("Vorlage")) { //sem_vorlage try { Log("Neue Vorlage!"); DynamicEntity vorlage = (DynamicEntity)context.PostEntityImages["Vorlage"]; // DynamicEntity[] produkte = new DynamicEntity[4]; product[] produkte = new product[4]; Lookup einheit = new Lookup(); einheit.Value = new Guid("8BC61AB9-9C7B-40DE-92EA-400D2D2D723C"); einheit.type = EntityName.uom.ToString(); einheit.name = "Primäre Einheit"; //Einheitengruppe 14716F64-B23E-48D8-91D6-3A5959CE9A80 Lookup einheitgruppe = new Lookup(); einheitgruppe.Value = new Guid("14716F64-B23E-48D8-91D6-3A5959CE9A80"); einheitgruppe.type = EntityName.uomschedule.ToString(); einheitgruppe.name = "Standardeinheit"; Picklist produkttyp = new Picklist(); produkttyp.Value = 2; produkttyp.name = "Verschiedenes"; Lookup e = new Lookup(); e.type = EntityName.transactioncurrency.ToString(); e.name = "Euro"; e.Value = new Guid("09E73F71-0DE5-E011-B6A9-00155D06D300"); Lookup chf = new Lookup(); chf.type = EntityName.transactioncurrency.ToString(); chf.name = "Schweizer Franken"; chf.Value = new Guid("77C0C210-65EE-E011-98DF-00155D06D300"); Lookup epl = new Lookup(); epl.name = "Euro"; epl.Value = new Guid("42998222-C995-E111-82D3-00155D06D300"); epl.type = EntityName.pricelevel.ToString(); Lookup chfpl = new Lookup(); chfpl.name = "Schweiz"; chfpl.Value = new Guid("8467A214-C995-E111-82D3-00155D06D300"); chfpl.type = EntityName.pricelevel.ToString(); for (int i = 0; i < produkte.Length; i++) { produkte[i] = new product(); produkte[i].quantitydecimal = new CrmNumber(2); produkte[i].producttypecode = produkttyp; produkte[i].defaultuomscheduleid = einheitgruppe; produkte[i].defaultuomid = einheit; }
My Coding for this snip:
else if (context.PostEntityImages.Contains("Vorlage")) { //sem_vorlage try { Log("Neue Vorlage!"); Entity vorlage = (Entity)context.PostEntityImages["Vorlage"]; //Entity[] produkte = new Entity[4]; product[] produkte = new product[4]; EntityReference einheit = new EntityReference(); einheit.Id = new Guid("8BC61AB9-9C7B-40DE-92EA-400D2D2D723C"); //einheit.Name = EntityName.uom.ToString(); einheit.LogicalName = "Primäre Einheit"; //Einheitengruppe 14716F64-B23E-48D8-91D6-3A5959CE9A80 EntityReference einheitgruppe = new EntityReference(); einheitgruppe.Id = new Guid("14716F64-B23E-48D8-91D6-3A5959CE9A80"); einheitgruppe.Name = "uomschedule".ToString(); //????? Name = Type??? einheitgruppe.LogicalName = "Standardeinheit"; OptionSetValue produkttyp = new OptionSetValue(); produkttyp.Value = 2; // produkttyp //.name = "Verschiedenes"; EntityReference e = new EntityReference(); //Währung in Product e.Name ="transactioncurrency".ToString(); e.LogicalName = "Euro"; e.Id = new Guid("09E73F71-0DE5-E011-B6A9-00155D06D300"); EntityReference chf = new EntityReference(); chf.Name = "transactioncurrency".ToString(); chf.LogicalName = "Schweizer Franken"; chf.Id = new Guid("77C0C210-65EE-E011-98DF-00155D06D300"); EntityReference epl = new EntityReference(); epl.LogicalName = "Euro"; epl.Id = new Guid("42998222-C995-E111-82D3-00155D06D300"); epl.Name = "pricelevel".ToString(); EntityReference chfpl = new EntityReference(); chfpl.LogicalName = "Schweiz"; chfpl.Id = new Guid("8467A214-C995-E111-82D3-00155D06D300"); chfpl.Name = "pricelevel".ToString(); for (int i = 0; i < produkte.Length; i++) { produkte[i] = new product(); produkte[i].quantitydecimal = new CrmNumber(2); produkte[i].producttypecode = produkttyp; produkte[i].defaultuomscheduleid = einheitgruppe; produkte[i].defaultuomid = einheit; }
The row as bold selected I did not understand. Can any one help me how I can customize or is there other wrong customize coding. Thanks a lot for your time and advice.
Thursday, February 19, 2015 9:28 PM
All replies
-
Hello,
To understand what the code means I would suggest to recheck SDK for CRM 4.0 (it is still available online!).
Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
My blog- Edited by Andrii ButenkoMVP, Moderator Friday, February 20, 2015 6:48 AM
Friday, February 20, 2015 6:48 AMModerator