• zach
  • NEWBIE
  • 10 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 44
    Replies
I'm writing some custom reports that track whether a case has missed its SLA.  I'm not having any problems tracking this information on open cases, but in order to get this information for closed cases I must search case history for each closed case and this takes a loooooong time.  If the IsEscalated flag did not get reset when a case is closed, I wouldn't have to search case history and everything would be much much better on this side.

Anyway, is there any way to make it so IsEscalated is not reset when a case is closed?

Thanks,
-Zach
  • July 31, 2006
  • Like
  • 0
So, I've found a roundabout way of getting what I'm looking for, but I'm wondering if anyone can help me with a more direct way.  Basically, I'm trying to get the picklist values from a specific (custom) field in the Case object & so far I have this:

Code:
function buildDivisionSelector() {
 HTML = "<select id='divisionSelector' style='width:170px;'>";
 HTML += "<option value='all'>All Servicing Divisions</option>";
 var sfObject = sforceClient.describeSObject("Case");
 var array = new Array();
 for (var a = 0; a < sfObject.fields.length; a++) {
  if (sfObject.fields[a].name == "Servicing_Division__c") {
   array = sfObject.fields[a].picklistValues;
  }
 }
 for (var a = 0; a < array.length; a++) {
  HTML += "<option value='"+array[a].value+"'>"+array[a].value+"</option>";
 }
 HTML += "</select>";
 document.getElementById("divisionSelectorContainer").innerHTML = HTML;
}

 

Obviously, I don't need to loop through all of the fields since I know which field's picklist values I want to get... I just don't know how to reference an individual field.

Thanks,
-Zach

Message Edited by zach on 07-28-2006 02:48 PM

  • July 28, 2006
  • Like
  • 0
Hey, just wondering how the time zone offset works with SOQL.

If I specify a query as follows:

