• Olof-ISA
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
Hi
Could someone please have a look at the code below and tell me why I get this error when running the s-control:
        {faultcode:'soapenv:Client', faultstring:'Missing entity type information. sObject requires a separate 'type' field be sent.',}
The Establishment_Account__c is a lookup field to an account I created in the same process and the
EstAccId is the Id from the created result set. It is the update call that raises the error.
Thanks in advance!!!
/Olof


<script src="/soap/ajax/11.0/connection.js"
'
'
var OppUpdate = sforce.connection.query("Select Id, Type, Establishment_Account__c FROM Opportunity where ID='" + "{!Opportunity.Id}" + "'");
if (OppUpdate.classname == "SoapFault")
{
    alert("Error setting Link to newly created Establishment. Error: " + OppUpdate.toString());
}
else
 {
    if (OppUpdate.size > 0)
     {
          OppUpdate.Establishment_Account__c = EstAccId;
          sforce.connection.update([OppUpdate]);
      }
 }
'
'
'


Hi
I guess that this is a quite common and simple problem but I cant find any easy way out.
 
I'm trying to update an account with values from a description field on another object. Everything works just fin as loong as I dont use data that contains funny characters as "&", carriage returns and so on.  Tryign to update data with these values makes the script crash...
I'd be really greatfull if anyone have a solution to this!
 
Cheers!
 
/Olof
 
Script sample:
function UppdateAccount() {
var queryResult = sforceClient.Query("Select ID, Name, Description from Account where ID='" + s_AccID + "'");
if (queryResult.getClassName() == "SoapFault") {
alert(
"Error Updating Account: " + queryResult.toString());
}
else {
if (queryResult.size > 0)
{
if (queryResult.size > 0) {
var account = queryResult.records[0];
account.set("Description", s_ACText);
queryResult.records[0] = account;
var sr = sforceClient.Update(queryResult.records);
try {
if (sr.getClassName() == "SoapFault") {
alert(
"Error updating Account: " + sr.toString());
}
}
catch (e) {
if (sr[0].getClassName() == "SaveResult"){
return(true);
}
}
}
}
else
{
alert(
"Couldn't find account, not updated.");
}
}
}
Hi
I guess that this is a quite common and simple problem but I cant find any easy way out.
 
I'm trying to update an account with values from a description field on another object. Everything works just fin as loong as I dont use data that contains funny characters as "&", carriage returns and so on.  Tryign to update data with these values makes the script crash...
I'd be really greatfull if anyone have a solution to this!
 
Cheers!
 
/Olof
 
Script sample:
function UppdateAccount() {
var queryResult = sforceClient.Query("Select ID, Name, Description from Account where ID='" + s_AccID + "'");
if (queryResult.getClassName() == "SoapFault") {
alert(
"Error Updating Account: " + queryResult.toString());
}
else {
if (queryResult.size > 0)
{
if (queryResult.size > 0) {
var account = queryResult.records[0];
account.set("Description", s_ACText);
queryResult.records[0] = account;
var sr = sforceClient.Update(queryResult.records);
try {
if (sr.getClassName() == "SoapFault") {
alert(
"Error updating Account: " + sr.toString());
}
}
catch (e) {
if (sr[0].getClassName() == "SaveResult"){
return(true);
}
}
}
}
else
{
alert(
"Couldn't find account, not updated.");
}
}
}