• Andrew Vu
  • 0 Points
  • Member since 2015

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 2
Hi Guys,

I'm a newbie with Apex coding and I'm trying to summarize the value of List and then have the output to a field in the Account.

My Trigger is on Account object and I'm trying to query all the Contacts and then Sum a number field from contact object. (Like Roll up summary field)

List<Contact> conList = [SELECT NumFieldFromContact__c FROM CONTACT WHERE ID IN: <AccountID>];

Account A has 3 Contacts, and the NumFieldFromContact__c contains 10 value. So when my trigger run, the field under Account Object should be updated with the 30 Value.

Here's what I'm testing in Developer Console.

String accID = '0019000001EnVzf';
List<Contact> conList = [SELECT NumFieldFromContact__c FROM Contact WHERE contact.Account.id = :accID];

Integer i=0;
Double x;
Double y;

Do {
    x = conList[i].Formula_Number_Field__c;
    y = x + x;
} WHILE (i<conList.size());

Just experimenting on how things works. Can anyone please give me a correct syntax and Explanation of the Line? :)
Hi All,
We have an integration system that has been running for more than 2 years without any problems. The system creates contacts / leads...etc via the API.
Two days ago we started getting the XML response below everytime we try to create leads....the message says: :insufficient access rights on cross-reference id
Did something chnage in the API recently ? our code hasnt been updated for two years...would it be some new permissions ?
The XML response looks like this:
  <?xml version="1.0" encoding="UTF-8" ?>
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Body>
- <createResponse xmlns="urn:partner.soap.sforce.com">
- <result>
- <errors>
  <fields xsi:nil="true" />
  <message>insufficient access rights on cross-reference id</message>
  <id xsi:nil="true" />
  • July 17, 2007
  • Like
  • 0