Select Id from Case where (CreatedDate >= 2006-07-13T00:00:00-07:00 and CreatedDate <= 2006-07-17T23:59:59-07:00 and RecordTypeId = '[some record type id]'

Will the first date constraint automatically get records from the previous day or not?

In this case, it should return records created after 5:00PM on 7/12/2006, right?
  • July 17, 2006
  • Like
  • 0
Wierd question, but here's what I'm trying to do...

I have an s-control that allows users to link accounts with account essentials (in a custom object called account essentials relationship).  The problem I'm running into is that the objects/fields I'm calling from Account have custome indexes and in order to view custom indexed fields you must have view all data permissions.  The people running this s-control will not have view all data permissions.

So, what I'd like to do is when the page loads, save the current user's getUserInfo() information to a global variable & then log that person out, log in another user who has view all data permissions, and run the s-control.

The reason I want to save the user's information is because there is a date/time/user stamp put on the additions/deletions/changes made to the account essentials relationship object and I want that stamp to contain the person's info that initially ran the report... Not the secondary user who has view all data permissions.

Anyway, the short of it is I'd like to know if there's a way to logout one user and log in another user without the first user actually knowing about it.

Thanks,
-Zach
  • June 28, 2006
  • Like
  • 0
This was posted in the PHP forum, so I'm not sure you guys saw it:

http://forums.sforce.com/sforce/board/message?board.id=PerlDevelopment&message.id=1444

Basically, I can get the pickers to launch but get an error when I try to choose a value.

Anyway, if you have any ideas on this one, please let me know.

Thanks,
-Zach
  • June 07, 2006
  • Like
  • 0
Hi, I've built a page that updates the lead object & when I try to update the Company or LastName fields with null, it doesn't throw an error in the saveResult... It doesn't update to null & the data stays the same, but it's not throwing an error.  Just wondering if this is a known issue and what I should do, otherwise, if it is.

Thanks,
-Zach

Here's a code snippet if you need it:

Code:
function saveLead() {
  
 var updateArray = new Array();
 var _value = leadSql[0];
 _value.set('Company',document.getElementById("editCompany").value);
 _value.set('Street',document.getElementById("editStreet").value);
 _value.set('City',document.getElementById("editCity").value);
 _value.set('State',document.getElementById("editState").value);
 _value.set('PostalCode',document.getElementById("editZip").value);
 _value.set('Country',document.getElementById("editCountry").value);
 _value.set('DUNS_Number__c',document.getElementById("editDUNS").value);
 _value.set('Location_Type__c',document.getElementById("editLocationType").value);
 _value.set('Servicing_Division__c',document.getElementById("editServicingDivision").value);
 _value.set('LeadSource',document.getElementById("editLeadSource").value);
 _value.set('Salutation',document.getElementById("editSalutation").value);
 _value.set('FirstName',document.getElementById("editFirstName").value);
 _value.set('LastName',document.getElementById("editLastName").value);
 _value.set('Phone',document.getElementById("editPhone").value);
 _value.set('Fax',document.getElementById("editFax").value);
 _value.set('Lead_Group__c',document.getElementById("editLeadGroup").value);
 _value.set('Title',document.getElementById("editTitle").value);
 _value.set('Email',document.getElementById("editEmail").value);
 _value.set('Status',document.getElementById("editLeadStatus").value);
 _value.set('Call_Wrap_Code__c',document.getElementById("editCallWrap").value);
 _value.set('Invalid_Prospect_Reason_Code__c',document.getElementById("invalidProspectReason").value);
 _value.set('Do_Not_Contact__c',document.getElementById("editDoNotContact").value);
 _value.set('Description',document.getElementById("editDescription").value);
 updateArray.push(_value);

 var updateVal = sforceClient.Update(updateArray);
 //alert(updateVal);
 if(updateVal[0].success == true) {
  alert("Your changes have been saved");
 } else {
  alert("There was a problem with the data you entered.  Please edit and try again.");
 }
}

 

  • June 01, 2006
  • Like
  • 0
I'm having problems with a SOQL statement in one of my ajax pages and from what I can tell in the docs, it's not possible to do a "like" search and escape special characters... True?

Basically, I have a soql statement that takes in a value entered by the user.  If the value contains a single quote, the soql breaks.  I've tried escaping with ( \ ) I've tried replacing the singel quote with two single quotes ala SQL and I've tried replacing the single quote with &#39; and none of it works.

Is there a solution to this or should I just cut off the stuff after the quote and search on that?

Thanks,
-Zach


  • May 22, 2006
  • Like
  • 0
Just wondering... I have a script where I get records tied to a specific account & retrieve would work way quicker than querying, but there are more than 2000 records.

Here's a snippet where it works (though not ideally):

Code:
function buildLinkedArray() {
 for (var a = 0; a < linkedAcctIdArray.length; a++) {
  var info = sforceClient.retrieve("Id,Name,Site,MasterNumber__c,ShipToNumber__c","Account",linkedAcctIdArray[a]);
  window.status = "Returning record "+(a+1)+" of "+linkedAcctIdArray.length;
  linkedAcctArray[a] = new Array();
  linkedAcctArray[a][0] = info[0].get("Id");
  linkedAcctArray[a][1] = info[0].get("Name");
  linkedAcctArray[a][2] = info[0].get("Site");
  linkedAcctArray[a][3] = info[0].get("MasterNumber__c");
  linkedAcctArray[a][4] = info[0].get("ShipToNumber__c");
 }
}

 Here's how I'd like it to work, but linkedAcctIdArray is about 2100 records, so it doesn't:

Code:
function buildLinkedArray() {
 var info = sforceClient.retrieve("Id,Name,Site,MasterNumber__c,ShipToNumber__c","Account",linkedAcctIdArray);
 for (var a = 0; a < info.size; a++) {
  window.status = "Returning record "+(a+1)+" of "+info.size;
  linkedAcctArray[a] = new Array();
  linkedAcctArray[a][0] = info[a].get("Id");
  linkedAcctArray[a][1] = info[a].get("Name");
  linkedAcctArray[a][2] = info[a].get("Site");
  linkedAcctArray[a][3] = info[a].get("MasterNumber__c");
  linkedAcctArray[a][4] = info[a].get("ShipToNumber__c");
 }
}

 

  • May 01, 2006
  • Like
  • 0
Hi, I'm trying to link to an individual records report in salesforce from a custom report I've built as an s-control.  I downloaded the Firefox developer toolbar to see what the post variables are when you build reports in salesforce so what I'm passing into the salesforce.com report is working, for the most part. I then set up a generic task report in salesforce to post to... While it works for the most part, I've run into a snag.  It seems like sd (start date) and ed (end date) are keying off of created date and not off of activity date.

Here's one URL string I've built in my custom report:

Code:
var col1Linka = "https://na1.salesforce.com/00O300000011vH4—&type=t&colDt_q=Custom&sd="+(fridayArray[a+1].getMonth()+1)+"/"+fridayArray[a+1].getDate()+"/"+fridayArray[a+1].getFullYear()+"&ed="+(fridayArray[a].getMonth()+1)+"/"+fridayArray[a].getDate()+"/"+fridayArray[a].getFullYear()+"&pc0=ASSIGNED&pn0=eq&pv0="+userArray[2]+" "+userArray[1]+"&pc1=TASK_TYPE&pn1=eq&pv1=Outbound Call&pc2=00N30000000fWIL&pn2=eq&pv2=Schedule First Appointment,Make Cold Call (Phone)";

 


Is there any way to specify in the URL from my custom report or in setting up the generic salesforce report that I'd like to use activity date for the sd and ed values instead of it (seemingly) keying off of created date?

Thanks,
-Zach
  • April 26, 2006
  • Like
  • 0
It's an easy fix, but I'm wondering if something changed with beta 3.3 to cause this or what... I wasn't having this problem on Friday.

Thanks,
-Zach
  • April 24, 2006
  • Like
  • 0
I've gone through my php.ini and apache.conf files and set all of the timeouts (on my local machine) to be way more than 30 seconds, but I'm still getting the "PHP Fatal error:  Maximum execution time of 30 seconds exceeded" error when I run process-intensive scripts.  Can anyone tell me which directive I need to set to increase this timeout?
  • April 13, 2006
  • Like
  • 0
Hi, just wondering if there have been any recent changes to beta 3.3... Last week, my standalone reports (non S-Control) were working fine in both Firefox and IE, but now none of the Firefox reports will work and "uncaught exception: Permission denied to call method XMLHttpRequest.open" is the error I'm getting through the javascript console.

Any ideas?

Thanks,
-Zach
  • April 11, 2006
  • Like
  • 0
Hey, any of you know what minimum version of Javascript must be supported in the browser to use the AJAX Toolkit?

I've built a bunch of s-controls for web, but I'm trying to see if it will translate to BlackBerry & it seems like it won't... Blackberry says it supports Javascript 1.3 & parts of 1.4 & 1.5.
  • March 24, 2006
  • Like
  • 0
Just wondering what, if anything, I'm doing wrong that would cause this with AJAX.

If I do a pretty big query or run a lot of data with javascript, I'll get this from time to time. Any way around it?

Thanks,
-Zach
  • March 01, 2006
  • Like
  • 0
Hey, so I have a report that is in a custom S-Control within our app.

This report is ran from two places.

One is where a Manager type runs a summary report and clicks on the user to see their
individual report. This runs fine.

The other runs when the user is logged in and clicks on a tab to run the report. This one does not run.

This is the exact same report with the exact same code in both instances.

The error I'm getting is:

-------
"className: Fault faultcode: sf:INVALID_FIELD faultstring: INVALID_FIELD: Reporting_Division__c, UserRoleId, ProfileId from User Where id = '[user's id]'

^ ERROR at Row:1:Column:68 No such column 'ProfileId' on entity 'User'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. detail:

SOQL: Select Id, LastName, FirstName, Reporting_Division__c, UserRoleId, ProfileId from User Where id = '[user's id]' RequestedColumns IdLastNameFirstNameReporting_Division__cUserRoleIdProfileId"
--------

