• Eugene Neiman
  • NEWBIE
  • 105 Points
  • Member since 2012

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 25
    Replies
Hello all


Could any one tell us what are the attributes and what are the Operations or methods in the belo mention code, I am trying to draw an Class UML diagram???


public with sharing class SharedConstants { private static final String STD_OPP_RECORDTYPE = 'Standard_Opportunity'; //use Singleton to query the RecordType only if really needed public static ID STD_OPP_RECORDTYPE_ID { get { if(STD_OPP_RECORDTYPE_ID == null) { STD_OPP_RECORDTYPE_ID = [SELECT Id FROM RecordType WHERE DeveloperName = :STD_OPP_RECORDTYPE AND SobjectType = 'Opportunity' LIMIT 1].Id; } return STD_OPP_RECORDTYPE_ID; } } }

 Thanks in advance

 

Hi All,

 

how would I multiply the unitprice on an opportuniy line item by another field value.

 

   IF(PE.Product2Id == OL.PricebookEntry.Product2Id){
        NOL = New OpportunityLineItem();
            NOL.Opportunityid = op.id;
            NOL.PricebookEntryId = PE.id;
            NOL.Quantity = OL.Quantity;
            NOL.UnitPrice = OL.UnitPrice * IncPer;
            NLI.add(NOL);
        }
    }

 I get

 

Error: Arithmetic expressions must use numeric arguments

 


Is this because Incper is:

 

 String IncPer = '1.' + o.account.Agreed_price_Increase__c;

 In this example IncPer returns 1.10

 

R

 

I am trying to prevent only certain users from choosing Closed Won or Closed Ordered.  I am new at this and the syntax is a little confusing.  The reason I am using the alias field is simply because Roles and Profiles cross over divisions and we have several folks with the same last names.  Please help. Is there a better way to get this to work?


 

