• Swarnasankha
  • NEWBIE
  • 380 Points
  • Member since 2010

  • Chatter
    Feed
  • 14
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 72
    Replies
We have a fairly large salesforce product with a large code base. We are going to hit the code limit of 3,000,000 characters very soon. I have read in forums that salesforce can increase the limit if we can justify the need for increased limit. 

But my question is that will salesforce increase the limit for only the packaging org (created via the partner portal) which we use for packaging and uploading our package, or can we ask for increase in code limit for multiple orgs.

I am asking this because all our developers work in their separate orgs and checking in code in a common repository. From there the code is pulled into the main packaging org and finally the package is built.

Thanks in advance

I've been searching around, but have yet to find the solution.  I have the trigger below that prevents the case from being deleted if the work order count field is > 0.  The problem is that it shows a somewhat harsh system error message vs. a nice popup window that the user can click ok on.  Any suggestions?

 

trigger BeforeDeleteCase on Case (before delete) {

for (Case cs : trigger.old)
    {
        
        if (cs.Work_order_count__c > 0)
        //if the work order count is more than zero
            {
            	cs.addError('Can delete this case, A work order for this case currently exists');
            }  
           
}
}

 

Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Can delete this case, A work order for this case currently exists".

Click here to return to the previous page. 

 

  • March 19, 2013
  • Like
  • 0

Hi everyone,

 

I'm new to Apex coding, so please forgive me if this question is amazingly basic.

 

I'm trying to build a trigger that fires when a contact record is edited. It should look at the value of a checkbox on the contact and use that to update the value of a checkbox on the contacts Account. 

 

This is what I have currently:

 

trigger Update_Powerful on Contact (before update, before insert) {

//When contact Powerful connection checkbox is changed, update Account field

    // Loop through the incoming records
     for (Contact c : Trigger.new) {

        //Get account record
      Account a =c.Account;
           

        //Is Powerful connections ticked?
        
     a.Consultative_Selling_Partner__c = c.Powerful_Connections_Presentation_check__c;
            
            

   }


}

 

The error I receive on the contact when updating is:

Error:Apex trigger Update_Powerful caused an unexpected exception, contact your administrator: Update_Powerful: execution of BeforeUpdate caused by: System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Contact.Email: Trigger.Update_Powerful: line 28, column 44

 

 

To give you an understanding of my overall goal with this, I want my users to tick a box on the event screen. Once that event is saved, if the box is ticked it updates the contact, which in turn updates the account. I've started with contact, since that seems to be an easier entry point to trigger design.

 

I guess my understanding falls down when I try to reference the account that's related to the contact, and edit that accounts fields. If anyone could point me int he right direction, I'd really appreciate it :)

 

 

 

Hi All,

 

I have three object Publication_Mention__c ,  Opportunity, Product. They all have lookup relationship between each other. The requirement is when a new Publication_Mention__c object is inserted into database with its tickbox field referall__c being ticked. A new Opportunity and the related Product record will be both created. I have tested the code I wrote. The Opportunity object inserting works fine(If I Comment out "insert newProduct;" in my code) . But when I try to insert a Product, error occurred.  Here is my code

 

Ps. 1.The "Product" renamed "Product2" in our data Schema

        2. I am using a trigger to call createNewOpportunity on Publicatiopn_Mention__c object

 

public with sharing class NewPublicationMention {
 public static void createNewOpportunity(List<Publication_Mention__c> PublicationMentions)
 {
 for(Publication_Mention__c PM: PublicationMentions)
 {
 //when the Referral__c checkbox ticked
 if(PM.Referral__c==True)
 {
 //a new Opportunity object will be created
 Opportunity newOpportunity = new Opportunity(Publication_Mention__c = PM.Id);
 
 //fields of the new Opportunity object
 newOpportunity.Name = newOpportunity.Contact_Name__r.FirstName + newOpportunity.Contact_Name__r.LastName + '-' + newOpportunity.Product__r.Name;
 newOpportunity.StageName = 'New';
 newOpportunity.CloseDate = Date.today();
 newOpportunity.Type = 'Free';
 newOpportunity.Order_Source__c = 'Helpline';
 newOpportunity.Order_Date__c = Date.today();
 newOpportunity.Amount = 0;
 
 insert newOpportunity;
 
 
 //a new Product object will be created
 Product2 newProduct = new Product2(Publication_Mention__c = PM.Id);
 
 //fields of the new Product object
 newProduct.Quantity_in_Stock__c = 1;
 newProduct.Price__c = 0.00;
 newProduct.First_Publication_Date__c = Date.today();
 
 insert newProduct;
 }
 }
}
}

 

 

