• @login.ax974
  • NEWBIE
  • 30 Points
  • Member since 2011
  • Architect

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 25
    Replies
Is something like this possible? I have 3 objects. 2 are related via lookup. I'd like to compare the value of a field in 2 of the objects (unrelated) and if it matches, pull a field from 1 of those objects to update into a 3rd object (that's also not related to the one I'm getting the data from)

So it would be something like this: 
If Account.field = User.field then set ObjectC.field=User.field2. 
Account and ObjectC are related to each other via a lookup. The user would be unrelated to the account or ObjectC(not an owner, etc). 
 
Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger VisitTriggers caused an unexpected exception, contact your administrator: VisitTriggers: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0Cf0000007rjNsEAI; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = a0Cf0000007rjNs) is currently in trigger VisitTriggers, therefore it cannot recursively update itself: []: Class.VisitTriggerHandler.OrderRaisedVisitUpdate: line 255, column 1

for this code

 Private void OrderRaisedVisitUpdate(Map<id,Visits__c> visitsMap)
    {
        Id visitid;
        List<Visits__c> visit = visitsMap.values();
         
        //public String visitId;
        //visitId=ApexPages.currentPage().getParameters().get(VisitList);
        //Visits__c visit=[select id,Order_Raised__c from Visits__c where id=:visitid];
        Visits__c vt=[select id,Order_Raised__c from Visits__c where id =: visit[0].id ];
        for(AggregateResult result :[select Visit__c,sum(Total_Amount__c) total from SFDC_Purchase_Order__c where Visit__c =:visit[0].id group by Visit__c]){
            tot=Double.valueOf(result.get('total'));
           }
          vt.Order_Raised__c =tot;
          update vt; // get error this update field
         }

I have create two object for visit and SFDC_supplier_purchase_Order. when purchase order raised in SFDC_supplier_purchase_Order at that time get total amount and add into the visit field purchase order raised. When purchase order rasie, repeatley do this.


 
We have an app that schedules a nightly job to run updates. For some orgs, we keep seeing exceptions like these:

Developer script exception from {company name}. : '<unknown>' : Inactive User, orgId: {orgId} userId: {userId}

Apex script unhandled exception by user/organization: {userId}/{orgId}
 
Failed to process batch for class '<unknown>' for job id '707C000001g2yQT'

I'm not really sure what to do on the develper side to make these go away. Thanks in advance for any tips!
 
I have a record type on the lead object that requires the email field to be hidden. Salesforce does not allow the email field to be hidden on the page layout of the lead object. I cannot use field level permissions to hide this field either, as the email field is used for other integrations. I just need the email to be hidden from users for this record type. I have a visualforce page that has everything I need. How can I have this page displayed when the lead is this particular record type?
Doing Callout ,
Whenever I try to send request to secured Gateway , it ends up giving me this error , Could you please help

Hello everyone,

 

I have overriden standard opportunity Edit feature. In order to provide inline edit i have to also override the view. The VF page used for the view is very simple and is as below. But now there is a problem. Another VF page which was embeded earlier as part of the opportunity page layout now comes as blank with this overriden view. I guess it is because of the detail tag - how can now i adjust that VF page with this functionality?

 

<apex:page standardcontroller="Opportunity">
    <apex:form >
        <apex:detail subject="{!opportunity.Id}" relatedlist="true" inlineedit="true"/>    </apex:form>
</apex:page>

Hi,

 

I am trying to develope a POC with CTI 4.01 but am not able to see Contracts as an object in my soft phone layout. Is there a reason for it? I have a phone field on the contract and want the system to check that as well for the incoming calls. Can someone please help me know if there is any other configuration to get this done.

 

Thanks so much.

Best Regards. 

Hi,

 I am trying to clone an opportunity with quote and its line items only if the quote is synced. But after the opportunity is created and if i go the new quote of the cloned opportunity it doesn't allows me to start the sync. It still holds the reference of the old opportunity and errors out. Has someone faced this type of situation and know the fix?

Thanks.

Hi,

 

 I am trying to get the content from a VF page and store it as an attachment. So i am doing below:

 

PageReference pg = new PageReference('/apex/myDoc?oppId=' + oppId);

pg.setRedirect(true);

 

Attachment att = new Attachment();

