New answers tagged

0

I was finally able to fix the issue. At a point after making some changes, I started getting other errors which only affected the internal users but with this final changes I got it to work. @TestVisible private static final String UNALLOCATED_STUDY_ERROR_MSG = 'You have not been allocated to work on this study. Please select the correct study'; Set<Id&...


2

Your code has a lot of problems. You have an unnecessary nested loop, you're querying every record in the database every time you want to apply a gift card, your trigger will end up reducing the amount with every edit until your opportunity's amount goes so low you'll actually pay your customers to take your service/product off your hands, etc. You need to ...


0

First of all, are you sure that it is caused by Case Assignment rules executing (and not some other automation)? The debug log is key here. If the assignment rules are intended to be invoked, then you need a rule at the top that looks at values on the record and assigns it back to the current owner when you don't want the assignment rules to do anything if ...


-1

trigger contactinsert on Contact (before insert) { list <id>acclist=new list<id>(); for (contact con:trigger.new){ acclist.add(con.accountid); } map<id,account>mapAccId=new map<id,account>([select id,(select id from contacts) from account ...


1

Premature optimization is evil. Before you start thinking about optimizing, you need to figure out 2 things: What specific thing do I want to improve (cpu time used, queries used, number of records able to be processed, etc...)? How can I measure that thing I want to improve? In this case though, I don't think you're looking to optimize. Instead, this is ...


1

When you use List<SObject> as a filter value in SOQL, it pulls the Id field. Since you are passing List<OpportunityContactRole>, this filter will not look for What.Type = 'Opportunity', which is ostensibly what you are looking for. The basic problem is you need a Set<Id> opportunityIds or List<Opportunity>. I would opt for the former ...


Top 50 recent answers are included