I know there's a profileId column in the user entity because it says so in the sforce explorer and the report runs fine if I'm logged in as a manager type. Is there some sort of security setting that doesn't allow non-manager types to see their own profileId?

Thanks.
  • February 24, 2006
  • Like
  • 0
Hi, I just realized that my queries are only returning 200 records at a time. I'm trying to get all records (the specific user I'm working with has 411 records), but I'm not sure how to use queryMore.

I have my soql statement that's returning 200 records and then after that I have:

if (taskSql.done == "false"){
sforceClient.queryMore(taskSql);
}

but it's not working. I've also tried it with false not in quotes.

Anyway, if someone could give me a quick how-to for using the queryMore function in javascript, that would be grand.

Thanks,
-Zach
  • February 06, 2006
  • Like
  • 0
error:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIXMLHttpRequest.send]" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js :: anonymous :: line 834" data: no]

Basically, I'm trying to return results from a query that I'm running from my local machine. When I comment out the have the sforceClient.init function the script runds but I get back undefined results for the firstname value that I'm trying to alert, so I'm just guessing the init() is what I'm missing. If this is wrong, please let me know. BTW, I've hard-coded a userid in there for now so I can get the report to run for a single user, but later it will be a real variable.

Here's the javascript I'm using:


script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript">
script src="http://sandbox.sforce.com/ajax/sforceExplorer/dhtmlXCommon.js" type="text/javascript">
script src="http://sandbox.sforce.com/ajax/sforceExplorer/dhtmlXTree.js" type="text/javascript">
script type="text/javascript">


