-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
9Questions
-
13Replies
Using S-Control to update the ParentID of a Note
<html>
<head>
<title>Transfer Notes</title>
<script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js?browser=true" type="text/javascript"></script>
<script type="text/javascript" language="JavaScript">
function initPage()
{
sforceClient.registerInitCallback(queryNote);
sforceClient.init("{!API.Session_ID}", "{!API.Partner_Server_URL_70}",true);
window.setTimeout(";", 1000);
}
function queryNote() {
aResp = confirm("Are you sure you want to transfer the Notes?")
if (aResp == true) {
sforceClient.getDebugLog();
sforceClient.debuglog.show();
sforceClient.debuglog.writeln("serialnum id: {!WEFSN__c.Id}");
var qryStr = "Select Id,Title,ParentId From Note where ParentId = '{!WEFSN__c.Id}' ";
sforceClient.debuglog.writeln("qryStr: " + qryStr);
} //end function queryNote
function xferNote(queryResult)
{
//var qrySN = "select Id,Name from WEFSN__c where Name = '{!WEFSN__c.Name}' "
var qrySN = "select Id,Name from WEFSN__c where Name = '08111' "
var queryResultSN = sforceClient.query(qrySN);
sforceClient.debuglog.writeln(queryResultSN.toString());
var dynaBean = queryResultSN.records[0];
var SNId = dynaBean.get("Id") ;
sforceClient.debuglog.writeln("SNId:" + SNId);
var dynaBean = queryResult.records[i];
var NoteId = dynaBean.get("Id") ;
sforceClient.debuglog.writeln("NoteId:" + NoteId);
recObject.set("Id",NoteId);
recObject.set("ParentId",SNId);
recObject.set("Title","test title");
var updateResult = sforceClient.Update([recObject]);
sforceClient.debuglog.writeln(updateResult.toString());
sforceClient.debuglog.writeln("record obj:" + recObject.toString());
} // end for loop
} // end function xferNote
</script>
</head>
<body onload="initPage();">
</html>
- MSchumacher
- June 03, 2008
- Like
- 0
- Continue reading or reply
vbscript - sforcetoolkit - update a custom object help
binding.SessionId = sSessionId
binding.SetServerUrl(sServerUrl)
sobj.Item("Id").value = "a0440000006d1DM"
sobj.Item("Item_Number__c").value = "MIKE"
sobj.Update
- MSchumacher
- April 13, 2007
- Like
- 0
- Continue reading or reply
get error javax.email.nosuchproviderexception: smtp when sending email from a java app
Properties props = System.getProperties();
props.put("mail.smtp.host", "mail.idcnet.com");
props.put("mail.smtp.port", "25");
props.put("mail.transport.protocol","smtp");
Session session = Session.getInstance(props, null);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to));
msg.setSentDate(new Date());
msg.setSubject(subject);
MimeMultipart mimeMultipart = new MimeMultipart();
// Add the Text Body Content to the Multipart
MimeBodyPart text=new MimeBodyPart();
text.setContent(body,"text/plain");
// Add the Body Content to the MultiPart Mime
mimeMultipart.addBodyPart(text);
//Add the Image Content to the Multipart
MimeBodyPart mimeBodyPart = new MimeBodyPart();
File file = new File (DSRptFile);
FileDataSource fds = new FileDataSource(file);
DataHandler dh = new DataHandler(fds);
mimeBodyPart.setFileName(file.getName());
mimeBodyPart.setDisposition(Part.ATTACHMENT);
mimeBodyPart.setDescription("Attached file: " + file.getName());
mimeBodyPart.setDataHandler(dh);
// Add the Image Content to the MultiPart
mimeMultipart.addBodyPart(mimeBodyPart);
// Add the whole Multipart into the Message
msg.setContent(mimeMultipart);
Transport.send(msg);
}catch(Exception e){
System.out.println("sendEmail()"+ e.toString());
}
I am now using the version 7 API and I noticed that the activation.jar and mailapi.jar were included in the libraries. I have them in my project but receive the error below. Any suggestions?
javax.mail.NoSuchProviderException: smtp
at javax.mail.Session.getService(Session.java:750)
at javax.mail.Session.getTransport(Session.java:689)
at javax.mail.Session.getTransport(Session.java:632)
at javax.mail.Session.getTransport(Session.java:612)
at javax.mail.Session.getTransport(Session.java:667)
at javax.mail.Transport.send0(Transport.java:154)
at javax.mail.Transport.send(Transport.java:80)
- MSchumacher
- February 01, 2007
- Like
- 0
- Continue reading or reply
Using compression with Java
Call call = super.createCall();
call.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
call.setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
return call;
}
}
lr = binding2.login(userName, pwd);
Destination URL not reset. The URL returned from login must be set in the SforceService
.getSoap();
lr = binding.login(userName, pwd);
lr.getServerUrl());
- MSchumacher
- November 15, 2006
- Like
- 0
- Continue reading or reply
java.lang.IllegalAccessError
When I use the Eclipse workbench and run my java application, I can log in to Salesforce.com, query records and update the records.
When I attempt to execute my java application at the DOS prompt, I receive the following:
Exception in thread "main" java.lang.IllegalAccessError: tried to access field c
om.sforce.soap.enterprise.QueryResult.records from class com.weiler.UpdateFrontE
ndTest.UpdateFrontEndTest
at com.weiler.UpdateFrontEndTest.UpdateFrontEndTest.VerifyAccount(Update
FrontEndTest.java:184)
at com.weiler.UpdateFrontEndTest.UpdateFrontEndTest.<init>(UpdateFrontEn
dTest.java:92)
at com.weiler.UpdateFrontEndTest.UpdateFrontEndTest.main(UpdateFrontEndT
est.java:73)
I am using Eclipse 3.0.1. My java environment is - java version "1.4.2_04".
I noticed that when I create a new java project in Eclipse and I add the com.sforce.soap.enterprise package, to compile my application, I have to change the QueryResult.java to public.
The line that Eclipse is forcing me to change from private to public is:
public com.sforce.soap.enterprise.sobject.SObject[] records;
Any ideas is appreciated.
Thanks
Mike Schumacher
- MSchumacher
- July 18, 2005
- Like
- 0
- Continue reading or reply
java.lang.NullPointerException during login (remoteexception)
I use the Eclipse deveopment environment and was testing a small java app to update a field in the Account object. In the Eclipse enviornment the login is successful and the update to the Account object works.
I tried to run the app from a dos window using 'java' and I receive the message:
; nested exception is:
java.lang.NullPointerException
I checked my classpath and the paths looked ok. I went back and tried the quickstart.class and it is now happening to quickstart as well. The exception that is being processed is the RemoteException.
The login code is the code from the quickstart sample. The login code is below.
private void doLogin() {
if (userName.length() == 0 || pwd.length() == 0)
return;
else {
try {
binding = (SoapBindingStub) new SforceServiceLocator()
.getSoap();
} catch (ServiceException ex1) {
System.out.println(ex1.getMessage());
return;
}
try {
lr = binding.login(userName, pwd);
} catch (UnexpectedErrorFault ex2) {
System.out.println(ex2.getExceptionMessage() + "\nUnexpected\n");
return;
} catch (LoginFault ex2) {
System.out.println(ex2.getExceptionMessage() + "\nloginfault\n");
return;
} catch (RemoteException ex2) {
System.out.println(ex2.getMessage() + "\nremote\n");
return;
}
System.out.println("Login was successfull.");
System.out.print("The returned session id is: ");
System.out.println(lr.getSessionId());
System.out.print("Your logged in user id is: ");
System.out.println(lr.getUserId() + " \n\n");
//on a successful login, you should always set up your session id
//and the url for subsequent calls
//reset the url endpoint property, this will cause subsequent calls
//to made to the serverURL from the login result
binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,
lr.getServerUrl());
//create a session head object
_SessionHeader sh = new _SessionHeader();
//set the sessionId property on the header object using
//the value from the login result
sh.setSessionId(lr.getSessionId());
//add the header to the binding stub
String sforceURI = new SforceServiceLocator().getServiceName().getNamespaceURI();
binding.setHeader(sforceURI, "SessionHeader", sh);
return;
}
}
I thought maybe recompiling in the DOS window would work so I used 'javac' to recompile and still received the error.
What I don't understand is why the app runs correctly through the Eclipse environment but not in the DOS windows.
Any ideas?
Thanks.
- MSchumacher
- July 15, 2005
- Like
- 0
- Continue reading or reply
Mass delete custom objects
I am testing a number of insert routines for a custom object using the APIs. I noticed in the salesforce.com setup area, there does not appear to be a way to mass delete rows in a custom object.
Is there a recommended way to mass delete rows from a custom object? I have been unable to find the right message in the various posts.
I want to delete the rows I added so I can retest as needed. Do I need to create a separate program to select the rows by create date and delete each one.
Thanks
Mike Schumacher
- MSchumacher
- May 19, 2005
- Like
- 0
- Continue reading or reply
Compiling the file samples.java
I was able to compile Samples.java but when I execute it using java com.salesforce.samples.Samples, I receive the following errors.
I selected option 1 to logon and entered the username and password.
Enter the number of the sample to run: 1
Enter user name: cio@weilerinc.com
Enter password: *******
Creating the binding to the web service...
- Unable to find required classes (javax.activation.DataHandler and javax.mail.i
nternet.MimeMultipart). Attachment support is disabled.
Exception in thread "main" java.lang.NoSuchFieldError: WRAPPED
at com.sforce.soap.enterprise.SoapBindingStub.(SoapBindingStub.j
ava:28)
at com.sforce.soap.enterprise.SforceServiceLocator.getSoap(SforceService
Locator.java:45)
at com.sforce.soap.enterprise.SforceServiceLocator.getSoap(SforceService
Locator.java:40)
at com.salesforce.samples.Samples.login(samples.java:128)
at com.salesforce.samples.Samples.run(samples.java:1742)
at com.salesforce.samples.Samples.main(samples.java:85)
My classpath is as follows.
set
CLASSPATH=.;d:\temp\salesforce\axis\lib\axis.jar;d:\temp\salesforce\axis\lib\axis-ant.jar;d:\temp\salesforce\axis\lib\commons-discovery.jar;d:\temp\salesforce\axis\lib\commons-logging.jar;d:\temp\salesforce\axis\lib\jaxrpc.jar;d:\temp\salesforce\axis\lib\log4j1.2.8.jar;d:\temp\salesforce\axis\lib\saaj.jar;d:\temp\salesforce\axis\lib\wsdl4j.jar;D:\Temp\Salesforce\bin
I would appreciate some assistance.
Thanks
Mike Schumacher
- MSchumacher
- May 02, 2005
- Like
- 0
- Continue reading or reply
Compiling quickstart
I just installed the quickstart and compiled my enterprise wsld. I was able to run quickstart and login and get the accounts.
I wanted to try compiling quickstart but have been unsuccesful. My classpath is:
set CLASSPATH=.;d:\temp\salesforce\quickstart.jar;d:\temp\salesforce\axis\lib\axis.jar;d:\temp\salesforce\axis\lib\axis-ant.jar;d:\temp\salesforce\axis\lib\commons-discovery.jar;d:\temp\salesforce\axis\lib\commons-logging.jar;d:\temp\salesforce\axis\lib\jaxrpc.jar;d:\temp\salesforce\axis\lib\log4j-1.2.8.jar;d:\temp\salesforce\axis\lib\saaj.jar;d:\temp\salesforce\axis\lib\wsdl4j.jar;D:\Temp\Salesforce\com\sforce\soap\enterprise\sobject
when I issue the command: "javac quickstart.java ", I receive pages of errors. They are all similar to the following:
**********************************************************************
^
.\com\sforce\soap\enterprise\Field.java:684: cannot resolve symbol
symbol : method setNillable (boolean)
location: class org.apache.axis.description.ElementDesc
elemField.setNillable(true);
^
.\com\sforce\soap\enterprise\DescribeLayout.java:166: cannot resolve symbol
symbol : constructor TypeDesc (java.lang.Class,boolean)
location: class org.apache.axis.description.TypeDesc
new org.apache.axis.description.TypeDesc(DescribeLayout.class, true);
^
.\com\sforce\soap\enterprise\RecordTypeMapping.java:229: cannot resolve symbol
symbol : constructor TypeDesc (java.lang.Class,boolean)
location: class org.apache.axis.description.TypeDesc
new org.apache.axis.description.TypeDesc(RecordTypeMapping.class, true);
^
.\com\sforce\soap\enterprise\RecordTypeMapping.java:258: cannot resolve symbol
symbol : method setNillable (boolean)
location: class org.apache.axis.description.ElementDesc
elemField.setNillable(true);
**********************************************************************
I am extremely out of my element here but need any assistance that can be provided.
Thanks.
- MSchumacher
- April 21, 2005
- Like
- 0
- Continue reading or reply
Using S-Control to update the ParentID of a Note
<html>
<head>
<title>Transfer Notes</title>
<script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js?browser=true" type="text/javascript"></script>
<script type="text/javascript" language="JavaScript">
function initPage()
{
sforceClient.registerInitCallback(queryNote);
sforceClient.init("{!API.Session_ID}", "{!API.Partner_Server_URL_70}",true);
window.setTimeout(";", 1000);
}
function queryNote() {
aResp = confirm("Are you sure you want to transfer the Notes?")
if (aResp == true) {
sforceClient.getDebugLog();
sforceClient.debuglog.show();
sforceClient.debuglog.writeln("serialnum id: {!WEFSN__c.Id}");
var qryStr = "Select Id,Title,ParentId From Note where ParentId = '{!WEFSN__c.Id}' ";
sforceClient.debuglog.writeln("qryStr: " + qryStr);
} //end function queryNote
function xferNote(queryResult)
{
//var qrySN = "select Id,Name from WEFSN__c where Name = '{!WEFSN__c.Name}' "
var qrySN = "select Id,Name from WEFSN__c where Name = '08111' "
var queryResultSN = sforceClient.query(qrySN);
sforceClient.debuglog.writeln(queryResultSN.toString());
var dynaBean = queryResultSN.records[0];
var SNId = dynaBean.get("Id") ;
sforceClient.debuglog.writeln("SNId:" + SNId);
var dynaBean = queryResult.records[i];
var NoteId = dynaBean.get("Id") ;
sforceClient.debuglog.writeln("NoteId:" + NoteId);
recObject.set("Id",NoteId);
recObject.set("ParentId",SNId);
recObject.set("Title","test title");
var updateResult = sforceClient.Update([recObject]);
sforceClient.debuglog.writeln(updateResult.toString());
sforceClient.debuglog.writeln("record obj:" + recObject.toString());
} // end for loop
} // end function xferNote
</script>
</head>
<body onload="initPage();">
</html>
- MSchumacher
- June 03, 2008
- Like
- 0
- Continue reading or reply
vbscript - sforcetoolkit - update a custom object help
binding.SessionId = sSessionId
binding.SetServerUrl(sServerUrl)
sobj.Item("Id").value = "a0440000006d1DM"
sobj.Item("Item_Number__c").value = "MIKE"
sobj.Update
- MSchumacher
- April 13, 2007
- Like
- 0
- Continue reading or reply
Using compression with Java
Call call = super.createCall();
call.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
call.setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
return call;
}
}
lr = binding2.login(userName, pwd);
Destination URL not reset. The URL returned from login must be set in the SforceService
.getSoap();
lr = binding.login(userName, pwd);
lr.getServerUrl());
- MSchumacher
- November 15, 2006
- Like
- 0
- Continue reading or reply
java.lang.IllegalAccessError
When I use the Eclipse workbench and run my java application, I can log in to Salesforce.com, query records and update the records.
When I attempt to execute my java application at the DOS prompt, I receive the following:
Exception in thread "main" java.lang.IllegalAccessError: tried to access field c
om.sforce.soap.enterprise.QueryResult.records from class com.weiler.UpdateFrontE
ndTest.UpdateFrontEndTest
at com.weiler.UpdateFrontEndTest.UpdateFrontEndTest.VerifyAccount(Update
FrontEndTest.java:184)
at com.weiler.UpdateFrontEndTest.UpdateFrontEndTest.<init>(UpdateFrontEn
dTest.java:92)
at com.weiler.UpdateFrontEndTest.UpdateFrontEndTest.main(UpdateFrontEndT
est.java:73)
I am using Eclipse 3.0.1. My java environment is - java version "1.4.2_04".
I noticed that when I create a new java project in Eclipse and I add the com.sforce.soap.enterprise package, to compile my application, I have to change the QueryResult.java to public.
The line that Eclipse is forcing me to change from private to public is:
public com.sforce.soap.enterprise.sobject.SObject[] records;
Any ideas is appreciated.
Thanks
Mike Schumacher
- MSchumacher
- July 18, 2005
- Like
- 0
- Continue reading or reply
java.lang.NullPointerException during login (remoteexception)
I use the Eclipse deveopment environment and was testing a small java app to update a field in the Account object. In the Eclipse enviornment the login is successful and the update to the Account object works.
I tried to run the app from a dos window using 'java' and I receive the message:
; nested exception is:
java.lang.NullPointerException
I checked my classpath and the paths looked ok. I went back and tried the quickstart.class and it is now happening to quickstart as well. The exception that is being processed is the RemoteException.
The login code is the code from the quickstart sample. The login code is below.
private void doLogin() {
if (userName.length() == 0 || pwd.length() == 0)
return;
else {
try {
binding = (SoapBindingStub) new SforceServiceLocator()
.getSoap();
} catch (ServiceException ex1) {
System.out.println(ex1.getMessage());
return;
}
try {
lr = binding.login(userName, pwd);
} catch (UnexpectedErrorFault ex2) {
System.out.println(ex2.getExceptionMessage() + "\nUnexpected\n");
return;
} catch (LoginFault ex2) {
System.out.println(ex2.getExceptionMessage() + "\nloginfault\n");
return;
} catch (RemoteException ex2) {
System.out.println(ex2.getMessage() + "\nremote\n");
return;
}
System.out.println("Login was successfull.");
System.out.print("The returned session id is: ");
System.out.println(lr.getSessionId());
System.out.print("Your logged in user id is: ");
System.out.println(lr.getUserId() + " \n\n");
//on a successful login, you should always set up your session id
//and the url for subsequent calls
//reset the url endpoint property, this will cause subsequent calls
//to made to the serverURL from the login result
binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,
lr.getServerUrl());
//create a session head object
_SessionHeader sh = new _SessionHeader();
//set the sessionId property on the header object using
//the value from the login result
sh.setSessionId(lr.getSessionId());
//add the header to the binding stub
String sforceURI = new SforceServiceLocator().getServiceName().getNamespaceURI();
binding.setHeader(sforceURI, "SessionHeader", sh);
return;
}
}
I thought maybe recompiling in the DOS window would work so I used 'javac' to recompile and still received the error.
What I don't understand is why the app runs correctly through the Eclipse environment but not in the DOS windows.
Any ideas?
Thanks.
- MSchumacher
- July 15, 2005
- Like
- 0
- Continue reading or reply
Mass delete custom objects
I am testing a number of insert routines for a custom object using the APIs. I noticed in the salesforce.com setup area, there does not appear to be a way to mass delete rows in a custom object.
Is there a recommended way to mass delete rows from a custom object? I have been unable to find the right message in the various posts.
I want to delete the rows I added so I can retest as needed. Do I need to create a separate program to select the rows by create date and delete each one.
Thanks
Mike Schumacher
- MSchumacher
- May 19, 2005
- Like
- 0
- Continue reading or reply
Compiling quickstart
I just installed the quickstart and compiled my enterprise wsld. I was able to run quickstart and login and get the accounts.
I wanted to try compiling quickstart but have been unsuccesful. My classpath is:
set CLASSPATH=.;d:\temp\salesforce\quickstart.jar;d:\temp\salesforce\axis\lib\axis.jar;d:\temp\salesforce\axis\lib\axis-ant.jar;d:\temp\salesforce\axis\lib\commons-discovery.jar;d:\temp\salesforce\axis\lib\commons-logging.jar;d:\temp\salesforce\axis\lib\jaxrpc.jar;d:\temp\salesforce\axis\lib\log4j-1.2.8.jar;d:\temp\salesforce\axis\lib\saaj.jar;d:\temp\salesforce\axis\lib\wsdl4j.jar;D:\Temp\Salesforce\com\sforce\soap\enterprise\sobject
when I issue the command: "javac quickstart.java ", I receive pages of errors. They are all similar to the following:
**********************************************************************
^
.\com\sforce\soap\enterprise\Field.java:684: cannot resolve symbol
symbol : method setNillable (boolean)
location: class org.apache.axis.description.ElementDesc
elemField.setNillable(true);
^
.\com\sforce\soap\enterprise\DescribeLayout.java:166: cannot resolve symbol
symbol : constructor TypeDesc (java.lang.Class,boolean)
location: class org.apache.axis.description.TypeDesc
new org.apache.axis.description.TypeDesc(DescribeLayout.class, true);
^
.\com\sforce\soap\enterprise\RecordTypeMapping.java:229: cannot resolve symbol
symbol : constructor TypeDesc (java.lang.Class,boolean)
location: class org.apache.axis.description.TypeDesc
new org.apache.axis.description.TypeDesc(RecordTypeMapping.class, true);
^
.\com\sforce\soap\enterprise\RecordTypeMapping.java:258: cannot resolve symbol
symbol : method setNillable (boolean)
location: class org.apache.axis.description.ElementDesc
elemField.setNillable(true);
**********************************************************************
I am extremely out of my element here but need any assistance that can be provided.
Thanks.
- MSchumacher
- April 21, 2005
- Like
- 0
- Continue reading or reply