function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ElenaCaptaElenaCapta 

problems with code, help!!

Hi, Anybody Know what is the proble in this code?? I'm new in SalesForce and don't get anything...
Please help me!!!
 
The code is:
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Crear Una Cuenta</title>
</head>
<body >
<script language="javascript" src="https://www.sforce.com/ajax/beta1/sforceclient.js" type="text/javascript"></script>
<script language="javascript">
 
Account objMyaccount = new Account();
objMyaccount.setName("Koka Kola"); 
objMyaccount.setWebsite("www.kokakola.com");
 
sObject[] records = new sObject[] {objMyaccount };  
SaveResult[] saveResults = sfdc.create(records);
String newID = saveResults[0].id;
if (saveResults[0].getSuccess())
          {
           // No errors, so we will retrieve the id created for this index
           System.out.println("Attachment with id " + saveResults[0].getId());
          }
        else
          {
            System.out.println("Error during creation of attachment " + saveResults[0].getErrors());
          }
</body>
</html>
 
Thanks!!!!
DevAngelDevAngel
This looks like a mad scientists version of trying to mix java and javascript.

Not possible to parse.
ElenaCaptaElenaCapta

Thank you!!:smileyhappy:

Elena

Rick.BanisterRick.Banister
At a minimum, change

    System.out.println("Error during creation of attachment " + saveResults[0].getErrors());

to

   alert("Error during creation of attachment " + saveResults[0].getErrors());