8/17/2025 2:30:30 PM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
|
|
|
|
error on save
Posted: 18 Feb 09 12:50 PM
|
i created a new entitity called contact profile. this is releated to contact with contact being the parent with the following relationship: Contact entity has manhy Contact_Profile entities. Represented by jioining Contact.ContactId to Contact_Profile.ContactId
I created a tab for contacts that has a gird with all the profile information for this contact. I have an add button that launches a Dialog form to enter in a new profile for the contact. When i click the ok button i get the following error: could not insert: [Sage.SalesLogix.Entities.C_Contact_Profile#QQF8AA000DU5][SQL: INSERT INTO C_CONTACT_PROFILE (CONTACTID, PROFILETYPE, PROFILENOTES, CONTACTID, C_CONTACT_PROFILEID) VALUES (?, ?, ?, ?, ?)]
Here is my code: Sage.Entity.Interfaces.IC_Contact_Profile cntPrfl = GetCurrentEntity() as Sage.Entity.Interfaces.IC_Contact_Profile; Sage.Entity.Interfaces.IContact cnt = GetParentEntity() as Sage.Entity.Interfaces.IContact;
cntPrfl.Contact = cnt; cntPrfl.ContactId = cnt.Id.ToString();
cnt.CContactProfiles.Add(cntPrfl);
cnt.Save();
In the error it looks like it is trying to insert the contactid twice. I'm not sure if this i causing the error or something else.
|
|
|
|
Re: error on save
Posted: 18 Feb 09 3:35 PM
|
If I understand you right, you have a datagrid under contacts for your profiles. You have the little button on your toolbar for adding a new entry. I am assuming your new form is coming up ok from what you have noted there. Then when you hit the ok button you are getting the error.
I’m not sure where you have your code tucked underneath (Validate\Load?) but what I did notice is your: cnt.CContactProfiles.Add(cntPrfl); cnt.Save();
Where I am confused is if you are already on your insert form then why are you calling the .Add(). I’m probably missing something here but on my load action I usually do something like the following to bind the parent and the Save business rule takes care of the rest. ------ if (this.BindingSource != null) { Sage.Entity.Interfaces.IContactOneToMany mContactOneToMany = this.BindingSource.Current as Sage.Entity.Interfaces.IContactOneToMany; Sage.Entity.Interfaces.IContact contact = GetParentEntity() as Sage.Entity.Interfaces.IContact; if (contact != null) { mContactOneToMany.Contact = contact; this.BindingSource.Bind(); } }
--Ken--
|
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|