OR(
(ISPICKVAL(StageName, "Prospecting"),
(ISPICKVAL(StageName, "Qualifying"),
(ISPICKVAL(StageName, "Solution Proposed"),

(ISPICKVAL(StageName, "Proposal Submitted"),

(ISPICKVAL(StageName, "Recommended"),

(ISPICKVAL(StageName, "Approved"),

( $User.Alias, "ealba"), 
( $User.Alias, "DWard"), 
( $User.Alias, "PTatt"),
( $User.Alias, "TScir"),
( $User.Alias, "DKapp"),
( $User.Alias, "DHillNMI"),
( $User.Alias, "MCasa"),
( $User.Alias, "SColl"))
)

Hello,

 

I am new to Apex so I would like assistance in creating a trigger to automatically update the Opportunity Contact field, with the contact designated as the Renewal Owner (Contact Type) in the contact description.  We have added a field named Contact Type to the Contacts so that we know who to send renewal contracts to.

 

Field Name (field type): API Name:
Opportunity Contact (Lookup(Contact)): Opportunity_Contact__c

Contact type (Picklist): Contact_Type__c

 

The objective of the trigger is to eliminate the need to have to select the contact in the Opportunity Contact lookup field.  This trigger should only fire once (when a new Opportunity is created) and not when someone updates the Opportunity.  If someone wants to change the Opportunity contact to someone else, later on, they should be able to edit that field as well.  Thanks for the help with this.

hi,

     I am developing a webservice in Apex. The xml file is like:

<?xml version="1.0" encoding="UTF-8" ?>
- <Body>
- <InvoiceRequest>
- <Item>
  <ItemName>num1</ItemName>
  <ItemPrice>$11.0</ItemPrice>
  <ItemId>01278390921098209AB872190</ItemId>
 <ItemId>01278390921098209AB872191</ItemId>
  <ItemType>NULL</ItemType>
  </Item>
</Body>

So, there will be more than one id's..i mean the element names may be same, . So in webservice how can i handle this.  PLease its urgent.....Thanx in advance....
..

Hi Friends,

 

I have trigger on case object and I am only trying to count  the number of cases where assisted has been set to yes.

I am only querying using count function which counts the number of records and then I am assigning that number to field on the case object  and finally I insert.However,When get the following error.

 

 

Apex trigger calculate caused an unexpected exception, contact your administrator: calculate: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, calculate: maximum trigger depth exceeded Case trigger event AfterInsert for [500c0000001ZohW] Case trigger event AfterInsert for [500c0000001ZohX] Case trigger event AfterInsert for [500c0000001ZohY] Case trigger event AfterInsert for [500c0000001ZohZ] Case trigger event AfterInsert for [500c0000001Zoha] Case trigger event AfterInsert for [500c0000001Zohb] Case trigger event AfterInsert for [500c0000001Zohc] Case trigger event AfterInsert for [500c0000001Zohd] Case trigger event AfterInsert for [500c0000001Zohe] Case trigger event AfterInsert for [500c0000001Zohf] Case trigger event AfterInsert for [500c0000001Zohg] Case trigger event AfterInsert for [500c0000001Zohh] Case trigger event AfterInsert for [500c0000001Zohi] Case trigger event AfterInsert for [500c0000001Zohj] Case trigger event AfterInsert for [500c0000001Zohk] Case trigger event AfterInsert for [500c0000001Zohl]: []: Trigger.calculate: line 10, column 1

 

 

 

 

 

 

Can somebody help by correcting this trigger.?

 

Trigger calculate on Case(after Insert)
{
integer number1=0;
if(trigger.IsInsert)
{

case c=new case();
number1=[select count() from case where assisted__c='yes'];
c.Count_of_Inquires_Answered__c=number1;
insert c;

}

I have tried alot but am not able to hit the limits for this code, the code provided above is in the most inert state and this is working, but the huge data calls is failing the soql limits.....

public class TW_Eval_FYB_FYE {

    public TW_Eval_FYB_FYE(ApexPages.StandardController controller) {
        }
        
    public static void Run() {
        list<TW_FY_Summary__c> theSummaries = new list<TW_FY_Summary__c>();
        list<TW_Monthly_Trend__c> theTrendsList  = new list<TW_Monthly_Trend__c>();
        set<TW_Monthly_Trend__c> theTrends  = new set<TW_Monthly_Trend__c>();
        list<TW_FY_Summary__c> updateList = new list<TW_FY_Summary__c>();
      
      date dateToday     = date.today();
      integer currMonth   = dateToday.month();
    string currYear    = string.valueOf(dateToday.year());

    //Take the Today() current month and match it to TW fiscal month
    if( currMonth >= 7 ) { currMonth = currMonth - 6; }
    else          { currMonth = currMonth + 6; }

        theSummaries    = [SELECT 
                                         Id, FYE_SF__c, FYB_SF__c, FYE_Headcount__c, 
                                         FYB_Headcount__c, FYE_Seats__c, FYB_Seats__c,
                                         FYB_All_in_Cost__c, FYE_All_in_Cost__c,
                                         Current_Headcount__c, Current_Seats__c, Fiscal_Year__c 
                                         
                                         FROM TW_FY_Summary__c 
                                         ORDER BY Id ASC ];
        
        theTrendsList    = [SELECT 
                                         Square_Feet__c, Seats__c, Headcount__c, GAAP_Ann_All_in_Cost_US__c, 
                                         TW_FY_Summary__c, MonthVal__c
                                         
                                         FROM TW_Monthly_Trend__c 
                                         WHERE MonthVal__c = 1 
                                           OR MonthVal__c = 12 
                                           OR MonthVal__c = :currMonth 
                                         ORDER BY TW_FY_Summary__c ASC ];
        
        for( TW_Monthly_Trend__c z : theTrendsList )
        { theTrends.add(z);  }
        
        //System.Debug( '-------------------------------------------------------------> TRENDS' + theTrends );
        
            for( TW_FY_Summary__c a : theSummaries )
            {
                
                for( TW_Monthly_Trend__c b : theTrends )
                {
                    while( a.Id == b.TW_FY_Summary__c )
                    {   
                        if( b.MonthVal__c == 1  ) 
                                { 
                                        a.FYB_SF__c = b.Square_Feet__c;
                                        a.FYB_Headcount__c = b.Headcount__c; 
                                        a.FYB_Seats__c = b.Seats__c;
                                        a.FYB_All_in_Cost__c = b.GAAP_Ann_All_in_Cost_US__c;
                                          if( b.MonthVal__c == currMonth && a.Fiscal_Year__c == currYear ) 
                                          {
                                            a.Current_Headcount__c = b.Headcount__c;
                                            a.Current_Seats__c = b.Seats__c;
                                          }
                                     theTrends.remove(b);          
                                }
                        
                        else if( b.MonthVal__c == 12 ) 
                                { 
                                        a.FYE_SF__c = b.Square_Feet__c;
                                        a.FYE_Headcount__c = b.Headcount__c; 
                                        a.FYE_Seats__c = b.Seats__c;
                                        a.FYE_All_in_Cost__c = b.GAAP_Ann_All_in_Cost_US__c;
                                          if( b.MonthVal__c == currMonth && a.Fiscal_Year__c == currYear ) 
                                          {
                                            a.Current_Headcount__c = b.Headcount__c;
                                            a.Current_Seats__c = b.Seats__c;
                                          }
                                        theTrends.remove(b); 
                                }
                                
            else if( b.MonthVal__c == currMonth && a.Fiscal_Year__c == currYear ) 
                                          {
                                            a.Current_Headcount__c = b.Headcount__c;
                                            a.Current_Seats__c = b.Seats__c;
                                            theTrends.remove(b);
                                          }
                                                             
                    }
                
                } //end trend loop
                            
            } //end summary loop
        
        update theSummaries ;
    }
}

 

Hello all


Could any one tell us what are the attributes and what are the Operations or methods in the belo mention code, I am trying to draw an Class UML diagram???


public with sharing class SharedConstants { private static final String STD_OPP_RECORDTYPE = 'Standard_Opportunity'; //use Singleton to query the RecordType only if really needed public static ID STD_OPP_RECORDTYPE_ID { get { if(STD_OPP_RECORDTYPE_ID == null) { STD_OPP_RECORDTYPE_ID = [SELECT Id FROM RecordType WHERE DeveloperName = :STD_OPP_RECORDTYPE AND SobjectType = 'Opportunity' LIMIT 1].Id; } return STD_OPP_RECORDTYPE_ID; } } }

 Thanks in advance

 

Hi All,

 

how would I multiply the unitprice on an opportuniy line item by another field value.

 

   IF(PE.Product2Id == OL.PricebookEntry.Product2Id){
        NOL = New OpportunityLineItem();
            NOL.Opportunityid = op.id;
            NOL.PricebookEntryId = PE.id;
            NOL.Quantity = OL.Quantity;
            NOL.UnitPrice = OL.UnitPrice * IncPer;
            NLI.add(NOL);
        }
    }

 I get

 

Error: Arithmetic expressions must use numeric arguments

 


Is this because Incper is:

 

 String IncPer = '1.' + o.account.Agreed_price_Increase__c;

 In this example IncPer returns 1.10

 

R

 

Hello all

 

 

Could any one explain this part of code, I am unable to understand 

	// Internal mapping of handlers
	Map<String, List<Handler>> eventHandlerMapping = new Map<String, List<Handler>>();

	/**
	 * Core API to bind handlers with events
	 */
	public Triggers bind(Evt event, Handler eh) 
	{
		List<Handler> handlers = eventHandlerMapping.get(event.name());
		if (handlers == null) 
		{
			handlers = new List<Handler>();
			eventHandlerMapping.put(event.name(), handlers);
		}
		handlers.add(eh);
		return this;
	}

 The above code belongs to the standard trigger template

 

 

Thanks in advance 

Suneel

The query I wrote is this...

Select id, License_Certificate_Number__c, Type__c, Start_Date__c, Expiration_Date__c, State__c,
(Select id, License_Certificate_Number__c, Type__c, Start_Date__c, Expiration_Date__c, State__c
from Qualification__c where Provider__c='00540000000x5ha' and RecordTypeId='01230000000DHlx'),
(Select id, License_Certificate_Number__c, Type__c, Start_Date__c, Expiration_Date__c, State__c
from Qualification__c where Provider__c='00540000000x5ha' and RecordTypeId='01230000000DHmR')

 I'm trying to get it to act similarly to this query in SQL....

SELECT a.name,a.Region__c ,rt.Name, 
 qd.Type__c DEAType ,qd.State__c  ,qd.License_Certificate_Number__c DEANumber ,
c.Name,c.GlobalProviderID__c
, qs.Type__c StateLincType,qs.License_Certificate_Number__c StateLinc,qs.State__c ,
qb.Type__c StateLincType,qb.License_Certificate_Number__c StateLinc,qb.State__c 
FROM dbo.Account a 
      INNER JOIN RecordType rt ON a.RecordTypeId =rt.Id 
      INNER JOIN dbo.Provider_Facility_Associations__c pfa on pfa.Hospital__c  =a.id
      INNER JOIN dbo.Contact c on c.id =pfa.Provider__c
      LEFT OUTER JOIN dbo.Qualification__c qD ON qd.Provider__c =c.id AND qd.RecordTypeId ='01230000000DHlxAAG' AND qd.Type__c ='DEA'
      LEFT OUTER JOIN dbo.Qualification__c qS ON qs.Provider__c =c.id AND qs.RecordTypeId ='01230000000DHlxAAG' AND qs.Type__c ='State Medical' AND qs.State__c =a.Physical_State__c
      LEFT OUTER JOIN dbo.Qualification__c qB ON qb.Provider__c =c.id AND qb.RecordTypeId ='01230000000DHmRAAW' 

 
I'm trying to display multiple qualification records in the same row of their associated contact. Any help would be greatly appreciated.

Hi All,

 

Here is my controller & VF page.

 

My save button is not working when i'm saving date after modification.

 

Please need help. It's urgent.

 

VF Page:-

 

<apex:page standardController="Contract"    extensions="RevenueScheduleForOpportunity">
    <apex:form id="myForm">
        <apex:pageBlock title="schedule" id="pgBlckSchedule">
            
            <apex:pageBlockButtons >
                 <apex:commandButton value="Edit" action="{!editRevenueSchedule}" />
<!--                   <apex:commandButton value="Save1" action="{!savedRevenueSchedule}"/> -->
                 
                  <apex:commandButton value="SaveNew" action="{!savedRevenueSchedule1}"/>  
            </apex:pageBlockButtons>
            
            <apex:pageBlockTable value="{!OpportunityLineItemSchedule}"
                var="oppLineItemSchedule" rendered="{!bIsDisplay}">

                <apex:column >
                    <apex:facet name="header">Date</apex:facet>
                    <apex:outputText value="{0,date,dd/MM/yyyy}">
                        <apex:param value="{!oppLineItemSchedule.ScheduleDate}" />
                    </apex:outputText>
                </apex:column>

                <apex:column >
                    <apex:facet name="header">Revenue</apex:facet>
                    <apex:outputText value="{!oppLineItemSchedule.Revenue}" />
                </apex:column>

                <apex:column >
                    <apex:facet name="header">Comments</apex:facet>
                    <apex:outputText value="{!oppLineItemSchedule.Description}" />
                </apex:column>

        </apex:pageBlockTable>
                    
        <apex:pageBlockTable value="{!editedList}"  var="objEdit" rendered="{!if(bIsDisplay == false, true, false)}">

                
<!--                 <apex:pageBlockTable value="{!editedList}"  var="objEdit" rendered="true"> -->
                <apex:column >
                    <apex:facet name="header">Date</apex:facet>
                    <apex:inputText value="{!objEdit.scheduleDate}" >
<!--                         <apex:param /> -->
                    </apex:inputText>
                </apex:column>

                <apex:column >
                    <apex:facet name="header">Revenue</apex:facet>
                    <apex:inputText value="{!objEdit.revenue}">
<!--                     <apex:param value="{!objEdit.revenue}" /> -->
                    </apex:inputText>
                </apex:column>

                <apex:column >
                    <apex:facet name="header">Comments</apex:facet>
                    <apex:inputText value="{!objEdit.description}" />
                </apex:column>

        </apex:pageBlockTable>
        
    </apex:pageBlock>        
    </apex:form>
</apex:page>

 

Controller:-

 

public with sharing class RevenueScheduleForOpportunity
{
    public List<OpportunityLineItemSchedule> lstOppLineItemSch;
    public boolean bIsDisplay{get; set;}
    
    public List<editRevenueSchedule> editedList{get; set;}
    OpportunityLineItem objOpportunityLineItem;
    Map<Id, OpportunityLineItemSchedule> opportunityLineItemScheduleMap = new Map<Id, OpportunityLineItemSchedule>();
    
    public RevenueScheduleForOpportunity(ApexPages.StandardController stdController)
    {
            system.debug('=========In parametrized standard Constructor=>');
              Contract objContract = (Contract)stdController.getRecord();
            objContract = [Select Opportunity__c From Contract where Id =:objContract.Id];
            //System.debug('List of Contracts=======>'+objContract);
            objOpportunityLineItem = [Select OpportunityId, Id From OpportunityLineItem
                                                       Where OpportunityId =:objContract.Opportunity__c];
            //System.debug('List of OpportunityLineItem====>'+objOpportunityLineItem);
            bIsDisplay  = true;
    }
    
    public List<OpportunityLineItemSchedule> getOpportunityLineItemSchedule()
    {
        if(lstOppLineItemSch==null)
        {
            opportunityLineItemScheduleMap = new Map<Id, OpportunityLineItemSchedule>([Select OpportunityLineItemId, ScheduleDate, Revenue, Description
                                                                                                                                              From OpportunityLineItemSchedule
                                                                                                                                              Where OpportunityLineItemId=:objOpportunityLineItem.Id
                                                                                                                                              Order by ScheduleDate]);
                                                                                                        
            lstOppLineItemSch = opportunityLineItemScheduleMap.values();
            lstOppLineItemSch.sort();
            System.debug('List of OpportunityLineItemSchedule==========='+opportunityLineItemScheduleMap.size());
            //List<editRevenueSchedule> lst = getEditRevenueSchedule();
        }
        //return opportunityLineItemScheduleMap.values();
        return lstOppLineItemSch;
    }
    
    public void editRevenueSchedule()
    {

        bIsDisplay = false;            
        //system.debug('=========In===>');
        //bIsDisplay  = true;
        //Pagereference editRef = new Pagereference('/apex/RevenueScheduleSave');
        //editRef.setRedirect(true);
        
        editedList  = new List<editRevenueSchedule>();
        //List<editRevenueSchedule> lsteditRevenueSchedule = new List<editRevenueSchedule>();
        editRevenueSchedule objEdit;
        
        if(lstOppLineItemSch != null)
        {
            for(OpportunityLineItemSchedule objOpp : lstOppLineItemSch)
            {
                objEdit = new editRevenueSchedule();
                system.debug('=========In==For=>');
                objEdit.scheduleDate = (objOpp.ScheduleDate != null) ? objOpp.ScheduleDate : Date.valueOf('');
                objEdit.revenue = (objOpp.Revenue != null) ? objOpp.Revenue : 0.0;
                objEdit.description = (objOpp.Description != null) ? objOpp.Description : '';
                objEdit.Id= objOpp.Id;
                editedList.add(new editRevenueSchedule(objEdit.scheduleDate, objEdit.revenue , objEdit.description,  objEdit.Id));
                //system.debug('List lsteditRevenueSchedule in for loop of getEditRevenueSchedule ============>'+lsteditRevenueSchedule);
                system.debug('Size of list editedList in getEditRevenueSchedule function======'+editedList);
            }
            //editedList.addAll(lsteditRevenueSchedule);
        }
    
    //    return null;
    }
    
    public Pagereference savedRevenueSchedule1()
    {
        system.debug('=== Exceuted');
        List<OpportunityLineItemSchedule> opportunityLineItemScheduleList = new List<OpportunityLineItemSchedule>();
        OpportunityLineItemSchedule objOppLineItmSc = new OpportunityLineItemSchedule();
        
        if(editedList != null)
        {
            system.debug('==If  =Exceuted'+editedList.size());
            for(editRevenueSchedule objEditSc : editedList)
            {
                system.debug('===For==========Exceuted');
                if(opportunityLineItemScheduleMap.containsKey(objEditSc.Id ))
                {
                    System.debug('===If=========Exceuted');
                    objOppLineItmSc = new OpportunityLineItemSchedule();
                    objOppLineItmSc = opportunityLineItemScheduleMap.get(objEditSc.Id);
                    objOppLineItmSc.ScheduleDate = objEditSc.scheduleDate;
                    objOppLineItmSc.Revenue = objEditSc.revenue;
                    
                    objOppLineItmSc.Description = objEditSc.description;
                
                    opportunityLineItemScheduleList.add(objOppLineItmSc);
                }
            }
            
            if(opportunityLineItemScheduleList !=null)
            {
                List<Database.Saveresult> bdSave = database.update(opportunityLineItemScheduleList) ;
                System.debug(' List after clicking save button ==============>'+bdSave);
            }
        }
        return null;
    }
    
    public class editRevenueSchedule
    {
        public Date scheduleDate{get;set;}
        public Double revenue{get;set;}
        public String description{get;set;}
        public String Id{get;set;}
        
        public editRevenueSchedule (){}
        
        public editRevenueSchedule(Date scheduleDate, Double revenue, String description, Id oppLISchedule)
        {
            this.scheduleDate = scheduleDate;
            this.revenue = revenue;
            this.description = description;
            this.id = oppLISchedule;
        }            
    }
        
}

Hi

 

i am new to salesforce how to print 1 to 10 numbers in salesforce.
can you please give me Apex class and testclass for this.

 

i wrote a class

 

public class printTenNumbers{
public integer num{get;set;}
public integer print(){
for(num=0;num<=10;num++){
system.Debug(num);
}
return num;
}
}

 

how to check whether it is working or not.

 

Regards.

I need a fresh set of eyes on this trigger. Can some one take am moment  and perhaps point me in the right direction?

 

Trigger:

trigger Opportunity on Opportunity (before insert, before update) {
	System.debug('Alerting on Opportunity Trigger --------------------> Starting ');
	for(Opportunity o:trigger.new){

		Boolean boolStage;
		Boolean booRec;
		Boolean boolClose;

			if(trigger.isUpdate){
				Opportunity oldOpp = Trigger.oldMap.get(o.id);
				if(oldOpp.StageName != o.StageName){
					boolStage = true;
				}
				if(oldOpp.CloseDate != o.CloseDate){
					boolClose = true;
				}
			}
			
//			for(integer i=0;i<rec.size();i++){
				if(boolStage == true ){
			//StageName = 1-Qualification Complete/Research, 0-Prospecting	
				if(o.StageName == '0-Prospecting' || o.StageName == '1-Qualification Complete/Research'){
					o.Forecast_Identifier__c = 'Lead';
			//StageName = 2-Assessment, 3-Justification, 4-Internal Estimate
				}else if(o.StageName == '2-Assessment' || o.stageName == '3-Justification' || o.StageName == '4-Internal Estimate'){
					o.Forecast_Identifier__c = 'Open';
			//StageName = 5-Final Proposal
				}else if(o.StageName == '5-Final Proposal'){
					o.Forecast_Identifier__c = 'Upside';
			//StageName = 6-Vendor Selection, 7-Contract
				}else if(o.StageName == '6-Vendor Selection' || o.StageName == '7-Contract'){
					o.Forecast_Identifier__c = 'Committed';
			//StageName = 8-Closed
				}else if(o.StageName == '8-Closed'){
					o.Forecast_Identifier__c = 'Won';
		 		 }
				}else if(!trigger.isUpdate){
			//StageName = 1-Qualification Complete/Research, 0-Prospecting	
				if(o.StageName == '0-Prospecting' || o.StageName == '1-Qualification Complete/Research'){
					o.Forecast_Identifier__c = 'Lead';
			//StageName = 2-Assessment, 3-Justification, 4-Internal Estimate
				}else if(o.StageName == '2-Assessment' || o.stageName == '3-Justification' || o.StageName == '4-Internal Estimate'){
					o.Forecast_Identifier__c = 'Open';
			//StageName = 5-Final Proposal
				}else if(o.StageName == '5-Final Proposal'){
					o.Forecast_Identifier__c = 'Upside';
			//StageName = 6-Vendor Selection, 7-Contract
				}else if(o.StageName == '6-Vendor Selection' || o.StageName == '7-Contract'){
					o.Forecast_Identifier__c = 'Committed';
			//StageName = 8-Closed
				}else if(o.StageName == '8-Closed'){
					o.Forecast_Identifier__c = 'Won';
		 		 }
				}
				
				if(boolClose == true){
					o.Target_Complete_Date__c = o.closeDate+90;
					o.General_Availability_Date__c = o.closeDate+90;
				}
//			}
		

		} 

	}

 TestCase:

@isTest(seeAlldata=true)
private class TestOpportunityTrigger {

    static testMethod void myUnitTest() {
    	System.debug('Alerting on TestOpportunityTrigger --------------------> Starting');
    List<RecordType> rec = [Select id, name from RecordType where sobjecttype = 'Opportunity' and name = 'Business Development'];    

	Account acc = new Account();
	acc.Name = 'Test';
	acc.ShippingStreet = '123 Est Street';
	acc.ShippingCity = 'Home';
	acc.ShippingState = 'AL';
	acc.ShippingPostalCode = '36105';
	insert acc;
	System.debug('Alerting on --------------------> acc Details'+acc);
	
	List<String> stName = new List<String>{'0-Prospecting','1-Qualification Complete/Research','2-Assessment','3-Justifiction','4-Internal Estimate','5-Final Proposal','6-Vendor Selection','8-Closed'};
	for(integer p=0;p<200;p++){
		for(Integer i=0;i<stName.size();i++){
		Opportunity opp = new Opportunity();
		opp.RecordTypeId = rec[0].id;
		opp.StageName = stName[i];
		opp.AccountId = acc.id; 
		opp.Name = 'TestOpp';
		opp.Type = 'Availity Connect';
		opp.CloseDate = date.today();
		opp.Opportunity_States__c = 'AL';
		opp.Description = 'Testing';
		System.debug('Alerting on --------------------> opp Details'+opp);
		try{
			insert opp;
		}catch (Dmlexception e){
			System.debug('Insert Failed '+e);
		}

			opp.StageName = '0-Prospecting';
			opp.CloseDate = opp.CloseDate+4;
			try{
			update opp;	
			}catch (DmlException e) {
				System.debug('Update Failed '+e);
			}

		}
	}
	
	
    }
}

 

 

  • March 01, 2013
  • Like
  • 0

I start by going to the developer console and Choosing "Triggers" within the Setup Entity Type, then below, I choose a Type from the selection list and click the "New" button to the left of the list. After thinking for a few seconds, the platform responds with a window that looks like:

 

--------------------------------------------------------------------------

ENTITY_IS_LOCKED

 

Can not create Apex Trigger on an active organization.

 

OK

--------------------------------------------------------------------------

 

This message is really meaningless to me. Can anyone help decipher it?

 

Beginner question:  

Can I develop commercial extensions /  applications to run with salesforce.com data and can be sold to salesforce.com customers ?

 

How profitable can it be ? any examples ?

Is there a reporistory of all top applications ?

 

Thanks,

 

  • March 01, 2013
  • Like
  • 0

Hi, I am unable to generate code from the WSDL file.

 

I am getting the following errors. I am using WSIMPORTS for generation of java classes from the wsdl. Thanks in advance...

 

 

[WARNING] src-resolve: Cannot resolve the name 'ens:sObject' to a(n) 'type defin
ition' component.

 


[ERROR] A class/interface with the same name "net.periodictable.DescribeLayout"
is already in use. Use a class customization to resolve this conflict.

 

[ERROR] (Relevant to above error) another "DescribeLayout" is generated from her
e.

 

[ERROR] Two declarations cause a collision in the ObjectFactory class.

 

[ERROR] (Related to above error) This is the other declaration.

Hi,

 

I am getting error "Query is either selecting too many fields or the filter conditions are too complicated." while running my code.

 

My code is where I getting this error is :

 

List<Sim_CaseReportHistory__c> caseRepHisList = [Select id, TotalQueueTime__c, TotalWorkTime__c, Field_API_Name__c, Owner_Type__c, Actual_Owner_Is_User__c, Case_number__c
from Sim_CaseReportHistory__c where Case_Number__c in : caseNumSet and Is_Migrated__c=true and Field_API_Name__c='Owner'
and CreatedDate__c>=:Sim_Util.getActualStartDateTimeObject(dCurrentDate) and CreatedDate__c<=:Sim_Util.getActualDateEndTimeObject(dCurrentDate)];

 

Any suggestion? Please rply.

 

I am trying to prevent only certain users from choosing Closed Won or Closed Ordered.  I am new at this and the syntax is a little confusing.  The reason I am using the alias field is simply because Roles and Profiles cross over divisions and we have several folks with the same last names.  Please help. Is there a better way to get this to work?


 

OR(
(ISPICKVAL(StageName, "Prospecting"),
(ISPICKVAL(StageName, "Qualifying"),
(ISPICKVAL(StageName, "Solution Proposed"),

(ISPICKVAL(StageName, "Proposal Submitted"),

(ISPICKVAL(StageName, "Recommended"),

(ISPICKVAL(StageName, "Approved"),

( $User.Alias, "ealba"), 
( $User.Alias, "DWard"), 
( $User.Alias, "PTatt"),
( $User.Alias, "TScir"),
( $User.Alias, "DKapp"),
( $User.Alias, "DHillNMI"),
( $User.Alias, "MCasa"),
( $User.Alias, "SColl"))
)

It only has 1 query in a map which is not in a loop. Does "get" count as a query?

 

FYI, this works when updating Accounts in batches of 20 but not in batches of 50 or more.

 

 

trigger Territory on Account (after insert, after update) {

List<Account> ac = new List<Account>();
public list<string> name = new List<string>();

for(integer j=0; j < trigger.new.size();j++){
name.add(trigger.new[j].territory_OEM__c);  
name.add(trigger.new[j].territory_Direct__c); }

Map<String,String> territory = new Map<String,String>();
for (Territory__c t :[SELECT name, owner__c from Territory__c where name in :name])
{territory.put(t.name, t.Owner__c);}

for(integer i=0; i < trigger.new.size();i++){
If(
trigger.isinsert || (trigger.isupdate

&& (trigger.new[i].Temp__c == 62 && trigger.old[i].Temp__c != 62 ||
trigger.new[i].billingcountry != trigger.old[i].billingcountry ||
trigger.new[i].billingstate != trigger.old[i].billingstate ||
trigger.new[i].billingpostalcode != trigger.old[i].billingpostalcode ||
trigger.new[i].company_size__c != trigger.old[i].company_size__c
))

){
if(Territory.containsKey(trigger.new[i].Territory_OEM__c) && Territory.containsKey(trigger.new[i].Territory_Direct__c)){
ac.add(new account(
ID = trigger.new[i].ID,
territory_owner_OEM__c = territory.get(trigger.new[i].Territory_OEM__c),
territory_owner_direct__c = territory.get(trigger.new[i].Territory_Direct__c)
));else{}
}

if(ac.size() > 0){update ac;}else{}

}else{}}}

 

trigger ContactS on Contact (after delete, after insert)

{

Contact[] con;

con = Trigger.new;

Set<ID> acctIds = new Set<ID>();

Map<ID, Account> Update = new Map<ID, Account>([select Id,Count__c from Account where Id in :acctIds]);

for (Account acct : acctsToUpdate.values()) {
Set<ID> conIds = new Set<ID>();

if (acct.Count__c != conIds.size())
acct.Count__c = conIds.size();
}

update acctUpdate.values();

}

 

Thanks.