• EtienneCoutant
  • NEWBIE
  • 105 Points
  • Member since 2008

  • Chatter
    Feed
  • 4
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 33
    Replies

Hi All,

 

Greeting to All

 

I would like know the what is best way to customize the saleforce interface , which include the creating custome buttons & associated funcationality? Can you advise on any article?

 

 

 

 

Thanks,

Rao

Hi All,

 

I am at the end of my patience with myself here, cause I cannot figure out what I am missing. 

 

This is a custom object, Work Order, that has a look up to an Opportunity.  There can be many Work Orders related to the same opportunity.

 

Trigger fires when

  • the Work Order stage field is updated to either one of the closed values;
  • if all of the Work Orders related to that opportunity are closed, then update the opportunity stage, if not, do nothing.

I can get this to save, run the test, but it never updates anything.  I have changed this code so many times, I have no idea where I am screwing up and would appreciate some pointer.

 

At present - I am getting an error on line 24:         Map <ID, Opportunity> updateOpps = new Map <ID, Opportunity> ([SELECT id, stageName, (select ID, Opportunity__c from Work_Orders__r)
        from Opportunity where id in :affectedOpps]);

 

Error reads:  IN Operator must be used with iterable expression.

 

I am stil very much a beginner, so please be explicit if you are telling me something I need to do:)

 

Thanks!!!!

 

 

Trigger CheckOpportunityWorkorders on Work_Order__c (after insert, after update) {

   set<id> oppids = new set<id>();

     	
	    if(Trigger.isInsert || Trigger.isUpdate)
   		    	for (Work_Order__c wo: Trigger.new) {
            if (wo.stage__c == 'Work Order Closed - Quickbooks' ||  wo.stage__c == 'Job Completed' ){
      		oppids.add(wo.Opportunity__c);
      		String oid = wo.Opportunity__c;
      		
 	    if(oppIDs .size() > 0) {
 
  Map <ID, Opportunity> affectedOpps = new Map <ID, Opportunity> ([select id, stageName, (select id, Opportunity__c from Work_Orders__r 
  	where Work_Order__c.stage__c != 'Work Order Closed - Quickbooks' OR stage__c != 'Job Completed') 
	from Opportunity where id in :oppids]);

	
	System.debug('Opportunity: '+affectedOpps.get(oid).StageName);     		
   

      	if (affectedOpps .size()==0){	
		
		Map <ID, Opportunity> updateOpps = new Map <ID, Opportunity> ([SELECT id, stageName, (select ID, Opportunity__c from Work_Orders__r)
		from Opportunity where id in :affectedOpps]);
		String upID = wo.Opportunity__c;
		 	if(updateOpps.containskey(upID))
		 	
 //       	d = updateOpps.get(upID);
				 
			upID.stageName = 'Job Complete';
			
			update updateOpps;
      	}
		
		
 
}
}
}
}

 

public with sharing class testCheckOpportunityWorkOrders {

    static testMethod void myTest() {

		Account a = new Account(name='test', type = 'customer');
		insert a;
       //Insert a test opportunity
		
       Opportunity o = new Opportunity();
       o.AccountId = a.id;
       o.StageName='Target';
       o.Name='test';
       o.closeDate=Date.today();

       insert o;
       
       system.debug('opportunity id' + Opportunity.ID);
       
         //Insert a Work_Order

       Work_Order__c wo = new Work_Order__c();

       wo.Opportunity__c = o.id;
       
       wo.Stage__c = 'Job Completed';
       wo.Close_Date_WO__c=Date.today();

  
       insert wo;
 		system.debug('workorder' + wo.ID);
 		      
       Work_Order__c ww = new Work_Order__c();

       ww.Opportunity__c = o.id;
       
       ww.Stage__c = 'Return Trip Needed';
       ww.Close_Date_WO__c=Date.today();
  
       insert ww;
       
       ww.Stage__c = 'Work Order Closed - Quickbooks';
       update ww;
       
       wo.Stage__c = 'Work Order Closed - Quickbooks';
       update wo;
       
		system.debug('workorder' + ww.ID + ww.Stage__c);
		
       Opportunity updated_Opportunity = [SELECT ID, WO_Count__c FROM Opportunity WHERE Id = :o.Id];

       //Verify that the values of the opp were changed by the trigger
       
  //System.assertEquals(opportunity, [Select WO_Count__c from Opportunity Where ID = :o.ID].wo_count__c);
  
 
     }
static testMethod void testBulkInsert() {

  List<Opportunity> opps = new List<Opportunity>();
  
 }

}

 

 

 

