• SteveO1993
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
Hi Everyone, I am a little stumped trying to find an answer to this project I am working on.  I was wondering if anyone has a sample source or perhaps point me in the right direction.  The functionality I am trying to achieve is very similiar to the standard "Change Status" button that shows up in a list view of the Lead Entity, however I would like to update a custom field.
 
Here is the breakdown::
 
1. User clicks on specific view of their Leads
2. User selects the leads he/she would like to update
3. User is directed to a followup screen and is presented with a custom picklist field where he/she can apply the value to all selected leads.
4. Click Save
5. User is returned back to the List View
 
 
Below is where I got so far: however I assume I need a URLFOR function to pass the ID's to a custom s control.
 
Any help is appreciated!
Steve
 
Code:
// Include and initialize the AJAX Toolkit javascript library
//
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
// Get the list of job applications that should be closed by using the
// $ObjectType merge field to indicate the type of record Ids that
// are expected.
//
var leadID = {!GetRecordIds($ObjectType.Lead)};
if (leadID == null || leadID.length == 0) {
alert("You need to select Leads to add to the call list.");
} else {
var leadUpdate = new Array();
for (var i = 0; i < leadID.length; i++) {
var callList = new sforce.SObject("Lead");
//
// Since we'll be using the update call, we must set the id
// on the new job application record.
//
callList.Id = leadID[i];
//
//callList.Add_to_Call_List__c = "Marketing";
// Finally add the record to our array.
//
leadUpdate.push(callList);
}
// Now make the update API call in a try statement so we can
// catch any errors. Save the resulting array so we can also
// check for problems with individual records.
//
var callCompleted = false;
try {
var result = sforce.connection.update(leadUpdate);
callCompleted = true;
} catch(error) {
alert("Failed to update Field with error: " + error);
}
// Now check for problems with individual records.
//
if (callCompleted) {
for (var i = 0; i < result.length; i++) {
if (!result[i].getBoolean("success")) {
alert("Job Application (id='" + leadID[i] +
"') could not be updated with error: " +
result[i].errors);
}
}
// Finally, refresh the browser to provide confirmation
// to the user that the job applications were rejected.
//
window.location.reload(true);
}
}

 
 
 
Hi Everyone, I am working on an onClick Javascript button within the list view in salesforce.com.  And I got the script below to work when the field "Add_to_Call_List__c" is a text field, however when it is a picklist type, I need to use the ISPICKVAL or CASE function.  The business need is to update this field on mass when this button is clicked on within the list view.
 
Would anyone know what changes I need to make to:
 
"callList.Add_to_Call_List__c = "TRUE";"
 
when I make the field type a picklist?  As this field is going to be a picklist field type at the end of the day.  Let me know if more detail is required.
 
Thanks in advance!
Steve
 
====================================
 
// Include and initialize the AJAX Toolkit javascript library
//
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
// Get the list of job applications that should be closed by using the
// $ObjectType merge field to indicate the type of record Ids that
// are expected.
//
var leadID = {!GetRecordIds($ObjectType.Lead)};
if (leadID == null || leadID.length == 0) {
alert("You need to select Leads to add to the call list.");
} else {
var leadUpdate = new Array();
for (var i = 0; i < leadID.length; i++) {
var callList = new sforce.SObject("Lead");
//
// Since we'll be using the update call, we must set the id
// on the new job application record.
//
callList.Id = leadID[i];
//
callList.Add_to_Call_List__c = "TRUE";
// Finally add the record to our array.
//
leadUpdate.push(callList);
}
// Now make the update API call in a try statement so we can
// catch any errors. Save the resulting array so we can also
// check for problems with individual records.
//
var callCompleted = false;
try {
var result = sforce.connection.update(leadUpdate);
callCompleted = true;
} catch(error) {
alert("Failed to update Field with error: " + error);
}
// Now check for problems with individual records.
//
if (callCompleted) {
for (var i = 0; i < result.length; i++) {
if (!result[i].getBoolean("success")) {
alert("Job Application (id='" + leadID[i] +
"') could not be updated with error: " +
result[i].errors);
}
}
// Finally, refresh the browser to provide confirmation
// to the user that the job applications were rejected.
//
window.location.reload(true);
}
}
Hi, I am having a little difficulty with a validation rule I am working on.  What I am trying to do is validate a blank field entitled "Sales Region" when the Account Type has 3 specific values, however I am having difficulties getting it to work.  Any help would be greatly appreciated.  Here is the sample I was working with:
 
AND(OR(ISPICKVAL( Type , "Value 1"),ISPICKVAL( Type , "Value 2"),ISPICKVAL( Type , "Value 3")), ISPICKVAL(  Sales_Region__c  , "") )
 
Thanks!
 
Hi Everyone, I have been playing around most of today trying to find if there is a similar function in Salesforce to the "VLookup" function in Microsoft Excel.
 
The business objective I am trying to achieve is replace a text Country field with a 2 letter Country ISO code.  I have a seperate table of about 2,500 variations of countries that all map to an Country ISO value.
 
