Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, February 21, 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: Create entity instance, MANUALLY OBTAIN OpportunityID
sreenivas
Posts: 14
 
Create entity instance, MANUALLY OBTAIN OpportunityIDYour last visit to this thread was on 1/1/1970 12:00:00 AM
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
[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: Create entity instance, MANUALLY OBTAIN OpportunityIDYour last visit to this thread was on 1/1/1970 12:00:00 AM
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
[Reply][Quote]
sreenivas
Posts: 14
 
Re: Create entity instance, MANUALLY OBTAIN OpportunityIDYour last visit to this thread was on 1/1/1970 12:00:00 AM
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....
[Reply][Quote]
sreenivas
Posts: 14
 
Re: Create entity instance, MANUALLY OBTAIN OpportunityIDYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Feb 08 12:11 AM
Forgot to tell you.. Add this namespace

using System.Globalization;
[Reply][Quote]
sreenivas
Posts: 14
 
Re: Create entity instance, MANUALLY OBTAIN OpportunityIDYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Feb 08 12:11 AM
Forgot to tell you.. Add this namespace

using System.Globalization;
[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): 2/21/2025 6:18:15 AM