Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, August 17, 2025 
 
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!
 Web Forums - SalesLogix Web Platform & Application Architect
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.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: error on save
vaughn poulson
Posts: 28
 
error on saveYour last visit to this thread was on 1/1/1970 12:00:00 AM
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.
[Reply][Quote]
Ken Poggensee
Posts: 71
 
Re: error on saveYour last visit to this thread was on 1/1/1970 12:00:00 AM
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--


[Reply][Quote]
 Page 1 of 1 
  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!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 8/17/2025 3:20:33 PM