I tried using a CASE formula field, however the number of characters for such a function exceeds the maximum number of characters in this formula.  I was wondering if there is an elegant way to do this within Salesforce automatically, or could this only be manually updated through the API/upload.
 
Thanks a million,
Steve
Hi Everyone, I am working on an onClick Javascript button within the list view in salesforce.com.  And I got the script below to work when the field "Add_to_Call_List__c" is a text field, however when it is a picklist type, I need to use the ISPICKVAL or CASE function.  The business need is to update this field on mass when this button is clicked on within the list view.
 
Would anyone know what changes I need to make to:
 
"callList.Add_to_Call_List__c = "TRUE";"
 
when I make the field type a picklist?  As this field is going to be a picklist field type at the end of the day.  Let me know if more detail is required.
 
Thanks in advance!
Steve
 
====================================
 
// Include and initialize the AJAX Toolkit javascript library
//
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
// Get the list of job applications that should be closed by using the
// $ObjectType merge field to indicate the type of record Ids that
// are expected.
//
var leadID = {!GetRecordIds($ObjectType.Lead)};
if (leadID == null || leadID.length == 0) {
alert("You need to select Leads to add to the call list.");
} else {
var leadUpdate = new Array();
for (var i = 0; i < leadID.length; i++) {
var callList = new sforce.SObject("Lead");
//
// Since we'll be using the update call, we must set the id
// on the new job application record.
//
callList.Id = leadID[i];
//
callList.Add_to_Call_List__c = "TRUE";
// Finally add the record to our array.
//
leadUpdate.push(callList);
}
// Now make the update API call in a try statement so we can
// catch any errors. Save the resulting array so we can also
// check for problems with individual records.
//
var callCompleted = false;
try {
var result = sforce.connection.update(leadUpdate);
callCompleted = true;
} catch(error) {
alert("Failed to update Field with error: " + error);
}
// Now check for problems with individual records.
//
if (callCompleted) {
for (var i = 0; i < result.length; i++) {
if (!result[i].getBoolean("success")) {
alert("Job Application (id='" + leadID[i] +
"') could not be updated with error: " +
result[i].errors);
}
}
// Finally, refresh the browser to provide confirmation
// to the user that the job applications were rejected.
//
window.location.reload(true);
}
}
Hi, I am having a little difficulty with a validation rule I am working on.  What I am trying to do is validate a blank field entitled "Sales Region" when the Account Type has 3 specific values, however I am having difficulties getting it to work.  Any help would be greatly appreciated.  Here is the sample I was working with:
 
AND(OR(ISPICKVAL( Type , "Value 1"),ISPICKVAL( Type , "Value 2"),ISPICKVAL( Type , "Value 3")), ISPICKVAL(  Sales_Region__c  , "") )
 
Thanks!
 
Hi Everyone, I have been playing around most of today trying to find if there is a similar function in Salesforce to the "VLookup" function in Microsoft Excel.
 
The business objective I am trying to achieve is replace a text Country field with a 2 letter Country ISO code.  I have a seperate table of about 2,500 variations of countries that all map to an Country ISO value.
 
I tried using a CASE formula field, however the number of characters for such a function exceeds the maximum number of characters in this formula.  I was wondering if there is an elegant way to do this within Salesforce automatically, or could this only be manually updated through the API/upload.
 
Thanks a million,
Steve
This seems simple, but it's got me stopped cold. I've got a list button designed to be used in a list view (not a related list). It allows the user to select a number of opportunities and then mass-edit them in a controlled manner. My problems started when trying to return the user to the list view on complete. Here's what I want to do:

  1. User opens the list view, selects a number of opportunities, and clicks the Update button
  2. A new page is opened within the iframe - "existing window with sidebar"
  3. User updates field values
  4. User clicks Save
  5. Opportunities are updated and the user is returned to the list view
Here are the problems I've had:
  1. If I use the "existing window with sidebar" on the button and launch my scontrol, the display to the user works fine.  Except there's no clean way I can find to return the user to the list view.  $Request doesn't work because there is no retURL passed.
  2. So I tried OnClick Javascript and URLFOR.  I can get my source URL for the view then, but apparently URLFOR expects Object.Field as parameters and won't accept javascript variables, strings, anything else.
  3. Ok, old-fashioned way.  Still using OnClick Javascript, I called the scontrol using the servlet.integration method and passed in my parameters.  This works great and I can return the user to the list view.  However I cannot force the scontrol to open within the original frame!  It replaces the entire window every time no matter what combination of parent.frames.location, window.location, etc.
Any suggestions?  My current OnClick javascript is below.
Code:
var arrOppIds = {!GETRECORDIDS($ObjectType.Opportunity)};
var callScontrol = "/servlet/servlet.Integration—lid=01N600000008uzZ&ic=1&retURL=" + window.location + "&oppIds=" + arrOppIds.join('-');
parent.frames.location.replace(callScontrol);