Create

This method is used to create an entity record. This method takes an entity object as a parameter and returns an entity ID after a record has been created. The following code sample creates a vehicle entity record:

Entity vehicle = new Entity("him_vehicle");
vehicle["him_vehiclename"] = "Tata Nexon";
vehicle["him_make"] = new EntityReference("him_make", makes.Entities[0].Id);
vehicle["him_model"] = new EntityReference("him_model", models.Entities[0].Id);
vehicle["him_vehicletype"] = new OptionSetValue(910600005);
vehicle["him_vehiclecategory"] = new OptionSetValue(910600001);
Guid vehicleId = OrgService.Create(vehicle);

In the preceding code, we set the different attributes of the vehicle entity, where we are setting the lookup, option set, and text fields. Once the record has been created, it will return the GUID of the record.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.61.73