• Pragadheeshwari
  • NEWBIE
  • 75 Points
  • Member since 2009

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 18
    Replies

In my web-to-case form, I want to specify a record type.  See html line below.  However, when I submit the form, the case record type is still set to the default record of the default case owner.  Do I have the correct syntax for the html line?  I checked the Support Settings and it is not set to override the type with the owner's default.

<input type=hidden name="RecordTypeId" value="01280000000G4N7AAK">

I need to write a trigger I am guessing to auto create a case when a user changes an account picklist value from one value to another.

 

My question: would this trigger be "on Account" or "on Case"? My guess is "on Case(after Insert, after Update) but I am not sure if this is correct.

 

Along with the autocreation of a case a few fields need to be populated based on an account field as well.

 

Here is the scenario:

 

A user edits an account and they change the custom picklist field "Operational Status" from "ITGO" to "Operational" and clicks save.

 

Then a case needs to be created pulling in the related accout as a lookup, the owner of the case needs to be set based on the custom account picklist field "Customer Service Rep" and the Type field will be set to "Health Check".

 

Does anyone have any suggestions for this trigger?

 

Thanks in advance.

  • November 16, 2009
  • Like
  • 0

Hi all,

 

I currently have a custom object that is related to accounts, and we use it for logging information in on the same day every week. Sometimes the information is just the same as the previous week.

 

Does anyone know if there is some apex code I could use that would automatically clone  the previous weeks record on the same day every week? So say on a Monday, all records created in the custom object last week would get cloned?

 

Many thanks for your help,

BPS



Hi,

Cannot able to access button which is executing webservices with namespace - It becomes javascript error in IE9 but works in other browsers.

Code Line where i am getting error :  Namespace.webserviceClassname(params,params,etc.,);

Error I got: Onclick Javascript Error , Unable to get value of the property 'execute': object is null or undefined

Thanks in Advance

hi,

 

I have created a managed package and uploaded to beta version without apex failures in test methods but if i install this in developer edition i got an error from test methods,

 

Apex Classes(01pA0000001FAQQ) MyTestMethod

System.DmlException: Update failed. First exception on row 0 with id 701A0000000MpSgIAK; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, MyTrigger1: execution of BeforeUpdate

 

caused by: System.DmlException: Update failed. First exception on row 0 with id a06A0000005ugyWIAQ; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 701A0000000MpSg) is currently in trigger MyTrigger1, therefore it cannot recursively update itself: []

 

(MyNamespace (ManagedPackage)): []

(MyNamespace (ManagedPackage))

External entry point

 

i got an error like this for all my test methods.


i didnt get any error in my developer where i have a created a managed package, but i got while installing this package to another environment.

  How can i enable inline editing in visualforce page.....

Pls, let me know the costs to use SFDC customer portal Per month. Tell me the cost  If I am going to use 1000 users per month what will be the charge.

How to use Login Credentials in Visual Force Pages or Sites,

I dont know how to use apex component <c:sitelogin>

What are all the ways for to use login credentials in visualforce page /Sites

Hai All,

   I want to know about apex component c:siteLogin.

   

I want to login in salesforce sites,Is there any other way to do this

I have two objects, A and B, which are linked via a lookup field. B is the sub-object in this example.

 

Now even though they're linked with a lookup, I want one key field to be synced between the two objects. I want users to be able to edit from either record.

 

However, here's my problem:

When someone changes the value on A, the trigger on A fires, and updates B. This causes a chain reaction which causes the trigger on B to fire, and update A again. I'm not actually sure how many times it goes through the loop before failing.

 

This actually works for records where there are only a few B records, but my test cases fail because of too many DML rows. I thought this was a problem with just the number of records, so I created some Asynchronous Apex to handle the actual updating. However, now I get the error that a future method cannot call a future method (since one future method is causing the second trigger to fire which also uses a future method).

 

I have tried and failed with the following:

Trigger.isExecuting - this always returns true since they are triggers, so I can't use this

Custom checkbox which says Updated from Sync - This works for the initial update, but I can never set this field back to false, because when I do (via trigger or workflow rule) it fires the other trigger again, and I get the same errors.

 

Any ideas on how to sync one field between two objects?

In my web-to-case form, I want to specify a record type.  See html line below.  However, when I submit the form, the case record type is still set to the default record of the default case owner.  Do I have the correct syntax for the html line?  I checked the Support Settings and it is not set to override the type with the owner's default.

<input type=hidden name="RecordTypeId" value="01280000000G4N7AAK">

Hi,

 

Can anyone give the solution for the following issue:

 

I created a custom object called xyz__c, which has more than 50k + records. I'd like to process all these records in the Batch job. This code in inside the start(....) method and the return type is List<SObject>.

 

Note: I found some issues with the QueryLocator and so I'm using List<SObject> as a return type.

 

Error: 19:5:19.106|EXCEPTION_THROWN|[86,38]|System.Exception: Too many query rows: 10001

 

 

Source code:

 

List<SObject> rList=new List<SObject>();

 

