• JBerry
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 8
    Replies
Hi,

I am trying to do a SQL query, where my where clause is based on another SQL query.  I want to do something like:

select ListPrice from OpportunityLineItem where OpportunityId IN (select Id from Opportunity where Status='Closed')

Does anyone know how to go about this?

Thanks!
  • April 07, 2008
  • Like
  • 0
Hi,

I am trying to locate a sample on how to do an upsert to the product line items in an opportunity, or if this is even possible.  I have my upsert working as so...

Code:
<urn:upsert>
  <urn:externalIDFieldName>Id</urn:externalIDFieldName>
  <urn:sObjects xsi:type='urn1:Opportunity'>
    <urn1:Id>OppID</urn1:Id>
    <name>Bob's Test Opp</name>
  </urn:sObjects>
</urn:upsert>

 
How would I go about adding the child relationship to that opportunity so I can upsert a product into it?

Any help/samples/links would be greatly appreciated!
  • January 29, 2008
  • Like
  • 0
Hi,
I've read the other posts about this, but nothing listed seems to help.  The query string I am running is:

Code:
queryStr = "select "+showFields.join(", ")+",Account.Account_Manager__c from opportunity where Account.Account_Manager__c = 'Stephanie Dart' AND Event_Date__c >=" + document.getElementById('startdate').value + " AND Event_Date__c<=" + document.getElementById('enddate').value
And when ran, I get the error of Malformed Query. SOQL statements can't query related data.

And my script sources are:
Code:
<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>
<script src="/soap/ajax/10.0/connection.js"></script>

 The one thing I did notice was my error was coming from https://na3.salesforce.com/services/Soap/u/7.0?.  Is, for some reason, this code trying to be ran on 7.0? I know relationship queries need 8 or higher.  But I cannot find that post location anywhere in my code.

Any help is appreciated! Thanks!

 

  • September 27, 2007
  • Like
  • 0
Hi,

I am trying to create a custom button that, when clicked, posts to the multiline.jsp products page so it will automatically add a certian product to an opportunity when clicked.  I have the button placed on the Products Related List, and I have almost everything working except I cannot seem to pass the field values for any of the 4 fields on the products add page(Quantity, Sales, Description, Date).

When this is ran, it displays the product add page, saying I didn't pass the quantity, and none of the form fields are filled in. My code is:

Code:
https://na3.salesforce.com/oppitm/multilineitem.jsp?ids=01u50000001KRZ7&oppId={!Opportunity.Id}&retURL=/{!Opportunity.Id}&Quantity01u50000001KRZ7=500&UnitPrice01u50000001KRZ7=900&ServiceDate01u50000001KRZ7=2007-09-15&Description01u50000001KRZ7=test&save


 

  • September 26, 2007
  • Like
  • 0
Hi,

I am creating a form for the users in our company to go and fill out a "Tech Request" ticket, which when they click the Submit button, it creates a record under a custom object that I have built.  I am doing it this way because I do not want our users directly modifying that custom object and it is full of a bunch of items they don't need.

This form consists of basics for them to fill out: Name, Problem, Description.  I am trying to add a 'File Upload" section here that they can browse their computer for, say a screenshot, and upload it along with the form.  This upload needs to be sent to the "Notes and Attachments" section of the Custom Object record they just created.

Any ideas? =)
  • September 04, 2007
  • Like
  • 0
Hi!

I have read through the Apex Wiki and through the code reference guide, and I'm at a loss.  I am trying to write a trigger so when one of my custom object pages gets updated, it creates a task.  The first question is, is this possible?  After reading the guide, it really strikes me that SF didn't use the same base language as the rest of there code( i.e. SControls, API; which would have been nice, because I can do it there =) ).

So, does anyone know where I can go to find more information about triggers, and if my idea of creating a task 'after update' is possible? If it is, some sample code would be wonderful to get me heading into the right direction =).

Thank you!
  • September 04, 2007
  • Like
  • 0
Hi,
I was wondering if this is typical or not.  When I use the command line to update data on salesforce, it runs extremely slow.

I am using the "process ../conf csvupdate" command line, with my process-conf.xml file located in my /conf directory. 

The process starts off quick, but when it gets to "Setting object reference types", this step alone takes 10 minutes on average.  When I run the same update in the GUI with the same field mappings file, it is instant with a speed of "27000 records per minute".

Any ideas? I'm not getting any errors or anything, its all successful, and nothing in my error logs.
  • August 05, 2007
  • Like
  • 0
Hey,

I am trying to set up the dataloader command line interface so I can do a nightly update of some of my SalesForce data.  I am using the Apex Data Loader 9.0.  When I follow the instructions from the command line, using the command:
java -Dsalesforce.config.dir=C:\dataloader -jar dataloader.jar
It launches my UI instead of running from the command line.

