• IZavalun
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 25
    Replies
If I want to mimic the existing custom object is there a fast way to do it?
Please help me to figure out what is the syntax to make the new line in the messageBody field of the "Send an Email" form ==> \n\r doestn't work
=================================================
 
var messageBody = " Dear {!IS_TSR__c.TSR_Recipient_1__c}, On {!IS_TSR__c.Service_Date__c} our Technical Representative, {!IS_TSR__c.CreatedBy}, performed services on the following band saw machine"

I am trying to  escape Carriage return character, but it doesn't work for me.

Please tell me what I am doing wrong here?

 

==============================================

 

_tmp_street=qrdr.records[i].BillingStreet;
_street=_tmp_street.replace(/([\'\&\|\!\(\)\{\}\[\]\^~\:\\\+\-])/g, " ");
alert(_street);

Please help me to figure out how to get value for checked radio, I am getting message:syntax error
========================================================
 
<html>
<head>
<script language="javascript" src="/soap/ajax/9.0/connection.js"></script>
<script language="javascript">
<!--
function do_code() {
r1=document.getElementById("radio").elements[0].value;
r2=document.getElementById("radio").elements[1].value;
alert(r1);
alert(r2);

}
//-->
</script>

<table border="0" width="100%">
<tr>
<td align="center">Primary Distributor<input id="radio" name="radio" type="radio" value="pd"  /> </td>
<td>Secondary Distributor<input id="radio" name="radio" type="radio" value="sd" /> </td>
</tr>
<hr>
<tr>
 <td>
    <input type="button" name="btnSearch" value="Search" id="btnSearch" onclick="do_code()">
 </td>
</tr>
</table>
</html>
</body>
I am trying to update the custom lookup field 'Primary_Distributor_c' in Account object and first of all my '_id' is null but when I run the query I have always 1 record back with Id
 
If you will see my problem here please support.
 
Here is my code:
 
==============================================
function pd_update(_name){
alert("Got Here '"+_name+"'");
var qrdr = sforce.connection.query("select Id from Account where RecordTypeId='012600000004w6TAAQ' and Name = '"+_name + "'");
var records = qrdr.getArray("records");
alert("Found " + records.length + " Records...");
if (records.length > 0){
        _id=qrdr.records[0].Id;
 }
if (_id) {
  var _IsMatch = new sforce.SObject("Account");
  _IsMatch.Id = _id;
  _IsMatch.Primary_Distributor__c = _name;
   
  var updateIsMatch = sforce.connection.update([_IsMatch]); //actually perform update
  if (updateIsMatch[0].getBoolean("success")) { //if successful update of existing record
   alert("PD Successfully updated!"); //indicate that the update was successful
     } else {
   alert("Error:\n"+updateIsMatch[0]); //display the error
  }
 }
}
Please look at the 2 lines bellow and help me to understand why:
 
- value of the _name in first line = "Brett's Industrial Account"
- value of the _name in the second line = "Brett"
 
How to fix this one?
I will really appriciate your help.
 
============================================================
alert(_name);
output = "<input id=btn1 type=button name=btn1 onclick=\"" + fn + "\" value='" + _name + "'>";

I am programmatically creating the event and open it in the ‘EDIT’ view.

Since the event is already created the “CANCEL” button not going to delete it..

Can I write the S-Control that will work with the “CANCEL” button in the “EDIT” view?

If not then what would be the best approach?

Hello - Please help to fix my syntax problem here to pass the parametr, I need to get the contact in function cm(contact)...
Please see in red:
==============================================
 
<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script src="Link: " type="text/javascript"></script>
<script language="javascript">
var fn = "cm(this)";
function do_code()
{
//////////////////////////////////////
var cust_name =  '{!Account.Name}';
var qrdr5 = sforce.connection.query("Select c.Id from Account c  where c.Name= '" + cust_name + "'");
var records = qrdr5.getArray("records");
for (var x = 0; x < records.length; x++)
{
tt5 = records[x];
var ttt = tt5.get("Id");
}
/////////////////////////////////////
var qrdr2 = sforce.connection.query("Select Name from Contact c  where AccountId= '" + ttt + "'order by createdDate");
var records = qrdr2.getArray("records");
document.write("<b><u>Please Select Customer Contact:</u></b><BR><BR>");
document.write("<HR>");
for (var y = 0; y < records.length; y++)
{
tt2 = records[y];
var t=tt2.get("Name");
document.write("<BR>");
output = "<input id=btn1 type=button name=btn1 onclick=cm(obj); value='" + t + "'>";
document.write(output);
document.write("<BR>");
}
document.write("<BR>");
document.write("<HR>");
}
////////////////////////////////////
function cm(contact) {
  alert(contact);
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Customer Contacts...</title>
</head>
<body onLoad="do_code();">
</body>
</html>
Hello - Please help to fix my syntax problem here, I need to get the contact in function cm(contact)...
Please see in red:
==============================================
 
<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>
<script language="javascript">
var fn = "cm(this)";
function do_code()
{
//////////////////////////////////////
var cust_name =  '{!Account.Name}';
var qrdr5 = sforce.connection.query("Select c.Id from Account c  where c.Name= '" + cust_name + "'");
var records = qrdr5.getArray("records");
for (var x = 0; x < records.length; x++)
{
tt5 = records[x];
var ttt = tt5.get("Id");
}
/////////////////////////////////////
var qrdr2 = sforce.connection.query("Select Name from Contact c  where AccountId= '" + ttt + "'order by createdDate");
var records = qrdr2.getArray("records");
document.write("<b><u>Please Select Customer Contact:</u></b><BR><BR>");
document.write("<HR>");
for (var y = 0; y < records.length; y++)
{
tt2 = records[y];
var t=tt2.get("Name");
document.write("<BR>");
output = "<input id=btn1 type=button name=btn1 onclick=cm(obj); value='" + t + "'>";
document.write(output);
document.write("<BR>");
}
document.write("<BR>");
document.write("<HR>");
}
////////////////////////////////////
function cm(contact) {
  alert(contact);
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Customer Contacts...</title>
</head>
<body onLoad="do_code();">
</body>
</html>

Please help…

Instead of coming to this url ‘/a0F60000000HbP0’ I am coming to the home page.

Please let me know how I need to modify my s-control .

 

Here is the code:

 

 

var o = new sforce.SObject('WS__c');

o.set('Svc__c', _owner);

o.set('Welder__c', _num_id);

o.set('Dist__c', _dis_id);

o.set('City__c', _city);

o.set('State__c', _state);

o.set('WMake__c', _make);

o.set('WldMd__c', _model);

var results = sforce.connection.create([o]);

var locationString = '/' + results[0].id + '/e';

window.parent.parent.location.href = locationString;

I would really appreciate if somebody can point me to some samples or show me  how to create S-Control for Google Maps based on following object from SalesForce.com:

 

Account  è select any field from Account

Contact   è select any field from Contact
I am getting error:
 
Unable to access page.
Information needed by the page you have attempted to access is incorrect. If you believe this is an error, please refresh your screen. If the error persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information
.
 
When running this:
//////////////////////////////////////////////////////////////////////////////////////////////
var locationString ='/a01/e?nooverride=1&CF00N60000001MadM';
locationString += '&CF00N60000001Mtkg=' + _lenox_tech_rep;
locationString += '&00N60000001NEeU=' + _num;
locationString += '&CF00N60000001LfoI=' + _num;
locationString += '&CF00N60000001LfoI_lkid=' + _num;
locationString += '&00N60000001LoPq=' + _machine_make;
locationString += '&00N60000001LoQ5=' + _orientation;
locationString += '&00N60000001McdE=' + _location;
locationString += '&00N60000001LoPv=' + _model;
locationString += '&00N60000001LoQ7=' + _bfeet;
locationString += '&00N60000001LoQG=' + _bwidth;
locationString += '&00N60000001LoQ8=' + _btooth;
locationString += '&00N60000001LoQF=' + _binches;
locationString += '&00N60000001LoPr=' + _bgauge;
locationString += '&CF00N60000001LoQe=' + _customer_name;
locationString += '&00N60000001LoPl=' + _serial_number ;
locationString += '&CF00N60000001MccV=' +  _dis_name;
locationString += '&CF00N60000001MccV_lkid=' +  _dis_name;
locationString += '&CF00N60000001Mcca=' + _dis_sp_name;
locationString += '&CF00N60000001Mcca_lkid=' + _dis_sp_name;
locationString += '&CF00N60000001MzwZ=' + _s_dis_name;
locationString += '&CF00N60000001MzwZ_lkid=' + _s_dis_name;
locationString += '&CF00N60000001Mzxc=' + _s_dis_sp_name;
locationString += '&CF00N60000001Mzxc_lkid=' + _s_dis_sp_name;
locationString += '&00N60000001N9JM=' + _dis_loc;
locationString += '&00N60000001N9JR=' + _s_dis_loc;
locationString += '&CF00N60000001Mcd7=' + _lxsp;
window.parent.parent.location.href = locationString;
 
 
Please Help....
I am getting the error "object expected" on line in red. What I have to do to fix it?
 
====================================================
<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>
<script language="javascript">
function do_code()
{
sforceClient.init("{!API.Session_ID}", "{!API.Partner_Server_URL_70}", false);
var accountid = "{!TH_Distributor_Recap__c.DistributorId__c}";
var thdist = "{!TH_Distributor_Recap__c.Id}";
var qrdr = sforce.connection.query("Select BillingStreet, BillingCity, BillingState, Distributor_Type__c from Account where id = '" + accountid + "'");        
var records = qrdr.getArray("records");
alert(records.length);
alert(thdist);
for (var i = 0; i < records.length; i++)
{
tt = records[i];
var BillingStreet=tt.get("BillingStreet");
var BillingCity = tt.get("BillingCity");
var BillingState= tt.get("BillingState");
var Distributor_Type__c= tt.get("Distributor_Type__c");
}
alert(BillingStreet);
alert(BillingCity);
alert(BillingState);
alert(Distributor_Type__c);
///////////////////// update item//////////////////////////////////////////////
var thUpdate = new Array();
alert("1 - So far so good");
var thObject = new sforce.DynaBean("TH_Distributor_Recap__c");
alert("2 - So far so good");
thObject.set("Id", thdist);
thObject.set("Distributor_Address__c", BillingStreet);
thObject.set("Distributor_City__c", BillingCity);
thObject.set("Distributor_State__c", BillingState);
thObject.set("Distributor_Type__c", Distributor_Type__c);
thUpdate.push(thObject);
var update = sforceClient.Update(thUpdate);
parent.location.href = "{!TH_Distributor_Recap__c.Link}";
//////////////////////////////////////////////////////////////////////////////////////////
}

</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body onLoad="do_code();">
</body>
</html>
Please Help....
I am getting the error "object expected" on line in red. What I have to do to fix it?
 
====================================================
<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>
<script language="javascript">
function do_code()
{
sforceClient.init("{!API.Session_ID}", "{!API.Partner_Server_URL_70}", false);
var accountid = "{!TH_Distributor_Recap__c.DistributorId__c}";
var thdist = "{!TH_Distributor_Recap__c.Id}";
var qrdr = sforce.connection.query("Select BillingStreet, BillingCity, BillingState, Distributor_Type__c from Account where id = '" + accountid + "'");        
var records = qrdr.getArray("records");
alert(records.length);
alert(thdist);
for (var i = 0; i < records.length; i++)
{
tt = records[i];
var BillingStreet=tt.get("BillingStreet");
var BillingCity = tt.get("BillingCity");
var BillingState= tt.get("BillingState");
var Distributor_Type__c= tt.get("Distributor_Type__c");
}
alert(BillingStreet);
alert(BillingCity);
alert(BillingState);
alert(Distributor_Type__c);
///////////////////// update item//////////////////////////////////////////////
var thUpdate = new Array();
alert("1 - So far so good");
var thObject = new sforce.DynaBean("TH_Distributor_Recap__c");
alert("2 - So far so good");
thObject.set("Id", thdist);
thObject.set("Distributor_Address__c", BillingStreet);
thObject.set("Distributor_City__c", BillingCity);
thObject.set("Distributor_State__c", BillingState);
thObject.set("Distributor_Type__c", Distributor_Type__c);
thUpdate.push(thObject);
var update = sforceClient.Update(thUpdate);
parent.location.href = "{!TH_Distributor_Recap__c.Link}";
//////////////////////////////////////////////////////////////////////////////////////////
}

</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body onLoad="do_code();">
</body>
</html>
Please help...
Here is the way I am passing tha values to the function and it's working:
=========================
onclick=\"cm(this,'" + _feedSystem + "','" + _orientation + "','" + _feet + "','" + _inches + "','" + _bladeWidth + "','" + _bladeGauge + "');\" value='" + _name + "'>"
==========================
The problem is when the function is trying to set the values to the url...
  _f.value is undefined
  _o.value is undefined
  _f2.value  is undefined 
  _i.value  is undefined
  _b.value is undefined
  _b2.value  is undefined
================================
document.write("function cm(obj, _f,_o,_f2,_i,_b,_b2) {");
document.write("var locationString = '/a0L/e?nooverride=1&CF00N60000001MadM=' + obj.value + customer+ '&00N60000001LfXC=' + _f.value + '&00N60000001LfX7=' + _o.value + '&00N60000001LfXI=' + _f2.value + '&00N60000001LfXM=' + _i.value + '&00N60000001LfWu=' + _b.value + '&00N60000001LfWj=' + _b2.value;");
=====================================
PLEASE HELP...
I have custom object in SalesForce.com 'TH_Revenue_Totals__c' with 2 currency fields ''Sell_In_Total__c' and 'Sell_Through_Total__c'.
 
When using upsert I am casting the string values to Double but it's always 0 in my custom object.
PLEASE HELP....
----------------------------------------------------------------

Private Sub UpsertToSalesForce(ByVal OwnerId As String, _

ByVal Sell_In_Total__c As String, _

ByVal Sell_Through_Total__c As String, _

ByVal Sell_In_Goal__c As String, _

ByVal Sell_Through_Goal__c As String, _

ByVal strExternalID__c As String)

 

Dim sforce As New sforce.SforceService

Dim ur As sforce.UpsertResult()

Dim recordsToUpdate As sforce.sObject()

Dim aryList As System.Collections.ArrayList

aryList = New ArrayList()

Dim i As Integer

Dim revenue As New sforce.TH_Revenue_Totals__c

revenue.OwnerId = OwnerId

'revenue.Sell_In_Total__c = CType(Sell_In_Total__c, Double)

'revenue.Sell_Through_Total__c = CType(Sell_Through_Total__c, Double)

revenue.Sell_In_Total__c = CDbl(Sell_In_Total__c)

revenue.Sell_Through_Total__c = CDbl(Sell_Through_Total__c)

revenue.Sell_In_Goal__c = Sell_In_Goal__c

revenue.Sell_Through_Goal__c = Sell_Through_Goal__c

revenue.ExternalID__c = strExternalID__c

aryList.Add(revenue)

recordsToUpdate = aryList.ToArray(GetType(sforce.sObject))

Try

ur = binding.upsert("ExternalID__c", recordsToUpdate)

For i = 0 To ur.Length - 1

If ur(i).success Then

Console.WriteLine("Upsert is Successful..." & "Status: " & ur(i).created)

Else

Console.WriteLine("Upsert failed, id: " & ur(i).id())

End If

Next i

Catch ex As Exception

Console.WriteLine("Error in: " & "UpsertToSalesForce(): " & ex.Message)

Finally

End Try

End Sub

If I want to mimic the existing custom object is there a fast way to do it?
Please help me to figure out what is the syntax to make the new line in the messageBody field of the "Send an Email" form ==> \n\r doestn't work
=================================================
 
var messageBody = " Dear {!IS_TSR__c.TSR_Recipient_1__c}, On {!IS_TSR__c.Service_Date__c} our Technical Representative, {!IS_TSR__c.CreatedBy}, performed services on the following band saw machine"
I am trying to update the custom lookup field 'Primary_Distributor_c' in Account object and first of all my '_id' is null but when I run the query I have always 1 record back with Id
 
If you will see my problem here please support.
 
Here is my code:
 
==============================================
function pd_update(_name){
alert("Got Here '"+_name+"'");
var qrdr = sforce.connection.query("select Id from Account where RecordTypeId='012600000004w6TAAQ' and Name = '"+_name + "'");
var records = qrdr.getArray("records");
alert("Found " + records.length + " Records...");
if (records.length > 0){
        _id=qrdr.records[0].Id;
 }
if (_id) {
  var _IsMatch = new sforce.SObject("Account");
  _IsMatch.Id = _id;
  _IsMatch.Primary_Distributor__c = _name;
   
  var updateIsMatch = sforce.connection.update([_IsMatch]); //actually perform update
  if (updateIsMatch[0].getBoolean("success")) { //if successful update of existing record
   alert("PD Successfully updated!"); //indicate that the update was successful
     } else {
   alert("Error:\n"+updateIsMatch[0]); //display the error
  }
 }
}
Please look at the 2 lines bellow and help me to understand why:
 
- value of the _name in first line = "Brett's Industrial Account"
- value of the _name in the second line = "Brett"
 
How to fix this one?
I will really appriciate your help.
 
============================================================
alert(_name);
output = "<input id=btn1 type=button name=btn1 onclick=\"" + fn + "\" value='" + _name + "'>";
Hello - Please help to fix my syntax problem here to pass the parametr, I need to get the contact in function cm(contact)...
Please see in red:
==============================================
 
<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script src="Link: " type="text/javascript"></script>
<script language="javascript">
var fn = "cm(this)";
function do_code()
{
//////////////////////////////////////
var cust_name =  '{!Account.Name}';
var qrdr5 = sforce.connection.query("Select c.Id from Account c  where c.Name= '" + cust_name + "'");
var records = qrdr5.getArray("records");
for (var x = 0; x < records.length; x++)
{
tt5 = records[x];
var ttt = tt5.get("Id");
}
/////////////////////////////////////
var qrdr2 = sforce.connection.query("Select Name from Contact c  where AccountId= '" + ttt + "'order by createdDate");
var records = qrdr2.getArray("records");
document.write("<b><u>Please Select Customer Contact:</u></b><BR><BR>");
document.write("<HR>");
for (var y = 0; y < records.length; y++)
{
tt2 = records[y];
var t=tt2.get("Name");
document.write("<BR>");
output = "<input id=btn1 type=button name=btn1 onclick=cm(obj); value='" + t + "'>";
document.write(output);
document.write("<BR>");
}
document.write("<BR>");
document.write("<HR>");
}
////////////////////////////////////
function cm(contact) {
  alert(contact);
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Customer Contacts...</title>
</head>
<body onLoad="do_code();">
</body>
</html>
Hello - Please help to fix my syntax problem here, I need to get the contact in function cm(contact)...
Please see in red:
==============================================
 
<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>
<script language="javascript">
var fn = "cm(this)";
function do_code()
{
//////////////////////////////////////
var cust_name =  '{!Account.Name}';
var qrdr5 = sforce.connection.query("Select c.Id from Account c  where c.Name= '" + cust_name + "'");
var records = qrdr5.getArray("records");
for (var x = 0; x < records.length; x++)
{
tt5 = records[x];
var ttt = tt5.get("Id");
}
/////////////////////////////////////
var qrdr2 = sforce.connection.query("Select Name from Contact c  where AccountId= '" + ttt + "'order by createdDate");
var records = qrdr2.getArray("records");
document.write("<b><u>Please Select Customer Contact:</u></b><BR><BR>");
document.write("<HR>");
for (var y = 0; y < records.length; y++)
{
tt2 = records[y];
var t=tt2.get("Name");
document.write("<BR>");
output = "<input id=btn1 type=button name=btn1 onclick=cm(obj); value='" + t + "'>";
document.write(output);
document.write("<BR>");
}
document.write("<BR>");
document.write("<HR>");
}
////////////////////////////////////
function cm(contact) {
  alert(contact);
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Customer Contacts...</title>
</head>
<body onLoad="do_code();">
</body>
</html>

Please help…

Instead of coming to this url ‘/a0F60000000HbP0’ I am coming to the home page.

Please let me know how I need to modify my s-control .

 

Here is the code:

 

 

var o = new sforce.SObject('WS__c');

o.set('Svc__c', _owner);

o.set('Welder__c', _num_id);

o.set('Dist__c', _dis_id);

o.set('City__c', _city);

o.set('State__c', _state);

o.set('WMake__c', _make);

o.set('WldMd__c', _model);

var results = sforce.connection.create([o]);

var locationString = '/' + results[0].id + '/e';

window.parent.parent.location.href = locationString;

I would really appreciate if somebody can point me to some samples or show me  how to create S-Control for Google Maps based on following object from SalesForce.com:

 

Account  è select any field from Account

Contact   è select any field from Contact
I am getting error:
 
Unable to access page.
Information needed by the page you have attempted to access is incorrect. If you believe this is an error, please refresh your screen. If the error persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information
.
 
When running this:
//////////////////////////////////////////////////////////////////////////////////////////////
var locationString ='/a01/e?nooverride=1&CF00N60000001MadM';
locationString += '&CF00N60000001Mtkg=' + _lenox_tech_rep;
locationString += '&00N60000001NEeU=' + _num;
locationString += '&CF00N60000001LfoI=' + _num;
locationString += '&CF00N60000001LfoI_lkid=' + _num;
locationString += '&00N60000001LoPq=' + _machine_make;
locationString += '&00N60000001LoQ5=' + _orientation;
locationString += '&00N60000001McdE=' + _location;
locationString += '&00N60000001LoPv=' + _model;
locationString += '&00N60000001LoQ7=' + _bfeet;
locationString += '&00N60000001LoQG=' + _bwidth;
locationString += '&00N60000001LoQ8=' + _btooth;
locationString += '&00N60000001LoQF=' + _binches;
locationString += '&00N60000001LoPr=' + _bgauge;
locationString += '&CF00N60000001LoQe=' + _customer_name;
locationString += '&00N60000001LoPl=' + _serial_number ;
locationString += '&CF00N60000001MccV=' +  _dis_name;
locationString += '&CF00N60000001MccV_lkid=' +  _dis_name;
locationString += '&CF00N60000001Mcca=' + _dis_sp_name;
locationString += '&CF00N60000001Mcca_lkid=' + _dis_sp_name;
locationString += '&CF00N60000001MzwZ=' + _s_dis_name;
locationString += '&CF00N60000001MzwZ_lkid=' + _s_dis_name;
locationString += '&CF00N60000001Mzxc=' + _s_dis_sp_name;
locationString += '&CF00N60000001Mzxc_lkid=' + _s_dis_sp_name;
locationString += '&00N60000001N9JM=' + _dis_loc;
locationString += '&00N60000001N9JR=' + _s_dis_loc;
locationString += '&CF00N60000001Mcd7=' + _lxsp;
window.parent.parent.location.href = locationString;