Notifications
Announcements
No record found.
Hi,
Can any one help me to create a record in contact using silverlight form in CRM 2013 c# code?
Thanks
*This post is locked for comments
Hi Habeeb,
This is the sample code I did using Silverlight before:
private void CreateCustomer() { try {
Contact contactRecord = new Contact();
contactRecord.FirstName = txtFirstName.Text; contactRecord.LastName = txtLastName.Text; contactRecord.FullName = txtFirstName.Text + txtLastName.Text;
OptionSetValue osvGender = new OptionSetValue(); if (rbGenderMale.IsChecked == true) { osvGender.Value = 1; } else { osvGender.Value = 2; } contactRecord.GenderCode = osvGender;
if (rbReceivePromoSMSYes.IsChecked == true) { contactRecord.new_ReceivePromoSMS = true; } else { contactRecord.new_ReceivePromoSMS = false; }
contactRecord.MobilePhone = txtMobilePhone.Text; contactRecord.EMailAddress1 = txtEmail.Text; contactRecord.Address1_Telephone1 = txtPhone.Text; contactRecord.Address1_Name = txtAddressName.Text; contactRecord.Address1_Line1 = txtStreet1.Text; contactRecord.Address1_Line2 = txtStreet2.Text; contactRecord.Address1_City = txtCity.Text; contactRecord.Address1_StateOrProvince = txtProvince.Text; contactRecord.Address1_Country = txtCountry.Text; contactRecord.Address1_PostalCode = txtPostalCode.Text;
_context.AddToContactSet(contactRecord); _context.BeginSaveChanges(OnCreateCustomerComplete, contactRecord); } catch (SystemException se) { MessageBox.Show(se.Message); } }
private void OnCreateCustomerComplete(IAsyncResult result) { try { _context.EndSaveChanges(result); Contact contactRecord = result.AsyncState as Contact;
txtStatus.Text = "Customer " + contactRecord.FullName + " has been created..."; } catch (SystemException se) { MessageBox.Show(se.Message); } }
Hope it helps!
You might refer to these links:
arvindcsit.wordpress.com/.../create-crm-records-using-rest-endpoint-with-silverlight
crmallied.blogspot.com/.../silverlight-create-update-delete_13.html
Silverlight also using REST Endpoint method, you might to download the CSDL file.
Hi Aileen Gusni,
While adding a value to attribute in Contact Entity i am getting an error as shown in below picture.
My aim is to create a record in contact entity using silverlight application.
Thank You.
You need to add reference another .cs
blogs.msdn.com/.../silvercrmsoap-a-crm-soap-library-for-crm-2011.aspx
msdn.microsoft.com/.../gg594452.aspx
Silverlight in CRM 2013 it is almost deprecated but you still can use it.
Hope this helps!
Thanks.
could you plz help me, how can i create a record using silverlight in CRM2013.And where would i find another.cs file for reference.
Silverlight in CRM 2013 it is almost deprecated???
Please see the answer.
I gave you the links, I gave you the sample codes of mine.
What else you need?
Thank you for your code.But the links you have sent me that is only for 2011 CRM. Again i made some changes in that code but i can't create a record.
What is the error now?
I still can use that in my CRM 2013
Why you don't change to Web Resource HTML5
_context.AddToContactSet(contactRecord);
_context.BeginSaveChanges(OnCreateCustomerComplete, contactRecord);
error at above lines.I have added a ServiceUtility.cs file and SilverlightExtensionMethods.cs again it is showing that context doesn't contain a method AddToContactSet(contactRecord);.
BeginSaveChanges(OnCreateCustomerComplete, contactRecord);.......And i am going to change it to Html5.
Thank You Aileen Gusni for you patience.
What context did you use.
You should generate an early bound library, in this case service reference
So that, see this link in the CSDL section:
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2