//creating global variables
var globalUserId = 'user id';

function setUser(userId){
var userLogin = sforceClient.login('my username','my password');
//alert('userLogin= '+userLogin);

sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_60}");
window.setTimeout(";", 1000);

if (globalUserId != ''){
globalUserId = userId;
}
loadPage();
}

function loadPage(){

//getting client information
var userSql = sforceClient.query("Select LastName, FirstName, Division, UserRoleId from User Where id = '"+globalUserId+"'");
if(userSql.size>0){
alert("records "+userSql.records[0]);
alert("firstname "+userSql.records[0].firstname);
}

//var roleSql = sforceClient.query("");
}
/script>

Message Edited by zach on 01-20-2006 10:37 AM

Message Edited by zach on 01-20-2006 10:38 AM

Message Edited by zach on 01-20-2006 10:39 AM

  • January 20, 2006
  • Like
  • 0
Another basic question. What is the best way to handle this issue?

I have made a custom HTML form? The form needs to update fields from a Contact object. I have a handle to the dynabean but I'm not sure how to handle the submit?

Should I parse the document.form.elements[] and hardwire the results into the dynabean?

I'm trying to use the bind method but this looks like it's used when you query the contact object first...
Any thoughts on the best way to get elements (like input fields) and update the contact object?

Message Edited by FinTech on 09-09-2006 05:33 PM

  • September 10, 2006
  • Like
  • 0
I have a s-control to get data from Salesforce.com and process them, then posted on the web site. Here is the high level of my code:
 
var contents = "";
for(var i=0;i<queryResult.records.length;i++)  {
 
  var dynaBean = queryResult.records[i];
 
  var field_1 = dynaBean.get("FIELD_1");
  var field_2 = dynaBean.get("FIELD_2");
  ...
   var field_n = dynaBean.get("FIELD_n");
 
  contents += field_1 + field_2 + ... + field_n + "<br>";
 
}
 
document.getElementById("elment_id").innerHTML = contents;
 
This code runs perfectly fine in Firefox, but is 10 times (if not more) slower when using MS internet explorer.
 
Anybody has similar experience on this, please give me some advice on how I could make it run faster in IE.  I have to get it work in IE, since IE is our company's authorized browser and FF is not.


Message Edited by freeman on 09-03-2006 04:14 AM

  • September 03, 2006
  • Like
  • 0
Dear All;
                     I have created one SControl using AJAX toolkit to fetch the data from salesforce database and to display it in tabular format.As soon as I select filters and click the show report button the query starts fetching data from the database.During the query run the page gets freezed.
                    Actually I want to show the progress bar when query is busy.I tried this using javascript timer,usuing table in marquee, and some ready made progressbars available on net; but each time whenquery starts running every progressbar stops its animation(Movement) as the whole page, freezes.
                    I even tried with using callback function.It oks well when I show progrss in a form of text(percentage).But for progressbar it fails as timer stops working.
                    Can anyone give me the solution with example because I tried all the options in my mind.