Flowing is the error message: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Product Name]: [Product Name]: 

 

I'd appreciate it very  much for any help. Thanks

 

OK so I am working in my companies sandbox and I want to Create a Change set. It tells me that I need a deployment connection. However when I look at my sandboxes deployment connection it says that i can't upload from the sandbox to the production environment or vice versa. When I try to change that I can only change the allow inbound changes check box. The allow outbound changes check box is unavailable. I would like to know what I can do about that. 

 

Thanks for your time. 

Dan. 

Ok so I got off the phone with premier support, and that didnt get me anywhere... So to the trusty boards...

 

I have created a field for first response, bascially it is updated on the first out bound e-mail or a click to call from the case via the CTI adapter.

 

All I need to do is report on the diffence between Created time stamp and the First Response time stamp...

 

Sounds simple, yes... But I can not get this to work from a reporting stand point, so I searched the forums and sounds like some are using another formula field to calaculate the difference.

 

Any Ideas???

 

Thanks!

Pat

Hello friends,

 

                      I'm trying to create opportunity using test class but I unable to do the same. I'm writing test class for trigger. This trigger process opportunity, so I need to create it through test class but I fail to do so. But my trigger works fine.

 

Any solution?

Please help.

 

Thanks,

Maddy

Background:

Our support processes require us to have 2 people assigned to eah case, an owner and an assignee. The owner is responsible for the resolution of the case and chasing up assignees whist the assignees are required to perform individual tasks to resolve a case (eg a software release).

 

General Problem:

Salesforce will send out notifications happily to case owners but I need activity notifications to also go to assignees too. I have created a new custom field called assigned_to__c which is a lookup(User) field. I would like to set up notifications using a workflow rule however this can only be done using the specific email field type.

 

Workaround:

My solution was to setup a separate hidden field assigned_to_email__c which would be autopopulated with the email of the user specified in the assigned_to__c field.

 

Questions:

I have not yet had to use formulas, cross object or otherwise so I have a couple of questions

1. I am not sure how best to approach this, should I use the formula to populate the field automatically or should I use a forumla in a workflow rule to do it

2. What syntax do I need to use to reference the User specified in assigned_to__c? Can anyone provide me with an example, idealy with a brief explanation as I expect I will have to do similar operations for other processes I am developing.

 

Thanks

I am trying to create a formula field that has critieria relating to several other fields but can't figure it out.  I started with two different formulas that were requested by the user at different times then received new criteria to be added to the formula so I have each individual formula that has been tested and works.  The formula field name is "Migration Eligible" and the criteria is the following:

- If the Type field = "Inactive" the Migration Eligible field = No regardless of other criteria

- If the Initial Ship Date field is blank and the Manufacturer field = "Company 1" or "Company 2" the Migration Eligible field = Yes

OR

- If the Years since last activity field >= 5 the Migration Eligible field =  Yes

 

Here are the individual formulas that were tested and worked:

 

IF(NOT(ISPICKVAL (Type,"Inactive")),"Yes","No")

IF (Years_since_last_activity__c >= 5), "Yes","No"

IF (AND (ISBLANK(Initial_Ship_Date__c),
OR (ISPICKVAL (Manufacturer__c,"PlantCML"), 
ISPICKVAL (Manufacturer__c,"TCI"))),"Yes","No"
)

 


Thanks for any help!

Linda  

 

 

I am tyring to figure out how to create a custom filed (in the Case section) say "Latest Case Comment DateTime" using either a workflow or trigger to get this field  to populated with the creation date of the latest comment created/made.  Any ideas or suggestions would be much appreciated.

 

Thank you!

 

Tyler

Hi,

 

What's the formula to calculate the difference of the days?

 

Thanks.

  • May 22, 2010
  • Like
  • 0