for( List<SObject> rr:[SELECT Id,Name,OwnerId,RecordTypeId,RecordType.Name,Account__c,WebID__c,WebID__r.Status__c,

                    Type__c,Review_Frequency__c,

                    Month__c,Due_Date__c,Stop_Clone_Date__c,Status__c,Recommendations__c,Recommendation_Status__c,

                    ProCare_Health__c,DAP_Health__c, 

                    Submitted_Directories__c,Site_Check_Status__c,Previous_MM_Record__c, Previous_MM_Record__r.Id  

                     FROM xyz__c

                     WHERE (CALENDAR_MONTH(Month__c) = :this.cloningMonth AND 

                            CALENDAR_YEAR(Month__c) = :this.cloningYear AND    

                            Stop_Clone_Date__c = NULL  AND 

                            Review_Frequency__c = :this.reviewFrequency AND

                            WebID__r.Status__c = :this.webIDStatus  AND 

                            UniqueID__c NOT IN :previousMMrecordList)

                     ORDER BY Id ]){

                 

rList.addAll(rr);  

}   

 

  • July 23, 2010
  • Like
  • 0

Hi All,

 

I have records in contacts object which are having  two types of 'contact type' like 'CEO'  and 'Manager',

 

 

i don't want users to delete the contact records which are of  'CEO' , this can be achieved through trigger, but i want to show custom message in the page.

 

how can this achieved. 

 

thanks in advance.

ALL,

 

I am not new to developing on Salesforce using the API and PHP, but  I am new to APEX so please bare with me.

 

I wrote this simple trigger that deletes records on a custom object when another custom object record is deleted.

 

 

