2/21/2025 6:01:02 AM
|
|
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.
|
|
|
|
Create entity instance, MANUALLY OBTAIN OpportunityID
Posted: 24 Feb 08 6:23 AM
|
Hi,
I could database directly, using
IDataService service = Sage.Platform.Application.ApplicationContext.Current.Services.Get(); String connection = service.GetConnectionString();
So, I am building the custom pages using Visual Studio dotnet. Well, initial testing went fine where I could access the database and update it.
But, I am unable to create a new entity instance. Example, if I am creating new record in "OPPORTUNITY" table, Unique ID "OPPORTUNITYID" an Unique ID data will be populated automatically. IOPPORTUNITY Opp = EntityFactory.Create(); String MANUALLY_OBTAINED_UNIQUE_ID; MANUALLY_OBTAINED_UNIQUE_OppID = < NEED YOUR HELP>
CAN YOU PLEASE GIVE FEW LINES OF CODE, WHERE I CAN CREATE THIS CODE MANUALLY in text format. So that, I can use SQL INSERT command to add new records.
EXAMPLE: INSERT INTO OPPORTUNITY (OPPORTUNITYID,DESCRIPTION) VALUES('MANUALLY_OBTAINED_UNIQUE_OppID', 'BANKSCOPE')
Hope you understood my requirement. If any questions, please write to me.
Thanks |
|
|
|
Re: Create entity instance, MANUALLY OBTAIN OpportunityID
Posted: 25 Feb 08 7:29 AM
|
Sreenivas,
To generate a key you need to call the slx_dbids stored procedure or generated one yourself ensuring uniqueness. You cannot create one through the entity model in the current releases of SalesLogix web client.
Mark |
|
|
|
Re: Create entity instance, MANUALLY OBTAIN OpportunityID
Posted: 25 Feb 08 11:48 PM
|
Thanks Mark.
With help of other replies in the forum. I manage to create the Unique ID here the function I would like to share.
Hi Bryan,
The good news is that, small tweak to the function given by Rick will fetch you the Unique ID. Here is the code which worked for me...
protected void btnGetID_Click(object sender, EventArgs e) { string myTable = "SUBSCRIPTION"; txtID.Text = CreateSalesLogixId(myTable); }
public string CreateSalesLogixId(string myTable) { OleDbConnection vConn = GroupInfo.GetOpenConnection(); string commandText = String.Format(CultureInfo.CurrentCulture, "slx_dbids('{0}', 1)", myTable); OleDbCommand GetSalesLogixIDCommand = new OleDbCommand(commandText, vConn); object result = null; try { result = GetSalesLogixIDCommand.ExecuteScalar(); } catch { throw new Exception("cannot fetch ID"); } finally { vConn.Close(); } return result.ToString(); }
Thanks Guys for all.... |
|
|
| |
| |
|
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!
|
|
|
|
|
|
|
|