I have two custom objects, one of which points to another via a lookup field, and I want to create a validation rule to ensure that when one record of the second object type is pointed to in said field, another will be unable to point to that same record.  That is, if Object1 has a lookup field called "Object2Lookup", and if Record A of type Object1 points to Record X of  type Object2 through that record's Object2Lookup field, I want to make sure that Record B of type Object1 gets an error if it tries to point to Record X in its Object2Lookup field.  How can I create a validation rule (or lookup filter) to do this?

Hello -

 

I'm trying to write a visualforce page that will redirect a user to the Case Record Type's page layout for a given case record type.  For example, if the case record type is "change" then the page redirects to the "change" case edit page.  I seem to be stuck with the redirect after the submit button is pressed - nothing seems to happen.  Below is the code:

 

public with sharing class RecordTypeListCon {
private List<SelectOption> items;

// property that reads the value from the Component attribute
public string sObjectType
{
get;
set;
}

//public RecordTypeListCon(ApexPages.StandardController controller) {
  //      this.controller = controller;
//}

public List<SelectOption> getItems() {
 List<SelectOption> items = new List<SelectOption>();

 //default value
 items.add(new SelectOption('','--Select Record Type --'));

 //query force.com database to get the record type of the requested object.
 for(RecordType rt: [select id,name from recordtype where sobjecttype=:sObjectType]) {
      items.add(new SelectOption(rt.id,rt.name));
  }
 return items;
}

public System.PageReference action()
{


  PageReference nextPage = new PageReference('/500/e?RecordTypeID='apexpages.currentPage().getParameters(Values(getItems())););

  nextPage.setredirect(true);
  return nextPage;
 
 
}

}

 

Below is the VF page:

 

 <apex:page controller="RecordTypeListCon">
<h1>Please select a case record type:</h1>
<p>
</p>
 <apex:form >
<c:RecordTypeListCon value="{!items}" sObjectType="Case"></c:RecordTypeListCon>
<apex:commandButton value="Go" action="{!action}" rerender="dynamic"/>
</apex:form>
</apex:page>

 