Small example with explaination will help me lot.
 
Thanks in advance
I am not sure what just happened there but here is my question..probably a very easy question but I am new to javascript. I have an scontrol written in javascript and I am getting the value from a date field this way:
 
var OpptyCloseDate = {!Opportunity_Renewal_Close_Date};
 
I am then trying to put this variable into a the Close Date of a newly created oppty...using this:
 
 newoppty.set("CloseDate", OpptyCloseDate);
 
What am I missing? I am getting an error. SUrely I need to do something with the dates I just have no idea what!
 
thanks!

Message Edited by sgorema on 08-30-2006 12:19 PM

Trying to create a join  - yes I know there is no join capability currently - hence my struggle.  I've got a custom object represented as a lookup field on the account record. The field is not required and in fact may be null at times. I need to do the following;

Query the custom object based on some criteria, then based on the custom object 'Id' I need to then query and get the accounts associated with the custom object.

qr = sforceClient.query("Select Id, Name, Latitude__c, Longitude__c From SFDC_65_Building__c s Where  BuildingPostalCode__c = 'xxxx'");

I am assuming I would then create some sort of an array to hold the value of the Id's returned and then in turn run an additional query based on the id's (would love to use retrieve but not possible as I don' t have the account Id) so second query would be;

qr2 = sforceClient.query("Select Id, Name From Account Where customObjectField =" +arrayValue);

I can't figure it out however. Any help much appreciated.
I'm running a query which grabs several fields from each of our 900 users...  Just to run the query with no manipulation or displaying takes about 25 seconds.
 
Is this on par?
 
Is the User table somehow slower to query than other tables?
I am trying to write an s-control which switches the current login to that of a system administrator so that certain data only available to admins can be queried.  I have the following code, which works in IE when I enable cross-domain data access in the security settings, but gives me a permission error in Firefox when it calls XMLhttprequest.open.  It also won't work in IE if that security setting isn't changed.  Does anyone have any suggestions for fixing this without changing the security settings?  I am new to the world of s-controls; so, any help would be greatly appreciated.  Thanks.

    function initSession() {

        sforceClient.setLoginUrl("https://www.salesforce.com/services/Soap/u/7.0");
        sforceClient.init(null, null, false);
        var loginResult = sforceClient.login("abc@xyz.com","1234");
        alert(loginResult);
    }
I am using an s-control to create an advanced customizable search function. To display the results I call a predefined report. I use it as /02030304020?pv0=SOMESTRING where I have one filter set to a string. This seem to work ok.
 
Now if I have a boolean filter such as /02030304020?pv0=SOMESTRING&pv1=True, then this brings the report "Select Criteria" page where the entry on the boolean filter says 'Error: Use "False" or "True" '. In the actual field you can see "True" as it is expected. If I don't do anything and simply click the Run Report the report runs ok.
 
I don't want the user to have to click Run Report but I just want the report to run. Like I said, if there are no booleans it seems to run without the need to click on Run Report but if there is a boolean then it won't let me go directyly to the report due to the error.
 
Anybody has a solution for this problem? Thanks.
I am starting to develop more and more scontrols and am getting bored of pasting the code into the web page when I want to run/debug it.

I thought I'd found my saviour when I found the announcements about the eclipse integration -- I then spent the next few hours trying to install it and, at the last hurdle, it all failed.  I can't get eclipse to install any of the 'The Eclipse Project' updates to eclipse.  I just get errors.

As well as that, I can't find any information about how to use eclipse with salesforce...the link: http://adnsandbox.com/appexchange/updates/ gives me a 404 and I can't find anything anywhere else.  Has the eclipse integration gone out of fashion?

Any way - can anyone help me with tips on how best to edit the s-controls.  If that is eclipse, then how do I get it all installed.

Thanks in advance.
Hi,
 
I need to fetch 200+ Campaigns and the NumberOfLeads and NumberOfContacts associated with them satisfying a particular condition (like only those members to be counted with a particular status). I dont know if I can use a join to do this (as the Status info is in the Members table).
What would be the best and fast way of doing this? The Member count can be 100000+!
 
Thanks.
Hi,
I have a couple of simple s-controls I'm taking over.  Are there any examples about how to put one-to-many items on a page?  I just want something easy for now, using just a script.  Or is it worth getting eclipse setup?

Thanks,

Roy
Code:
function runQuery() {
 sforceClient.setBatchSize(5);
 sforceClient.query("Select Id, Name From Account", queryCallBack, true);
}

function queryCallBack(qr) {
 if (qr.size > 0) {
   alert(qr.records.length);
  if (qr.done != true) {
   sforceClient.queryMore(qr.queryLocator, queryCallBack, true);
  }
 }
}

 
I set setBatchSize to 5 but I always get all my Accounts with this code and 'done' is always true. I only have nearly 50 accounts in my database but does setBatchSize only has an effect on the query if there are more than that in the database ?  I cannot find anything I'm doing wrong in this code. (I use AJAX toolkit 3.3 beta).
 
Thanks,
 
// Juergen
 
 
 
 
 
 
 
So, I've found a roundabout way of getting what I'm looking for, but I'm wondering if anyone can help me with a more direct way.  Basically, I'm trying to get the picklist values from a specific (custom) field in the Case object & so far I have this:

Code:
function buildDivisionSelector() {
 HTML = "<select id='divisionSelector' style='width:170px;'>";
 HTML += "<option value='all'>All Servicing Divisions</option>";
 var sfObject = sforceClient.describeSObject("Case");
 var array = new Array();
 for (var a = 0; a < sfObject.fields.length; a++) {
  if (sfObject.fields[a].name == "Servicing_Division__c") {
   array = sfObject.fields[a].picklistValues;
  }
 }
 for (var a = 0; a < array.length; a++) {
  HTML += "<option value='"+array[a].value+"'>"+array[a].value+"</option>";
 }
 HTML += "</select>";
 document.getElementById("divisionSelectorContainer").innerHTML = HTML;
}

 

Obviously, I don't need to loop through all of the fields since I know which field's picklist values I want to get... I just don't know how to reference an individual field.

Thanks,
-Zach

Message Edited by zach on 07-28-2006 02:48 PM

  • July 28, 2006
  • Like
  • 0
Getting the dreaded permission exception on XmlHttpRequest.open error when I attempt to login().  Everything is hosted on sfdc, so not sure why I'm getting this.  Here are some germane snippets:

<script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>       

sforceClient.setLoginUrl("https://www.salesforce.com/services/Soap/u/7.0");
    var loginResult = sforceClient.login("xxx@xxxx.com", "xxx");
    if (loginResult.className != "LoginResult") {
        alert("Login failed! Here's the error: " + loginResult);
    }



thanks

Message Edited by onthebeach on 07-26-2006 09:26 AM

Hey, just wondering how the time zone offset works with SOQL.

If I specify a query as follows:

Select Id from Case where (CreatedDate >= 2006-07-13T00:00:00-07:00 and CreatedDate <= 2006-07-17T23:59:59-07:00 and RecordTypeId = '[some record type id]'

Will the first date constraint automatically get records from the previous day or not?

In this case, it should return records created after 5:00PM on 7/12/2006, right?
  • July 17, 2006
  • Like
  • 0
I want to mimic the behaviour of a standard object tab with two scontrols.
 
I put one scontrol on a web tab which shows a list of some custom objects.
 
When the users clicks on one object I want to display the details of this custom object on the same web tab.
 
I tried

top.location.href = "servlet/servlet.Integration?lid=00b30000000rk5n&eid=" + dynaBean.get("Id");

to go to the details scontrol. It works and the details scontrol is displayed but  the selected tab on the top changes to "Contacts" (?).

Is it possible to "replace" the current scontrol with another on the same web tab ?

Thanks,

Juergen

 

 

Message Edited by BoolsEye on 07-12-2006 10:14 AM