Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, February 22, 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: Creating a ticket using code
Claudia
Posts: 23
 
Creating a ticket using codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Apr 08 5:40 PM
I created a custom page that has to create a ticket.
I'm usign this line of code to get an instance of an object Ticket.

ITicket ticket = Sage.Platform.EntityFactory.Create();

I have used this function to create other objects like Account, Contact, Address and some custom entities
and worked perfectly. Now that I'm using it with a Ticket it throws and asp.net error

Object reference not set to an instance of an object.

Does anyone know why it could be failing? or
does anyone know another way to create a ticket?
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: Creating a ticket using codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Apr 08 3:49 PM
Claudia, Did you ever figure this out? I have the following code that creates a contact and also needs to create a ticket. I am getting the same Object reference not set to an instance of an object error. The failing code is the ticket piece at the bottom. It fails in Ticket.CS ITicket Create() on this line: lib.Execute("Ticket.OnCreate", methodArgs);

--failing code,Contact insert ok - ticket is failing.
private void SaveValues(IAccount objAccount)
{
IAddress conaddress = Sage.Platform.EntityFactory.Create();
conaddress.Address1 = txtStreet.Text;
conaddress.City = txtCity.Text;
conaddress.State = State.PickListValue;
conaddress.PostalCode = txtPostalCode.Text;
conaddress.Country = Country.PickListValue;
conaddress.Description = "Mailing";

IContact con = Sage.Platform.EntityFactory.Create();
con.FirstName = txtFirstName.Text;
con.LastName = txtLastName.Text;
con.WorkPhone = phnWorkPhone.Text;
con.HomePhone = phnHomePhone.Text;
con.Mobile = phnCellPhone.Text;
con.Email = txtEmailAddress.Text;
con.AlternateEmail1 = txtEmail1.Text;
con.AlternateEmail2 = txtEmail2.Text;

con.Address = conaddress;
con.DoNotEmail = false;
con.DoNotFax = false;
con.DoNotMail = false;
con.DoNotPhone = false;
con.DoNotSolicit = false;
con.Account = objAccount;
con.AccountName = objAccount.AccountName;
con.Owner = objAccount.Owner;
con.WebUserName = txtEmailAddress.Text.Replace("@","_");
con.WebPassword = txtLoginPassword.Text;
con.SaveWebAccess(true, txtLoginPassword.Text, txtVerifyPassword.Text);
con.Save();

conaddress.EntityId = con.Id.ToString();
conaddress.Save();

con.WebUserName = con.Email;
con.Save();

//
ITicket tic = Sage.Platform.EntityFactory.Create();
tic.ContactId=con.Id.ToString();
tic.AccountId=objAccount.Id.ToString();
tic.Save();
}
[Reply][Quote]
Claudia
Posts: 23
 
Re: Creating a ticket using codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Apr 08 9:48 AM
What I figured out about this error is that in order to create a ticket object there must be a logged in portal user.
The page where I put that code is a page that has to be opened out of a user session (without logging in a user), so in my case, that error is happening because there is no user session initialized.

Are you using that code in a page like mine or in a LeadCapture Portal's page?
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: Creating a ticket using codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Apr 08 9:56 AM
I am having trouble in both cases. Even the oob insert portal ticket screen is failing in the 'anonomous' portal scenario.
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: Creating a ticket using codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 May 08 2:29 PM
Is it possible to insert a record not using fuctions from the customer portal, like I was coding a stand alone asp.net application using the SLX Provider? The fact that I am logging into the portal anonomously is making ticket creation with the entity model seemingly out of the question. Can I generate a TicketID and perform an insert with ADO? Any other thoughts? This has turned into a a major show stopper. Thanks
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Creating a ticket using codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 May 08 2:56 PM
Absolutely. I do it all the time. No need to use the entity model to do it, just insert the data as needed. Did you have specific questions about doing this?
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: Creating a ticket using codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 May 08 3:04 PM
How do I create the ticketID fo the new record to insert?
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: Creating a ticket using codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 May 08 9:33 AM
Ok, I see the ID creation is well documented in an article on this very site. Nice article, thanks Ryan. My next obstacle? Creating the atlernatekeyprefix and alternatekeysuffix from the 7.2 web client. Any tips on this? Thanks
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: Creating a ticket using codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 May 08 9:44 AM
Got the goods for pretty key generation through 7.2 web:

string AltKeyPrefix = PrettyKeys.GetPrettyKeyPrefix(tickID);
string AltKeySuffix = PrettyKeys.GetPrettyKeySuffix(tickID);
[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/22/2025 3:37:08 PM