I am trying to make customer portal but I am stuck on my way :(. I selected Customer Portal and created a new portal having name as "My Customer Portal" after that I explore the option and found some options under "Look and Feel section" when I hit search icon infront of header text box that shows me a popup which is total empty and there is an option for search. I am not getting the exact place where should I define that header so that it can be list down in that popup whcih allow me to select and set in Header text box. I did 2 things.



1: I uploaded my logo in static folder and some css.

2: I created a component having some HTML.



But again these two things are not listing in header findings.



Please anyone help me in this situation. Where should I define some HTML so That it will show in header and footer search dialoge for selection and also logo???



Please help me I am thanking you in advance.



BR,



Asif Ahmed Khan

Sr. Software Enginner

Palmchip Pvt. Ltd


My organization has recently undergone some departmental changes, and we are now using Service Cloud heavily because of these changes. Our support team has taken on the task of processing orders, therefore they are bombarded daily from our Sales Team. I have configured Service Cloud with the Email-to-Case feature, which is very handy in that it automatically associates the Contact to the Case based on the email message received. 

Because our Sales team is now forwarding all of its requests for order processing to our Support team, all of the cases that are created from these forwarded emails have the web email set as the Sales person's email address, therefore not associating the case to the appropriate Contact.

My manager is not pleased with this process, because it requires the Support agent to research the forwarded email and look up the appropriate contact to associate with the case, taking a few minutes of their time.

Can anyone think of something that would streamline this process a little more? Is it possible to perhaps examine the email received and perform logic based on some sort of email flag, like a "****" at the beginning of the subject line to indicate that a bit of apex code should be run?

Any and every idea is welcome. I have been wracking my brain about what to do in this situation and nothing is coming to mind.

Thanks!
We have a fairly large salesforce product with a large code base. We are going to hit the code limit of 3,000,000 characters very soon. I have read in forums that salesforce can increase the limit if we can justify the need for increased limit. 

But my question is that will salesforce increase the limit for only the packaging org (created via the partner portal) which we use for packaging and uploading our package, or can we ask for increase in code limit for multiple orgs.

I am asking this because all our developers work in their separate orgs and checking in code in a common repository. From there the code is pulled into the main packaging org and finally the package is built.

Thanks in advance
I am attempting to auto populate a parent account using the D&B global duns number of a child record. Is this possible, and what method would be used.
I have a picklist in my vf page with below values.
1 bhk
2 bhk
3 bhk

Scenario: If I am selecting 1 bhk from pichlist then all images of 1 bhk should get displayed in my vf page.
(I have a field in my object to check whether flat is 1 bhk/2bhk/3bhk with respective images of flats).

How to develop this scenario vf page?
Hi All,

Can i know how to reduce the multiple case () in formula fields .

for EX:

CASE(X,"YES",1 ,-1)+
CASE(Y,"YES",1,0)+
CASE(Z,"YES",1,-1)


so,for this kind of formula can i know what is the good approach because as i am using multiple CASE() , i am getting  following error
"Compiled formula is too big to execute (5,100 characters). "
Each custom field below is a numeric value.  I need a formula that adds these in the following pairs as shown below.  How to only add "Tier__c +  Scope__c", if the other pair is null?  And vice versa?

Health__c +  Priorty__c

Tier__c +  Scope__c 
Hi All,

Can someone please shed some light on how to create a validation rule ( or alternative ) to check if values in a related list contain certain values before letting the contract status be changed to closed??

Eg, contract status cannot be changed to closed if values in the related list "parts to be supplied" still have values of "not supplied" next to them
1.     Create Object call Flats and create fields as follow:
-     Name
-     Flat Types (Pick list) (1 BHK, 2 BHK, 3 BHK)
-     Rent (Currency)
-     Acquirable Date (Date)
-     Furnishing (Pick list) (Furnished/Semi Furnished/Unfurnished)

2.     Create Object call Enquiry and fields are as follow:
-     Enquiry Name
-     First Name
-     Last Name
-     Email
-     Phone Number
-     Rental Price(Currency)
-     Furnishing (Pick list) (Furnished/Semi Furnished/Unfurnished)
-     Flat Types (Pick list) (1 BHK, 2 BHK, 3 BHK)
3.     Create Junction object Matched Result: Auto Number as ID, Name of Enquiry and Name of Apartment.

Task to do:
1.     On Creation of new enquiry, Create Matched Result record. I.e. insert record in junction object whenever new Enquiry and Flats data matched. To creating new record match Rent, Furnishing and Flat Types fields from both the object.
2.     For Every new Enquiry first delete existing records from Junction object.

Hello,

 

I'm having trouble modifying and saving an Apex class.

When I'm saving it, I get an error message, but the indicated error line doesn't match the actual code in the class.

The error is matching the old version of the code, before I modify the class.

 

I tried to save the class using the ForceIDE and directly in the browser without success.

I also tried to recompile all classe but I fails because of the same error.

 

So I emptied all the code in the class, leaving only the declaration (see screenshot below), but the error message is still referencing the old code :(

 

Error: Compile Error: Variable does not exist: Constants.CONTACT at line 59 column 83

screenshot: http://i.imgur.com/WbQvpXU.png

 

 

I seems like the old code is cached somehow, does anybody know how to handle this?

 

 

 

 

 
  • March 20, 2013
  • Like
  • 0

Hi,
Can you please help resolve this problem I've got?
http://dl.dropbox.com/u/40211031/t396.png

I have created a simple trigger that would update all associated opportunities with a field on the account record upon update, however I'm not sure what the test method needs to be since all the examples I found relate to a new record being created.  Would appreciate any help.

 

Here is the code for my trigger:

 

trigger accountTrigger on Account (after insert,after update) 
{ 
  
List<account> accountWithOpptys = [select id,name,customaccount__c, (select id, name, customopportunities__c from Opportunities where accountId IN :Trigger.newMap.keySet()) 

from Account where Id IN :Trigger.newMap.keySet()]; 

for(Account a : accountWithOpptys)
  { 
  for(Opportunity o: a.Opportunities)
    { 
    o.customopportunities__c = a.customaccount__c; 
    update o;
    } 
  } 
}

 I was hoping there is someone that has done something similar where I could leverage your test case.  

 

 

I've been searching around, but have yet to find the solution.  I have the trigger below that prevents the case from being deleted if the work order count field is > 0.  The problem is that it shows a somewhat harsh system error message vs. a nice popup window that the user can click ok on.  Any suggestions?

 

trigger BeforeDeleteCase on Case (before delete) {

for (Case cs : trigger.old)
    {
        
        if (cs.Work_order_count__c > 0)
        //if the work order count is more than zero
            {
            	cs.addError('Can delete this case, A work order for this case currently exists');
            }  
           
}
}

 

Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Can delete this case, A work order for this case currently exists".

Click here to return to the previous page. 

 

  • March 19, 2013
  • Like
  • 0

I'm creating a new Change(our custom object) record from a case.  When you click the Change Management button to do so, I have apex that runs to pull over the account name, contact name, dealer, product and support advocate information from the case.  The Account field on the Case is a lookup, the Account field on the Change is a lookup, but for some reason I can't get it to sync with each other.  This works fine, no errors, but then the Account field on the Change record doesn't get filled in, I still have to use the lookup.  I just want the account name from the case to auto fill in.  Is that possible?

Here's part of my code:

public class SampleCaseButtonController {

    Case currCase;

    public SampleCaseButtonController(ApexPages.StandardController controller) {
        currCase = [Select Account_Name__c, ContactId, Dealer__c, Product__c, Support_Advocate__c From Case Where Id = :controller.getId()];
    }
    
    public PageReference changeCase(){
    
        // Create a new Change Record
        Change__c newChange = new Change__c();
        
                
              
        // Fill in the values for the new record
      
        
        newChange.Account_Name_text__c  = currCase.Account_Name__c;

 

  • March 19, 2013
  • Like
  • 0

hey i have a multipicklist in my code that consists of the following values:

 

MultiSelectField values: "100" , "200", "300", "400" and so forth.

 

So I created a Custom Label and the value consist of "100".

Api Name: Custom_Label

Value: 100

In my code I have the following

List <string> strList = new List <string> ();

add.strList(label.CustomLabel);

 

in my query i have the following:

 

List <object> obj = [select id, multiselect from object where multiselect IN: (strList)];

 

is this the best practice to retrieve record based on multipicklist value? I am trying to limit any hardcoding of values because it may change in the future?

 

Also maybe in the future i want to add an extra value into my list based on the multi-select, for example I want only records with multipicklist containing "100" or "200"?

 

Any thoughts?

I'm trying to write my first trigger and having difficulties doing it.  I was wondering if someone could help me.
On the account record there is a field called District__c.  This needs to be the same as Territory__c on the account owner's user record.  I would like the trigger to fire when the account owner is changed to keep the two fields in sync.  The trigger would need to work also when accounts are mass transferred from one owner to the other.
Thank you in advance for your help!
Claire

Hi Folks,

       This is with regard to validation rule that i want to apply on Account object.

We have a custom field Countries which is a dependent list on Regions.

   Lets say :

Region:

North America

 

Coutries:

Greenland
Mexico
United States of America

 

On account object we have a standard filed called "Billing Country" here i wann to validate the Billing Country entered should match with any value of countries dropdown list.

 

Please help me on this.

 

Thanks,

Karthik

 

hi,

i have written validation rule for vat number format checking.it was checking for only one country.for rest of the countries it  havenot work.for example in that rule i have written for 3 countries..it is working fine for germany ,for  rest of the countries(finland,denmark) rule is not working.can u tell me where is the problem and what i have to do.

 

 

OR(OR(AND(AND(ISPICKVAL( Country__c ,'GERMANY') ,ISBLANK( VAT_No_c__c )),ISPICKVAL( Account_Type__c , 'Corporate')),NOT(REGEX( VAT_No_c__c ,"([A-Z]{2}\\d{9})?"))),
OR(AND(AND(ISPICKVAL( Country__c ,'FINLAND') ,ISBLANK( VAT_No_c__c)),ISPICKVAL(Account_Type__c ,'Corporate')), NOT(REGEX( VAT_No_c__c ,"([A-Z]{2}\\d{4})?")))
OR(AND(AND(ISPICKVAL( Country__c ,'DENMARK') ,ISBLANK( VAT_No_c__c)),ISPICKVAL(Account_Type__c ,'Corporate')),NOT(REGEX( VAT_No_c__c ,"([A-Z]{2}\\d{7})?"))))

 

Regards,

Praveen

  • September 10, 2012
  • Like
  • 0