att.Body = pg.getContent(); <--- Here i get java.net.SocketException: Connection reset but it is intermittent and not reproducible.

 

Any idea why is this happening?

 

Thanks for the help!!

 

 

Hi,

 

I am invoking my batch class from a scheduler. In the scheduler i am calling the same batch class twice with different query and parameters one by one like below:-

 

A_Batch batch1 = new A_Batch('B1', query1);
Database.executeBatch(batch1, 200);
            
A_Batch batch2 = new A_Batch('B2', query2);
Database.executeBatch(batch2, 200);

 

Can i assume that my batch2 be called only after batch1 is processed or queue'd?

 

Thanks.

Hi,

 

 Can someone please help me here - i am getting this error 

line 7, column 27: Method does not exist or incorrect signature: accountContractMap.get(String)

 

Map<Id, List<Contract>> accoutContractMap = new Map<Id, List<Contract>>();
//Prepare the map of Account Id as key and the list of contracts associated with it
for(Contract c: [SELECT Id, AccountId, CreatedDate, Status from Contract Limit 100])
{
if(accoutContractMap.get(c.AccountId) != null)
{
System.debug(accountContractMap.get(c.Status));
accountContractMap.get(c.AccountId).add(c);
}
else
{
List<Contract> temp = new List<Contract>();
temp.add(c);
accountContractMap.put(c.AccountId, temp);
}
}
System.debug('Map of account id and the list of contracts is' + accoutContractMap);

 

thanks so much.

We have a number of problems with phone number entries, our contacts integrate with another system and we are having failures due to unseen characters being entered into phone numbers... these seem to happen when numbers are copy paste into salesforce.

 

The user cannot see them and is not aware, sometimes this can simply be a leading or trailing 'space'.. I want to add validation that will ensure numbers are added and cannot be saved with these present, Im wondering the best way to do it as there are so many different ways to enter a phone number, is there a REGEX for it? We mainly work on UK numbers but could have to add international. Thanks

Is there a guideline document for SOQL optimization.? How much should I worrry about performance issues due to sub query?

 

Thanks,

Dipu 

 

I have these number of records in the database for the following queries:

 

Total Parent__c records = 2800

Total Child__c records  = 77,800

 

On an average, each parent has around 30 childs.

 

When I run the following piece of code, I get a governor limit error (query row). Note that I get retrieving only 10 parent records! I still get this error. I  debug log says that only 177 records out of allowed 10,000 were retrieved.  Seems like there is some issue with Childs__r.size() statement. 

 

 

 

for (Parent__c p: [select Name,
(select Name from Childs__r)
from Parent__c limit 20] {
i++;
System.debug('i is ' + i);
System.debug('Name is ' +p.Name);
Double count =p.Childs__r.size();
System.debug('Child Count is ' + count);


}

 

System Log says:

 

 

12:44:31 ERROR - Evaluation error: System.QueryException: Aggregate query has too many rows for direct assignment, use FOR loop

 

Resource usage for namespace: (default)

Number of SOQL queries: 1 out of 100

Number of query rows: 177 out of 10000

Number of SOSL queries: 0 out of 20

Number of DML statements: 0 out of 100

Number of DML rows: 0 out of 10000

Number of script statements: 51 out of 200000 

 

 

When I write a differenr query where I get 1100 Parents, the query ran for 6 minutes and and I loop through every child of it,  I am able to go through 29678 records (i=29678).  The debug log says that that number of query rows is 1267...records...what's going on? 

 

 

for (Parent__c p: [select Name,
(select Name from Childs__r)
from Parent__c limit 1100] {

for (Child__c c:p.Childs__r) {

i++;
System.Debug(‘Child Name is ‘ + c.Name);
}

}

System.debug('i is ' + i);

 

 Debug Log:

 

Resource usage for namespace: (default)

Number of SOQL queries: 1 out of 100

Number of query rows: 1267 out of 10000

Number of SOSL queries: 0 out of 20

Number of DML statements: 0 out of 100

Number of DML rows: 0 out of 10000

Number of script statements: 59362 out of 200000

Maximum heap size: 938 out of 1000000 

 

 

 

 

Message Edited by GoForceGo on 03-02-2009 12:47 PM
Message Edited by GoForceGo on 03-02-2009 12:47 PM
Message Edited by GoForceGo on 03-02-2009 12:48 PM