• KenS
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies
Hi,
I'm guessing this will take someone 2 mins for someone but I've been struggling for quite a bit longer.
I'm almost there with my first Scontrol (thanks to the excellent resources on these boards)

I've got the functionality I'm after working with a button but now I want to take it to the next step and make at inline scontrol that executes when someone looks at the page.

Can someone please hep and advise the tweaks required. (and if there are any other obvious changes that should be made etc .. feel free comment)


Ken

Code:
 <script
src="/soap/ajax/10.0/connection.js"
type="text/javascript"></script>

<script>


queryResult = sforce.connection.query(
"SELECT Stock__r.GSTcostallocation__c FROM Opportunity_to_Stock__c where Opportunity__r.Id = '{!Opportunity.Id}'")
queryResultIterator = new sforce.QueryResultIterator(queryResult)
total = 0
while(queryResultIterator.hasNext())
{ Stock_Sub = queryResultIterator.next()
total += Stock_Sub.Stock__r.getFloat('GSTcostallocation__c')
}
oppty = new sforce.SObject("Opportunity")
oppty.Id = "{!Opportunity.Id}"
oppty.GSTcostallocation__c = total
result = sforce.connection.update([oppty])


</script>

 

  • November 08, 2007
  • Like
  • 0
Hi,

Basically I'm trying to query an intersection table to get the sum of a field for the records on one lookup and then update this summed value on another lookup of the relationship.

I'm using ajax tools to help me in this but I am now stuck.  I've tried a couple of different methods but seem unable to sum the value of costallocation.  Is this because I am approaching from stock__r?

In trying to work out the problem I have run the attached in the samples page and get the following error:
"oops something went wrong Unable to parse int field: Stock__r.GSTcostallocation__c"

Any help appreciated :-)


Code:
  var result = sforce.connection.query("SELECT Stock__r.name, Id, Stock__r.costallocation__c FROM Opportunity_to_Stock__c where Opportunity__r.Id = '00620000003L4A2'", {
    onSuccess : success, onFailure : failure});

  function success(result) {
total = 0
    var it = new sforce.QueryResultIterator(result);
    while(it.hasNext()){
      var record = it.next();

total += record.getInt('Stock__r.costallocation__c')
      log(record.Stock__r.costallocation__c + "--" + total + "--" + GST);
    }
  }

  function failure(error) {
    log("oops something went wrong " + error);
  }

 

 
  • November 05, 2007
  • Like
  • 0
Is it possible to install the Google Calendar Mash up
 
in the prerelease environment?
 
I have been able to make the required remote proxy settings, I just can't seem to download the S Control from the referenced app exchange link (because of the prelease environment).  When I search the app exchange from the pre-release environment I can't find the mash-up.
 
Cheers
  • July 04, 2007
  • Like
  • 0
Hi all,

I'm using the apex data loader to upload account teams (we have a complex coverage model) and am having trouble setting the access level for the team members.  I can set it correctly via the gui but with thousands or records that's not really feasible.

I am able to load the account teams but I am not able to set the access rights. Team members are defaulting to read only and and I need account team members to be able to edit the records.  The problem is in the data loader I don't see a field to map the required value to. 

I have also tried the sforce excel connector to export the data I've loaded and update the value of the accountaccesslevel but to no avail.

Details:
Account Default Sharing - public read only
sharing Rules - none

  • March 15, 2007
  • Like
  • 0
Hello,
I am currently using this app (searchfirstcreate) created by the Salesforce labs in production.  I'm in the final stages of testing B2C - Person Accounts in my sandbox, and this s-control does not function properly.  Has anyone used this successfully with Person Accounts? 
 
The long and short of it...I search for the last name 'Test' and it finds the 'Test' records for Contacts, Leads, Users, etc...but it does not find the 'Test' Person Accounts that I see in my Accounts table.  Am I missing something?  What modifications are necessary to make this work properly with regards to Person Accounts?
 
Any help is greatly appreciated.  Thanks!  :smileyhappy:
  • June 05, 2007
  • Like
  • 0