Any ideas?
Code:
var result = sforce.connection.query("Select Event_Date__c,Name,ProxiAgent_Contact_Numbers__c,Implementation__c,Client_Contact_Name__c,Audio_Video_Location__c,Id From Opportunity Where (Event_Date__c=TODAY and Implementation__c!='Timed')"); 

 
Hi,
This query that I posted above works great when I am pulling my opportunities for Today, and I am also able to use Yesterday and Tomorrow.  I am however, trying to pull the opportunities for Today, Tomorrow, Tomorrow+1, and Tomorrow+2.  I know how to create variables representing these values.  Is there a way I can pass my variables into this query?  SF knows how to calculate the TODAY and TOMORROW values in the query, but I need to pass certian dates beyond that.
 
Any ideas or suggestions would be greatly appreciated =).
Hey everyone,
I am creating a custom s-control, and I am trying to pull all my opportunities with the date of {!TODAY} so it actively refreshes every day.  The problem I am running into is that {!TODAY} code returns a date in the format of 7/22/2007, but the SalesForce date field stores information as 2007-07-22.  So when I run my code for that, I can see the error and the coding that is returned, and it is giving me a Malformed Query because the date format is not matching correctly.
 
Has anyone else ran into this problem? Any suggestions?
Hey,
I am trying to upload a .csv file via the scripting toolkit.  The .csv contains the opportunity ID in the first column, and the file is being inserted into salesforce as an update to existing data.

Basically, I want it to all run in the backend and hidden.  I export my SQL database hourly, and want the changes to be reflected onto SF.  Maybe the STK isn't the route to be taking.

Any ideas/suggestions?

Thanks!
Hi,
I'm currently pulling my data using the scripting toolkit through Dos, and saving it into a .CSV file.  The problem I am running into is that some of the fields contain comma's in them and its forcing part of that field into the next column.  I know there is a way to run an If...Then loop to check each variable and remove any comma's, but I'm  drawing a total blank on getting it to work correctly.  Here is my current code for the query:

Code:
function Results(queryResult) {
    if (queryResult.size > 0) {
        var output = "";
        var records = queryResult.getArray("records");
        output += "Start Time" +","+ "Opportunity" +","+ "Implem" +","+ "ProxiAg" +","+ "HybridOp" +","+ "RemoteOp" +","+ "A/V" +","+ "Contact" +","+ "Phone#" +","+ "Launch" + "\r\n";
        for (var i=0;i<records.length;i++) {
            var account = records[i];
            output += account.Start_Time_CST__c + "," + account.Name + "," + account.Implementation__c + "," + account.Proxiagent_Name__c + "," + account.Hybrid_Software_Operator__c + "," + account.Remote_Operator__c + "," + account.Audio_Video_Location__c + "," + account.Client_Contact_Name__c + "," + account.ProxiAgent_Contact_Numbers__c + "," + account.Launch_Support__c + ",test" + ",test" + "," + account.Launch_Support_Notes__c + "," + account.Follow_up_support_notes__c +"\r\n";
        }
        WScript.echo(output);
    }else WScript.echo("No records matched.");
    ToolKit.Quit();
}
var callback = {onSuccess : Results, onFailure : function(e){WScript.echo(e)}};
var queryResult = sforce.connection.query("Select Start_Time_CST__c,Name,Implementation__c,Proxiagent_Name__c,Hybrid_Software_Operator__c,Remote_Operator__c,Audio_Video_Location__c,Client_Contact_Name__c,ProxiAgent_Contact_Numbers__c,Launch_Support__c,Event_Date__c,Follow_up_support_notes__c,Launch_Support_Notes__c from Opportunity where Event_Date__c=2007-06-25", callback);

Right now the fields Name, Follow_up_support_notes__c, and Launch_Support_Notes__c have the possibility of a user entered comma in them. 

Any idea on the string method to use to run through these fields and remove any comma's in the data pulled from them?

Hi, I'm currently designing a custom tab/area to run reports through,
but am having a bit of trouble validating some of the information and I'm at a standstill.

Basically, when I'm running my query I can validate if a checkbox is not checked(false)
and that returns all of my false values correctly.  But, when I try to validate
if the checkbox is checked(true), it returns nothing.
My code is:


var result = sforce.connection.query
("Select Event_Date__c,Name,Launch_Support_Notes__c,Review__c,Follow_up_support_notes__c
From Opportunity Where (Event_Date__c>=2007-05-04 AND Event_Date__c<=2007-05-04)
and Review__c=true ");

The bold is the field name, and the status(true). 

Like I mentioned:When that is changed to false, it works correctly. 
When it is changed to true, it returns no values.
I have also ran my code without the true/false validation, and so it lists all my values
and shows true and false, so I know there are records to be pulled. Any help would be greatly
appreciated! Thanks!

Message Edited by JBerry on 05-25-2007 06:10 PM

Message Edited by JBerry on 05-25-2007 06:11 PM

Hi,

I am trying to do a SQL query, where my where clause is based on another SQL query.  I want to do something like:

select ListPrice from OpportunityLineItem where OpportunityId IN (select Id from Opportunity where Status='Closed')

Does anyone know how to go about this?

Thanks!
  • April 07, 2008
  • Like
  • 0
Hi,

I am creating a form for the users in our company to go and fill out a "Tech Request" ticket, which when they click the Submit button, it creates a record under a custom object that I have built.  I am doing it this way because I do not want our users directly modifying that custom object and it is full of a bunch of items they don't need.

This form consists of basics for them to fill out: Name, Problem, Description.  I am trying to add a 'File Upload" section here that they can browse their computer for, say a screenshot, and upload it along with the form.  This upload needs to be sent to the "Notes and Attachments" section of the Custom Object record they just created.

Any ideas? =)
  • September 04, 2007
  • Like
  • 0
