• Coldfinger
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 6
    Replies

I have some code on the Lead Trigger which filters the lead coming in, and if certain details are true about it, instead of adding the lead to the system it will instead create a custom object that I have defined.

 

Now my trouble is, whenever I add the "addError" command to the lead coming in, to suppress it being added, the "insert" on my custom object fails

If I remove the addError, the custom object is added, but the lead is also added.

 

I would really like the lead not to be inserted, but the custom object to be inserted.

 

Here's some cut down code which should show the case in question:

 

trigger LeadNew on Lead (before insert) {

    for (Lead l:Trigger.new)
    {

/* condition met test generated*/

        if (bConditionMet)
        {
            LeadTask__c leadTask=new LeadTask__c();

/* create the leadtask from info in the bad lead */

            insert leadTask;


/* comment out the line below and the lead and leadtask are both added

if they're not commented out, then neither are added

*/

         l.addError('Lead not created as a task was generated instead');
        }
    }

}

 

Any suggestions would be gratefully received.

 
I'm just looking at accessing the data on salesforce from our web site which is classic ASP,

The office toolkit has been installed on the web server, but whenever I try to make the login call, it returns false and does not create a valid session.

I have tried using two different username/password combinations, appending the security token to the end of the password and not, but whatever I do it gets to the "Login Failed" line below.  The office toolkit seems to be validly installed because it is not failing when the object is created.

Does anyone have any idea what I'm doing wrong?

Thanks in advance

 
<%@ Language="VBScript" %>
<%
dim g_sfApi
function login(username, password)
    set g_sfApi=Server.CreateObject("SForceOfficeToolkit3.SForceSession3.1")
    login=g_sfApi.Login(Username,Password)
end function
%>

<body>
<%
dim lr, sid, serverUrl, row, rc
dim qr' as QueryResultSet3
dim s' as SObject3
'lr = login(username, password1)
lr=login(username2,password2)
if not lr then
    Response.Write("Login Failed")
else
    set qr=g_sfApi.Query("select * from account",false)
 

...

Hi, a bit new to all of this,

 

I'm attempting to create a VisualForce page which literally writes a text file, with no HTML tags at all, for use with some legacy scripts we have in place that require this format.  This is eventually going to be filled with some information from an accounts record, but I'm testing without at the moment

 

<apex:page sidebar="false" showheader="false">
  <h1>Congratulations</h1>
</apex:page>

 

Unfortunately when viewed in a browser, this is adding the html around the outside

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  <html><head></head><h1>Congratulations</h1></html>

 

Is there any way in apex to suppress the automatic formatting with this html that gets added in?

 

Thanks in advance

I have some code on the Lead Trigger which filters the lead coming in, and if certain details are true about it, instead of adding the lead to the system it will instead create a custom object that I have defined.

 

Now my trouble is, whenever I add the "addError" command to the lead coming in, to suppress it being added, the "insert" on my custom object fails

If I remove the addError, the custom object is added, but the lead is also added.

 

I would really like the lead not to be inserted, but the custom object to be inserted.

 

Here's some cut down code which should show the case in question:

 

trigger LeadNew on Lead (before insert) {

    for (Lead l:Trigger.new)
    {

/* condition met test generated*/

        if (bConditionMet)
        {
            LeadTask__c leadTask=new LeadTask__c();

/* create the leadtask from info in the bad lead */

            insert leadTask;


/* comment out the line below and the lead and leadtask are both added

if they're not commented out, then neither are added

*/

         l.addError('Lead not created as a task was generated instead');
        }
    }

}

 

Any suggestions would be gratefully received.

 
I'm just looking at accessing the data on salesforce from our web site which is classic ASP,

The office toolkit has been installed on the web server, but whenever I try to make the login call, it returns false and does not create a valid session.

I have tried using two different username/password combinations, appending the security token to the end of the password and not, but whatever I do it gets to the "Login Failed" line below.  The office toolkit seems to be validly installed because it is not failing when the object is created.

Does anyone have any idea what I'm doing wrong?

Thanks in advance

 
<%@ Language="VBScript" %>
<%
dim g_sfApi
function login(username, password)
    set g_sfApi=Server.CreateObject("SForceOfficeToolkit3.SForceSession3.1")
    login=g_sfApi.Login(Username,Password)
end function
%>

<body>
<%
dim lr, sid, serverUrl, row, rc
dim qr' as QueryResultSet3
dim s' as SObject3
'lr = login(username, password1)
lr=login(username2,password2)
if not lr then
    Response.Write("Login Failed")
else
    set qr=g_sfApi.Query("select * from account",false)
 

...

Hi, a bit new to all of this,

 

I'm attempting to create a VisualForce page which literally writes a text file, with no HTML tags at all, for use with some legacy scripts we have in place that require this format.  This is eventually going to be filled with some information from an accounts record, but I'm testing without at the moment

 

<apex:page sidebar="false" showheader="false">
  <h1>Congratulations</h1>
</apex:page>

 

Unfortunately when viewed in a browser, this is adding the html around the outside

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  <html><head></head><h1>Congratulations</h1></html>

 

Is there any way in apex to suppress the automatic formatting with this html that gets added in?

 

Thanks in advance

Is there a simple recipe to make web service calls in the classic ASP environment using MS SOAP Toolkit 3.0?

I tried the following:

dim oSOAP
set oSOAP = Server.CreateObject("MSSOAP.SoapClient")
oSOAP.ClientProperty("ServerHTTPRequest") = True
oSOAP.mssoapinit("C:\sforce.wsdl.xml")

where sforce.wsdl.xml is the WSDL file generate by sforce and saved on the local box running classic ASP and MS SOAP Tollkit 3.0.

I receive the following result:

Error Type:
Client (0x80020009)
WSDLReader:Analyzing the WSDL file failed HRESULT=0x80004005
- WSDLReader:Initialization of service failed HRESULT=0x80004005
- WSDLService:Initialization of the port for service SforceService failed HRESULT=0x80004005
- WSDLPort:Analyzing the binding information for port Soap failed HRESULT=0x80004005
- WSDLPort:An operation for port Soap could not be initialized HRESULT=0x80004005
- WSDLOperation:Initializing of the input message failed for operation delete HRESULT=0x80004005
- WSDLOperation:Initialization of a SoapMapper for operation delete failed HRESULT=0x80004005
- SoapMapper:The SoapMapper for element ids could not be created HRESULT=0x80004005

My goal is to use sforce webservices without .NET using ASP.

Thank you for any suggestions.

-Chris.
  • December 01, 2004
  • Like
  • 0