• sruthiforce
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 10
    Replies

Question:

Type <> Support Site Admin, License request

How to use <> in this case Type is Picklist

 ISPICKVAL(Type,<> 'Support Site Admin'), ISPICKVAL(Type,<> 'License Request'))

 

error: <>

Question:

Type <> Support Site Admin, License request

How to use <> in this case Type is Picklist

 ISPICKVAL(Type,<> 'Support Site Admin'), ISPICKVAL(Type,<> 'License Request'))

 

error: <>

I am getting error message on hitting the governor limits due to the trigger below. What this trigger does is that whenever a task's description it copies over the data from the task object on to the custom object. Can someone please help so that my code does not hit the governor limits.

 

Many thanks in advance.

 

trigger CommentLog on Task (before update) {
for(Task t: trigger.old)
{
CommentLog__c c = new CommentLog__c();
c.Previous_Comment__c=t.Description;
c.CommentDate__c=t.LastModifiedDate;
task t1= [select owner.name,LastModifiedBy.name from task where id=:t.id];
c.Name=t1.LastModifiedBy.name;
c.Task_owner__c=t1.owner.name;
c.type__c='Task';
c.Link_to_Task__c='https://na1.salesforce.com/'+t.id;
insert c;

}

}

 

Hola, 

 

Seeking help with a validation rule I want to put in place. 

 

I have 2 picklists. 

 

First picklist is Stage Name, "Negotiation/Review"

Second picklist is called   "User_Buyer_s_Degree_of_Influence__c"

 

Basically what I'm looking for is.. 

 

If the stagename, Negotiation/Review is selected, and the User Buyers Degree of Influence is not selected, the save is blocked. 

 

 

I get the ISPICKVAL can be used for the Stage Name, but I get an error if i use ISPICKVAL for the User buyer... 

 

Thanks in advance!!!!! 

 

-Rob 

 

hi all

 

i need a validation rule for a picklist

 

i have a picklist with A,B,C,D ,,

i need to the make rule say if A,B are picked then a field is then required

 

this is what i was trying

1

AND ( (TEXT(  Board_1__c ) ='A'), (TEXT(  Board_1_Finish__c  ) = null) )

This work only for A ,But i cant B in

2

AND

(ISPICKVAL(Board_1__c, "A"),

OR

(ISPICKVAL(Board_1__c , "B"),

(TEXT

(Board_1_Finish__c  ) = null) ))

any help would be great

 

thanks

joe

  • November 09, 2012
  • Like
  • 0

This is kind of a two part question.  First off I have a custom object called Country which has a multipicklist field called TimeZone.  I have an identical field on Accounts.  Ideally I want my trigger to do the following - If an account is created or the billing country is updated I want it to look for an exact match by BillingCountryName in the Account to the Country Records (Name field) and bring back the TimeZone information from the matching country record and plug it into the TimeZone field on the Account.  I would also like to have it check US states and give specific time zones for those (so multiple IF statements) before it goes into the lookup portion of the trigger.  For right now though I am just trying to get the portion where it searches the records and finds a match and brings back the timezone.  I keep receiving an error saying "Compile Error: Invalid type: TimeZone__c at line 19 column 64"  I'm sure it's just syntax but I've only done a trigger like this with a standard object so the custom part is throwing me off I think.  Here is the code I have thus far:

 

trigger AccountTimeZone on Account (before insert,before update) {

// gather all the Country Name's in a set

   Set<Name> setCountry_cNames = new Set<Name>();

   Account[] Acc = Trigger.new;
   for (Account a:acc)

   {
      setCountry_cNames.add(a.BillingCountry);

   }

 

   // store each Country Name with it's time zone in a map, such that Country Name => Country.TimeZone__c

   Map<Name, TimeZone__c> mapCountrytoTimeZone = new Map<Name, TimeZone__c>();

   for(Country__c c : [Select Name, TimeZone__c From Country__c Where Name IN : setCountry__cNames])

   {

      mapCountrytoTimezone.put(c.Name, c.TimeZone__c);
   }
   for (Account a:acc)
    {
       if(a.Timezone__c !=null)
       {
           a.Timezone__c = mapCountryToTimeZone.get(a.BillingCountry);
       }
   }  
}

Hello Everyone,

 

I have a unique problem, my org has more then 100 testclasses and every deployment takes around ~1.5 hrs. The issue is at times we face a lot of "Too many SOQL's" error. When we try to run these testclasses in our sandbox they run fine, but only during the deployment they crop up.

 

We do take care of coding practises and make sure that there are no queries within the loops and as well as to limit the dml statements...

 

My question is what could be the possible root cause for this? Is there are standard way to streamline these many testclasses? or monitor there governor limit usage(i know we could find them in the debug logs) during run time?

 

Please advice.

 

Thanks,

Maverick

I am attempting to create a unit test for a controller and looking to use the Test.setCurrentPage method.

 

When I do I am getting the error mentioned above on the last line displayed in the code below:

 

 

		    ID contactRecordID = [Select Id from Contact Where FirstName = 'Mark' AND LastName = 'Smith' Limit 1].Id;		    		    
		    PageReference ref = new PageReference('/apex/UpdateContactInformation?id=' + contactRecordID);
		    Test.setCurrentPage(ref);

 When I run the following code through the Execute Anonymous I get

 

 

ID contactRecordID = [Select Id from Contact Where FirstName = 'Mark' AND LastName = 'Smith' Limit 1].Id;		    		    
PageReference ref = new PageReference('/apex/UpdateContactInformation?id=' + contactRecordID);
System.Debug('********' + ref);

 Resulting line in log

 

 

11:15:01.074|USER_DEBUG|[3]|DEBUG|********System.PageReference[/apex/UpdateContactInformation?id=003T000000sICrPIAW]

 

So it looks good (as far as I can tell) in the execute anonymous but when run in the Unit test I am getting the System.NullPointerException: Attempt to de-reference a null object error on the last line.

Hey guys,

 

Can anyone tell me why these don't update the status__c field of the record I specify when clicking an outputLink?

 

 

 

<script src="../../soap/ajax/18.0/connection.js" type="text/javascript"> <!-- Testing some simple field updates in jScript rather than using controllers --> function departShp(){ var shp = new sforce.SObject("Shipment__c"); shp.id = "{!Shipment__c.id}"; shp.Status__c = "In transit"; result = sforce.connection.update([shp]); if (result[0].getBoolean("success")) { log("Shipment with id " + shp.id + " updated"); } else { log("failed to update shipment" + shp.id]); } } function updateShp() { try { var shp= new sforce.SObject("Shipment__c"); shp.Id = "{!Shipment__c.Id}"; shp.Status__c = "In transit"; var result = sforce.connection.update([shp]); if (result[0].getBoolean("success") == false ) { alert(result[0].errors.message); return; } window.top.location.href=window.top.location.href; } catch (e) { alert(e); } updateShp(); } </script>

 

The button

 

<apex:form > <apex:outputLink value="/{!Shipment__c.id}" onclick="updateShp()" rendered="{!$Profile.Name = 'System Administrator'}"> Shipit </apex:outputLink> </apex:form>

 

Both of these are pulled from examples I found: one in ajax dev guide, and one in custom button that marks a task as complete provided by Salesforce.com labs for free...

 

Can't quite figure out how to make it work for me.

 

I'd like to avoid using APEX because it goes towards my total apex limit, and I have to build test classes, so it's not very efficient.

 

Thanks!

JNH

 

 

 

 

  • March 25, 2010
  • Like
  • 0