I'm trying to build a statement to update some records. I'm having trouble understanding the method and syntaxt. Trying to do this via PHP, forming statements based on this page http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dml_update.htm

 

In a nutshell I don't understand what the first term "Contact" in this line from the docs is:

Contact c = [select account.name from contact
             where lastName = 'Carter' limit 1];

 

I'm trying to build a statement like this:

 

$qry = "XXX cbp = [SELECT Supplier_Code__c FROM MyObj__c WHERE ManufacturerName__c = 'Fish Corp'];";
$qry .= "cbp.Supplier_Code__c = 'FISHCO';";
$qry .= "UPDATE cbp;";

 

But lost as to what/where the "XXX" term is or where to find it re my custom object...

Hope this makes sense

Thanks.

I am trying to set up a field (Lead Score) which gives my leads a numerical vlaue based on a couple  fields: Lead status & Rating...for instance if Lead status= "Nego. Contract Sent" and the Rating field = "Hot"...then this prospect would have a rating of 20 because "Nego. Contract Sent" has a value of 10 and the "Hot" rating also has a value of 10 giving them a rating of 20. If the Lead status="Information Flyer Sent" and the rating is still "Hot" they would have a value of 17 (10 for Hot and 7 for "information flyer"

 

I started to setup a workflow rule which said if "Rule Criteria Lead: Rating equals Warm,INTERESTED NOW,Cold,Hot" but then got stumped on the Workflow Action which I think would need to be a field update...

 

This is bascially what I am trying to do and I am definitely open to other options if somebody has a better way of doing this. This seems to logically make sense to me but you guys may have more experience and think of something else. Your help is appreciated!

Hi - I am trying to set a validation rule which will not let the sales team enter a close date less than the date when they mark an opportunity to closed/won. 

 

This is what I have:

AND(ISPICKVAL( StageName, 'Closing Agreement (Won)',  CloseDate < today()))

 

This is the error message:

Error: Incorrect number of parameters for function ISPICKVAL(). Expected 2, received 3

 

Any thoughts?

 

Thanks

Is there a way of deactivating the whole Price Book?  As you would appreciate to deactivate the individual product price netry is a "nightmare" in itself.  Thus I am trying to find a quicker way to deactivate the whole Price Book rather than deleting it. Please help.

 

When you try to delete a product or price book that is used on an opportunity or quote, Salesforce.com displays a list of the opportunities or quotes using it. If you are deleting a price book, you have to go to each opportunity or quote listed and remove the price book from them. If you are deleting a product, you have to remove the product from every opportunity and quote that uses it. Then, delete the price book or product and it will be stored in the Recycle Bin temporarily, during which time, you can recover it and all its related price book entries.

Well, this is going to be a "nightmare" as we already have Opportunities that are using the products and price books.

 

That is why deactivating is the best way of doing it (as per recomendation).

 

James(NewbieOne)

 

 

I have a page that uses the standard Lead controller. I'd like to create a link that sends user to the Send Email page for this lead.

 

I have tried the following syntax but it is not work, error: Field $Action.Activity.SendEmail does not exist. Check spelling.

 

{!URLFOR($Action.Activity.SendEmail,Lead.Id)}

 

Any ideas?

 

Thanks,

Jason

 

Hi all,

 

I'm trying to write my first trigger and am running into some errors.  It is probably baby stuff, but we all have to start somewhere.  Can someone please help with the error?

 

I'm trying to pull a field (text) from the Associated Account to a separate field (picklist) on the Opportunity.

 

Thanks for the help/lesson in advance!

 

 

trigger setXCenter on Opportunity (before insert, before update) { for(Opportunity oppObject : trigger.new) { Account acctObject = [Select Default_X_Center__c from Account where id = :oppObj.Account]; oppObject.Cost_Center__c = acctObject.Default_X_Center__c; }

 I'm getting this error:

 

 Error: Compile Error: No such column 'Default_X_Center__c' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. at line 19 column 29

 

Thanks 

 

One of our email workflow rules was triggered but the email was never received.  We pulled an email log and noticed that in one day 6 emails from different email alerts went to ValidationQueue@salesforce.com.  Has anyone have this issue?
Message Edited by hhuie on 02-25-2010 10:02 AM

So far in my apex playing time I have been able to parse out values from a string of characters

private void testBookParser() { XmlStreamReaderDemo demo = new XmlStreamReaderDemo(); String str = '<books><book author="Manoj">Foo bar</book>' + '<book author="Mysti">Baz</book></books>'; XmlStreamReader reader = new XmlStreamReader(str); books = demo.parseBooks(reader); //System.debug(books.size()); //for (Book book : books) {System.debug(book); //} }

 

 

However, syntatically how can I read in a URL string which contains XML (eg. 'https://na6.salesforce.com/servlet/servlet.ReportList') so that I can parse it?

 

Any help would be appreciated!

Hi,

 

When the Contact creation is part of a Lead conversion, before insert triggers that I have on Contact are not triggered. Is there a workaround?

Thx! 

Hi,

 

Can someone help, I keep getting the error:

System.DmlException: Insert failed. First exception on row 0 with id 00oS0000000AOgYIAW; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]

 

But I am pretty sure that there is no Id specified in my insert call.

Here is my code:

 

 

public PageReference save() { List<OpportunityLineItemSchedule> revenueSchedulesToUpdate = new List<OpportunityLineItemSchedule>(); List<OpportunityLineItemSchedule> revenueSchedulesToInsert = new List<OpportunityLineItemSchedule>(); for(revenueSchedulesDate revenueSchedulesDate:revenueSchedulesDates){ for(OpportunityLineItemSchedule revenueSchedule:revenueSchedulesDate.getRevenueSchedules()){ if(revenueSchedule.get('Id') == null) revenueSchedulesToInsert.add(revenueSchedule); else revenueSchedulesToUpdate.add(revenueSchedule); } if(revenueSchedulesToUpdate.size() > 0) update revenueSchedulesToUpdate; if(revenueSchedulesToInsert.size() > 0) insert revenueSchedulesToInsert; } return Page.revenueScheduleView2; }

 

 

 

Hello.

 

I am willing to have the items in my picklist (multi select) dynamically populated, say, from some other object's field values.

 

Any guidance will be helpful.

 

Thanks

For our vendor letters we could have a choice of 3 fax numbers and a null.

Vendor Location Vendor Fax (If Print Billing vendor = false & Contact Name is null)

Vendor Location Contact Fax (If Print Billing Vendor = false &Contact Name is not null)

Vendor Location Billing Fax (If the Print Billing Vendor =true & Billing contact is null)

Null (if print billing vendor = true and the billing contact is not null)

 

IF( Print_Billing_Vendor__c=False&& isnull(Vendor_Contact__c )=True, (Vendor_Fax__c ),
IF( Print_Billing_Vendor__c=False&& isnull(Vendor_Contact__c )=False, (Contact_Fax__c ), IF( Print_Billing_Vendor__c=True&& isnull( Billing_Vendor_Contact__c )=False, (Billing_Vendor_Fax__c ),"")))

 

All fields are text fields except the Print Billing Vendor is a check box.

 

This formula is not working even though I do not get a syntax error.

What am I missing?

 

Thank you in advance.