Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, April 27, 2024 
 
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: Re: Add a button to call a url
Lee Owen
Posts: 46
 
Re: Add a button to call a urlYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Jan 09 9:48 AM
Tinkering with code for days. Still getting errors.
I can't for the life of me get the Country Code from the Country Picklist and print out the value. My error from the post above of course changed by declaring the string YOURURL earlier in the code but now i get new errors and i can't seem get the value and print it.

When i have YOURURL = cmd.ExecuteScalar().ToString(); i get the error Object reference not set to an instance of an object.
how do i get the value and print it?
[Reply][Quote]
Lee Owen
Posts: 46
 
Re: Add a button to call a urlYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Jan 09 1:43 PM
i'm going to keep posting although no on is replying.

the cmd.ExecuteScalar().ToString() gets the object reference not set to and instance of an object error.
if i try this....

object xyz = cmd.ExecuteScalar().ToString();
if (xyz != null)
{
YOURURL = xyz.ToString();
blah blah blah blah... never get to this cause i get the same error as soon as i use executescalar.
}


what has to happen to use cmd.ExecuteScalar().ToString()? if i set my string = cmd.ExecuteScalar().ToString() i get errors, if i set and object = cmd.ExecuteScalar().ToString() i get the same error.

Object reference not set to an instance of an object. I understand that a null value can cause problems when you try to convert it to a string, but A. i'm checking for null and B. there should be a value....its not null.

someone shine some light for me!!!!

thanks

[Reply][Quote]
Lee Owen
Posts: 46
 
Re: Add a button to call a urlYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Jan 09 3:16 PM
SOLVED!
it was my sql statement and i was in fact returning a null value.
my sql was
string sql = "Select Shorttext from Picklist where Text = '" + country + "' and PicklistID = 'Country'";

well the picklist is called Country but the PickListID isn't. That'd be kSYST0000388 in my particular database. Once i figured that out by going to SQL and executing my statement directly, it quickly became obvious that was my error. Everything else soon fell into place.

My final ENTIRE code snippet is this.

Sage.Entity.Interfaces.IContact contact = this.BindingSource.Current as Sage.Entity.Interfaces.IContact;
string CountryDialCode ="";
if (contact.Address.Country != null)
{
string country = contact.Address.Country;
Sage.Platform.Data.IDataService _dataService = ParentWorkItem.Services.Get();
string sql = "Select Shorttext from Picklist where Text = '" + country + "' and PicklistID = 'kSYST0000388'";
using (System.Data.OleDb.OleDbConnection conn = (System.Data.OleDb.OleDbConnection)_dataService.GetConnection())
{
conn.Open();
System.Data.IDbCommand cmd = conn.CreateCommand();
cmd.CommandText = sql;

object xyz = cmd.ExecuteScalar().ToString();
if (xyz != null)
{
CountryDialCode = xyz.ToString();
}
}
}
if (contact != null)
{
DialButton2.OnClientClick = string.Format("window.open('http://api.aptela.com/callback?u=XXXXXUSER&g=XXXGROUP&n=011"+ CountryDialCode +"%20{0}');", contact.Mobile);
}


Whew... ready for a break. THANK YOU THANK YOU THANK YOU to everyone who posted in this thread and helped me get to this point.

[Reply][Quote]
 Page 2 of 2<< < Previous 
  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 © 2024 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): 4/27/2024 11:44:15 AM