Hi,
I was wondering if this is typical or not.  When I use the command line to update data on salesforce, it runs extremely slow.

I am using the "process ../conf csvupdate" command line, with my process-conf.xml file located in my /conf directory. 

The process starts off quick, but when it gets to "Setting object reference types", this step alone takes 10 minutes on average.  When I run the same update in the GUI with the same field mappings file, it is instant with a speed of "27000 records per minute".

Any ideas? I'm not getting any errors or anything, its all successful, and nothing in my error logs.
  • August 05, 2007
  • Like
  • 0
Hey everyone,
I am creating a custom s-control, and I am trying to pull all my opportunities with the date of {!TODAY} so it actively refreshes every day.  The problem I am running into is that {!TODAY} code returns a date in the format of 7/22/2007, but the SalesForce date field stores information as 2007-07-22.  So when I run my code for that, I can see the error and the coding that is returned, and it is giving me a Malformed Query because the date format is not matching correctly.
 
Has anyone else ran into this problem? Any suggestions?
Hi,
I'm currently pulling my data using the scripting toolkit through Dos, and saving it into a .CSV file.  The problem I am running into is that some of the fields contain comma's in them and its forcing part of that field into the next column.  I know there is a way to run an If...Then loop to check each variable and remove any comma's, but I'm  drawing a total blank on getting it to work correctly.  Here is my current code for the query:

Code:
function Results(queryResult) {
    if (queryResult.size > 0) {
        var output = "";
        var records = queryResult.getArray("records");
        output += "Start Time" +","+ "Opportunity" +","+ "Implem" +","+ "ProxiAg" +","+ "HybridOp" +","+ "RemoteOp" +","+ "A/V" +","+ "Contact" +","+ "Phone#" +","+ "Launch" + "\r\n";
        for (var i=0;i<records.length;i++) {
            var account = records[i];
            output += account.Start_Time_CST__c + "," + account.Name + "," + account.Implementation__c + "," + account.Proxiagent_Name__c + "," + account.Hybrid_Software_Operator__c + "," + account.Remote_Operator__c + "," + account.Audio_Video_Location__c + "," + account.Client_Contact_Name__c + "," + account.ProxiAgent_Contact_Numbers__c + "," + account.Launch_Support__c + ",test" + ",test" + "," + account.Launch_Support_Notes__c + "," + account.Follow_up_support_notes__c +"\r\n";
        }
        WScript.echo(output);
    }else WScript.echo("No records matched.");
    ToolKit.Quit();
}
var callback = {onSuccess : Results, onFailure : function(e){WScript.echo(e)}};
var queryResult = sforce.connection.query("Select Start_Time_CST__c,Name,Implementation__c,Proxiagent_Name__c,Hybrid_Software_Operator__c,Remote_Operator__c,Audio_Video_Location__c,Client_Contact_Name__c,ProxiAgent_Contact_Numbers__c,Launch_Support__c,Event_Date__c,Follow_up_support_notes__c,Launch_Support_Notes__c from Opportunity where Event_Date__c=2007-06-25", callback);

Right now the fields Name, Follow_up_support_notes__c, and Launch_Support_Notes__c have the possibility of a user entered comma in them. 

Any idea on the string method to use to run through these fields and remove any comma's in the data pulled from them?

Hi, I'm currently designing a custom tab/area to run reports through,
but am having a bit of trouble validating some of the information and I'm at a standstill.

Basically, when I'm running my query I can validate if a checkbox is not checked(false)
and that returns all of my false values correctly.  But, when I try to validate
if the checkbox is checked(true), it returns nothing.
My code is:


var result = sforce.connection.query
("Select Event_Date__c,Name,Launch_Support_Notes__c,Review__c,Follow_up_support_notes__c
From Opportunity Where (Event_Date__c>=2007-05-04 AND Event_Date__c<=2007-05-04)
and Review__c=true ");

The bold is the field name, and the status(true). 

Like I mentioned:When that is changed to false, it works correctly. 
When it is changed to true, it returns no values.
I have also ran my code without the true/false validation, and so it lists all my values
and shows true and false, so I know there are records to be pulled. Any help would be greatly
appreciated! Thanks!

Message Edited by JBerry on 05-25-2007 06:10 PM

Message Edited by JBerry on 05-25-2007 06:11 PM