In Dynamics CRM development, we occasionally need to create Entity objects, and how to create Entity objects, there is little difference in the C # plugin and JS wording.
A, C # Plugin to create Entity objects:
In C # plugin, as long as new a corresponding type of Entity object, you can operate the property is set to the initial value of the object, before the blog has written various types of fields in C # plugin is how the assignment here is not as specific code shows.
Account = the Account new new the Account (); Account.Name = " Account 1 " ;
Two, JS create Entity objects:
In JS, Json data in a similar format to create Entity objects, then you can call the SDK method uses the object to create or update Entity Record.
var cur_schEnd = Xrm.Page.getAttribute("scheduledend").getValue(); var newEntity = {}; newEntity.ScheduledEnd = cur_schEnd;//DateTime类型 newEntity.new_follow_up_status = { Value: 972050001 };//OptionSet类型 newEntity.new_List_Code = { Id: listId, LogicalName: "list" };//Lookup类型 newEntity.new_Reference_ID = "001";//string类型
Note: just to mention a few types should be noted that OptionSet type and Lookup type attribute set mode field, set the type to other types of relatively simple, such as int type, directly assign a number on it.