trigger CleanOppTrackerLineItem on Opportunity_Trackers__c (before delete) { for (Integer i = 0; i < Trigger.old.size(); i++) { try { //Get all the line items to delete when the parent is removed Opportunity_Tracker_Products__c[] oTRs = [select id from Opportunity_Tracker_Products__c where Opportunity_Tracker__c = :trigger.old[i].id]; delete oTRs; } catch (System.QueryException ex) { //Do Nothing - There must not have been any to delete. } } }

 

 I was trying to go over some of the examples so I can test this and I am kind of lost. 

 

 

Do I need to write a custom APEX class to test this trigger because I need to get it into production as fast as possible.

 

We have run some tests in our sandbox on the trigger and it works perfectly.

 

Can someone please help me with what is the simplest way to create a test case and get it tested for this very simple trigger

 

 

I would appreciate it

 

~Mike

 

Hi all,

 

I am not getting any error emails for the unhandled exceptions on my email-id even i already have enabled this option in personal information using [Send Apex Warning Emails checkbox].

 

This is happening from last few days only and before that i was getting all the errors correctly on my email-id.

 

 

Any help will be appriciated.

 

Thanks in advanced. 

 

 

Want to create a "New Contact" button that is located directly on the Contact record. Can someone supply me with the code to create a new contact; so I can create the custom button.

 

thanks,

p

  • November 16, 2009
  • Like
  • 0

I need to write a trigger I am guessing to auto create a case when a user changes an account picklist value from one value to another.

 

My question: would this trigger be "on Account" or "on Case"? My guess is "on Case(after Insert, after Update) but I am not sure if this is correct.

 

Along with the autocreation of a case a few fields need to be populated based on an account field as well.

 

Here is the scenario:

 

A user edits an account and they change the custom picklist field "Operational Status" from "ITGO" to "Operational" and clicks save.

 

Then a case needs to be created pulling in the related accout as a lookup, the owner of the case needs to be set based on the custom account picklist field "Customer Service Rep" and the Type field will be set to "Health Check".

 

Does anyone have any suggestions for this trigger?

 

Thanks in advance.

  • November 16, 2009
  • Like
  • 0

Hi all,

 

I currently have a custom object that is related to accounts, and we use it for logging information in on the same day every week. Sometimes the information is just the same as the previous week.

 

Does anyone know if there is some apex code I could use that would automatically clone  the previous weeks record on the same day every week? So say on a Monday, all records created in the custom object last week would get cloned?

 

Many thanks for your help,

BPS

Afte I change the field type of a custom object in the org then I do a refresh from server to get the xml of that object. But if I try to deploy the object with apex classes to another org, the build will fail and says you can not change the field type of object XXX which is used in XXX classes. Other than manually change the field type in the org I want to deploy to through the UI interface, is there any way I can complete the deploy? Thanks!

I was wonder how to create a dynamic soql statement with apex. I saved items in to an array but just don't know how to add them to the soql statement. The array looks like this:

 

My array will look like this: (First line is the object I created, second line is the name i want to put in, third line is the field name, and so on)

Person__c

John Doe

Name

27

Age__c

04/04/1988

Birth_date__c 

Dallas

City__c

Saint Tom

Street__c 

12345

Zip__c  

 

 

 

Thanks for any help you can give. 

Hi

Can any body tell me how to delete the duplicate record from the database.

This duplicate reocrd is judged on the basis of comparing each field of one record with

the each field of the other record.

 

I used two for loops for this . Every time I m comparing the index of 1st record with the rest of the

records then again i m jumping to the next index and coampring with the remaing record in the list.

 

This logic is failing badly since ony for 100 records total iteration becomes 100*100 . Htng governer limit

I m getting

 

"

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger prevnetContActiveMultipleTimes caused an unexpected exception, contact your administrator: prevnetContActiveMultipleTimes: execution of BeforeUpdate caused by: System.Exception: Too many script statements: 10201: Class.cleanUpContactRoleDuplicateRecord.cleanUpDuplicateRecord: line 26, column 25 "
Tell me how to delete the duplicate records from the database.

 

 

Hi every one,

 

       I wrote a code when page loads, which checks the todays date and time if today date is 9th nov and time is 12.30 pm the code returns null and do rest of the thing else if today is not 9th nov and time is not 12.30  pm it will return to an error message page displaying pleaseopen it on 9 th nov 12.30 pm  to 1 pm.

 

and here is my code.

 

<apex:page showHeader="false" controller="checkmailid" action="{!checkdate}">      

 

APex class 

public PageReference checkdate()
    {      
        PageReference pageRef;
        DateTime t = DateTime.now();        
        if('11-9-2009'!=t.month()+'-'+t.day()+'-'+t.year())//checks today date    
        {                        
            pageRef = new PageReference('http://free-12415f14c3a-124c73aaa62.force.com/registerfor/errormsg?error=dates');                                 
            pageRef.setRedirect(true);                    
            return pageRef;         
        }        
        else //if today date is equal to given date       
        {            
            if(t.Hour()==12)     //this checks if time is equal to 12.30 or not.      
            {                
                if(t.Minute()>=30 )                
                {                        
                    return null;                
                }                
                else                
                {                    
                    pageRef = new PageReference('http://free-12415f14c3a-124c73aaa62.force.com/registerfor/errormsg?error=dates');                                 
                    pageRef.setRedirect(true);                    
                    return pageRef;                 
                }            
            }            
            else            
            {                
                pageRef = new PageReference('http://free-12415f14c3a-124c73aaa62.force.com/registerfor/errormsg?error=dates');                             
                pageRef.setRedirect(true);                
                return pageRef;             
            }        
      }
        return null;
    }

 

when i wrote and tested it on developer edition its working perfectly and when i made it as a package and uploaded it to free edition this time  functionality is not working.

 

 

can any one know what is  wrong with it? why is it not workingin free edition public sites.

 

 

  • November 09, 2009
  • Like
  • 0

Hi all,

 

I'm a newbie in SF development area. I have a quick question about the triggers.

 

I read that update() in APEX is like UPDATE in SQL, so an "after update trigger"should fire whenever there is any change to any entry in sObject. Is this right?

 

The reason I'm asking this is that I have written a trigger that updates a field in a case when Account's PersonBouncedEmailDate is updated. So when we get a bounce email, it will update the PersonBouncedEmailDate for the row in Account, and that should fire this trigger I wrote which will update a custom field. (You can kind of guess where my company's using this trigger).

 

This trigger is however isn't firing at all. It fires when I manually update one of the fields (phone for example), but it doesn't fire when we get bounced email.

 

Any help will be appreciated.

 

 

Hi,

 

I am still new to coding triggers and coding in general but I have a problem that I am struggling to get around.

 

The trigger I currently have fires after update and transfers a completed field to another objects field. 

 

The problem is this happens after every Account update, I need this only to happen after the one field (IF_SAP__c) has changed, and if that field hasn't changed then do not do the update.

 

 This my current code, I understand I can use the Trigger.old, but I dont know how to compare the Trigger.old to the Trigger.new. Can some one please point me in the right direction.

 

Many Thanks


Matt

 

 

trigger UpdateToAccSetupForm on Account (after update) { Map<String, String> SetupFormMap = new Map<String, String>(); for (Account acc : System.Trigger.new){ if (acc.IF_SAP__c != null){ SetupFormMap.put(acc.ID, acc.IF_SAP__c); } else{ } } List<AccountSetupForm__c> recordsforupdates = new list<AccountSetupForm__c>(); for (AccountSetupForm__c aacc :[Select Id, AccountName__c, SAP_Number__c from AccountSetupForm__c where AccountName__c IN : SetupFormMap.keySet()] ){ if (SetupFormMap.containsKey(aacc.AccountName__c)) { aacc.SAP_Number__c = SetupFormMap.get(aacc.AccountName__c); recordsforupdates.add(aacc); } } update recordsforupdates; }

 

 

 

Hi All,

 

I am writing an apex class which has grown too big. When saving through Eclipse or UI, it gives me that 'Script too large'.

What exactly is the size limit of an Apex Class?

 

 

Can someone please let me know the easiest way to make an apex class available in production mode??

 

Is Eclipse the only way or can I also do it from the online user interface?

Can someone point me in the right direction for writing a trigger that updates a field on the Account Record if a contract is expired?  

 

For instance if a contract is current (start and end date are within current date) it would update the field to say current.  If the contract end date is a date in the past and there are no other current contracts it would update the field to "lapsed"

 

Thanks in advance 

  • November 03, 2009
  • Like
  • 0