• Marko Lamot
  • NEWBIE
  • 495 Points
  • Member since 2013
  • Agilcon

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

I have valiadtion rule which should allow 2 profiles to allow changes to only 3 fields.

 

below is rule but this is not working when i am changing others fields along with fields which is mentione din validation rule:

 

AND(NOT(OR(
ISCHANGED(Close_Date__c),
ISCHANGED(Status__c),
ISCHANGED(Delivery_Date__c)
)),
OR(
($Profile.Name="Profile1"),
($Profile.Name="Profile2")
))

 

 

Any help on this...Its Urgent...

I need help again. I am still new at this and I don't fully understand Apex.

 

I wrote a vp for a user to create a new record. Here

 

I am not getting any errors when editing the page, but when I run it I get the following error:

 

Attempt to de-reference a null object

Error is in expression '{!Save}' in page requestcreate

 

 

An unexpected error has occurred. Your development organization has been notified.

 

Here is my code:

 

<apex:page standardController="Case" showHeader="true" sidebar="true" extensions="CaseEditExtension">
  <apex:form >

  <apex:sectionHeader title="Visualforce Form" subtitle="Create a Request"/>

    <apex:pageMessages />  
    <apex:pageBlock title="Welcome {!$User.FirstName}!" id="pgBlock" mode="edit">
    <apex:pageBlockButtons location="both">
                <apex:commandButton value="Save" action="{!Save}" />
                <apex:commandButton value="Cancel" action="{!Cancel}"/>
            </apex:pageBlockButtons>

    <apex:pageBlock title="Contact Info">
    <apex:outputLabel >Account Name</apex:outputLabel>                  
    <apex:outputField value="{!case.AccountId}" />
    </apex:pageBlock>
  <apex:pageBlockSection id="pgBlockSectionDescriptionInfo" title="Description Info" collapsible="false" columns="2">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Subject</apex:outputLabel>                  
                    <apex:inputText id="caseSubject" value="{!case.Subject}" size="75" />
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
              
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Description</apex:outputLabel>                  
                    <apex:inputTextArea id="caseDescription" value="{!case.Description}" cols="75" rows="6" />
                </apex:pageBlockSectionItem>               
                <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
                 </apex:pageBlockSection>
   
  <apex:pageBlockSection id="cas5" title="Case Detail:" collapsible="false" columns="2">
        <apex:pageBlockSectionItem >
                   <apex:outputLabel >Type</apex:outputLabel>                  
                   <apex:inputField id="caseType" value="{!case.Type}" />
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>

              <apex:pageBlockSectionItem >
                    <apex:outputLabel >Case Reason</apex:outputLabel>                  
                    <apex:inputField id="caseReason" value="{!case.Reason}" />
              </apex:pageBlockSectionItem>               
                <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
                 </apex:pageBlockSection>
       
                 
  </apex:pageBlock>
  </apex:form>
</apex:page>
                       

Thank you for your help.

  • June 28, 2013
  • Like
  • 0

i have promotion object as an related list in the campaign object.

i need to enter only 3 promotions for that campaign , if at all i am entering another promotion it chould throw an error

please suggest the way to do this...

 

thanks in advance
sfdcinap

Hi, It's very easy open the detail page of a new record created in a custom controller of a visual force page.

Example code:

 

public PageReference save() {
…….
        PageReference acctPage = new PageReference('/' + Influencer.id);
        acctPage.setRedirect(true);
        return acctPage;
    }

But i would like to be able to open the page of the new record in edit mode.

Please, can you help me?

Thanks in advantage for any advice.

  • June 21, 2013
  • Like
  • 0

I am writing an Apex Test Class and am receiving the error: Compile Error: Expression cannot be assigned at line -1 column -1.  Can anyone help me with this??  The class below.  Any help is greatly appreciated!  Thanks!!

 

  Error: Compile Error: Expression cannot be assigned at line -1 column -1

 

@isTest
private class TestBankTransactionRollUpTrigger {

    static testMethod void testRollUpToBankTransaction() {
        Test.startTest();
        //get the Client account record type
        RecordType clientRt = [SELECT Id, DeveloperName FROM RecordType WHERE DeveloperName = 'Client'];
      
        //Client Owner of Bank Account
        Account pAccount = new Account();
        pAccount.Name = 'Client Account';
        account.RecordTypeId = clientRt.id;
        insert pAccount;
        
        //Bank Account
        Client_Fiduciary_Bank_Account__c pBankAccount = new Client_Fiduciary_Bank_Account__c();
        pBankAccount.Name = 'Bank Account';
        pBankAccount.Client_Owner_of_Account__c = pAccount.id;
        pBankAccount.Account_Number__c = '12345';
        pBankAccount.Bank_Number__c = '12345';
        pBankAccount.Last_Statement_Date__c = '5/31/2013';
        insert pBankAccount;
        
        //Bank Transaction
        Bank_Transaction__c pBankTransaction = new Bank_Transaction__c();
        pBankTransaction.Bank_Account__c = pBankAccount.id;
        pBankTransaction.Transaction_Type__c = 'Incoming Wire';
        pBankTransaction.Transaction_Date__c = '1/1/2013';
        pBankTransaction.Transaction_Amount__c = '1000000.00';
        insert pBankTransaction;
        
        //Claim
        User user = TestCreateMockData.buildTestUser(41, 'Standard User');
        insert user;
        Contact underwriter = TestCreateMockData.buildTestUnderwriter(42, 'The Underwriter');
        insert underwriter;
        Account iVosProgram = TestCreateMockData.buildTestProgramAck(43, 'iVos Program', user);
        insert iVosProgram;
        Account insured = TestCreateMockData.buildTestInsuredNoAck(44, 'Insured iVos', user);
        insert insured;
        Policy__c policy = TestCreateMockData.buildTestPolicy(45, 'The Policy', underwriter, insured);
        insert policy;
        Claim__c iVosClaim = TestCreateMockData.buildTestiVOSClaim(46, 'iVos Claim1 TBD', iVosProgram, insured, policy);
        insert iVosClaim;
        
        //create cash calls and add it to bank account
        List<Cash_Call_Request__c> cashCalls = new List<Cash_Call_Request__c>();
        
        Cash_Call_Request__c cashCall1 = new  Cash_Call_Request__c();     
        cashCall1.Claim__c = iVosClaim.id;
        cashCall1.Bank_Account__c = pBankAccount.id;
        cashCall1.Amount_Requested__c = '125000.00';
        cashCall1.Comments__c = 'legal';
        cashCall1.Submitted_for_Approval__c = true;
        cashCall1.Approved_for_Cash_Call__c = true;
        cashCall1.Submitted_for_Cash_Call__c = true;
                
        Cash_Call_Request__c cashCall2 = new  Cash_Call_Request__c();         
        cashCall2.Claim__c = iVosClaim.id;
        cashCall2.Bank_Account__c = pBankAccount.id;
        cashCall2.Amount_Requested__c = '150000.00';
        cashCall2.Comments__c = 'legal';
        cashCall2.Submitted_for_Approval__c = true;
        cashCall2.Approved_for_Cash_Call__c = true;
        cashCall2.Submitted_for_Cash_Call__c = true;
          
        cashCalls.add(cashCall1);
        cashCalls.add(cashCall2);
        insert cashCalls;
        
        //update cash call to funded and paid
        cashCall1.Cash_Call_Funded__c = true;
        cashCall1.Check_Number__c = '1234';
        cashCall1.Paid__c = true;
        cashCall1.Date_Check_Printed__c = '5/31/2013';
        cashCall1.Amount_Paid__c = '100000.00';
        cashCall1.Funding_Wire_Transfer__c = pBankTransaction.id;
        update cashCall1;
        
        //check that the total cash call requested has increased to $125000.00
        pBankTransaction = [SELECT id, name, Total_Cash_Call_Requested__c FROM Bank_Transaction__c WHERE ID = :pBankTransaction.id];
        System.assertEquals(125000, pBankTransaction.Total_Cash_Call_Requested__c);
        
        cashCall2.Cash_Call_Funded__c = true;
        cashCall2.Check_Number__c = '5678';
        cashCall2.Paid__c = true;
        cashCall2.Date_Check_Printed__c = '6/1/2013';
        cashCall2.Amount_Paid__c = '90000.00';
        cashCall2.Funding_Wire_Transfer__c = pBankTransaction.id;
        update cashCall2;
        
       //check that the total cash call requested has increased to $275000
        pBankTransaction = [SELECT id, name, Total_Cash_Call_Requested__c FROM Bank_Transaction__c WHERE ID = :pBankTransaction.id];
        System.assertEquals(275000, pBankTransaction.Total_Cash_Call_Requested__c);
        
        delete cashCall1;
        Test.stopTest();
    }
}

 

 

   

  • June 20, 2013
  • Like
  • 0
In my custom object i have 7 status fields. All these are pick-list fields.
 
If the user update first status field, status message will be updated in the x field. I am doing this using trigger before insert and before update.
 
If the status message is approved and business day is 5(Last Modified date +7), I have to update the next pick-list field to "No" and update the date. I am able to achieve this using workflow field update.
 
Now based on the field update, i have to update the status message field(x) using trigger.
 
This is working fine for first record of the object. For the upcoming records the field (status message) is not updated using trigger where as the field update is happening correctly.
 
Kindly advice.

Hi everyone,

 

I am new to Salesforce. I can't figure out how to capture value from a lookup field in VF and save it into a varaible in Apex, can someone help please? I have an Custom_Test__c is my object and Custom_Name__c is the lookup field, below is the code:

 

---VF---

<apex:page standardController="Custom_Test__c" recordSetVar=""
extensions="myUserListHandler">
<br/>
<apex:form >

<apex:pageBlock title="Select project" id="selectionBlock2">
<apex:inputField value="{!Custom_Test__c.Custom_Name__c}" required="true">
</apex:inputField>
<apex:commandButton value="selected Users(" action="{!dodelete}" onclick="return confirm('Are you sure you?');" />
</apex:pageBlock>


</apex:form>

</apex:page>

 

 

 

 

 

----Apex---

 

public void docreate() {

Id Iduser;

Custom_Test__c myObject = (Custom_Test__c) controller.getRecord();

for (String s: selectedNames) {

if (s <> NULL ){

List<User> accs = [SELECT Id, Name FROM User WHERE Name =:s];

for(User a : accs){
Iduser =a.Id;
EntitySubscription newEN = new EntitySubscription(ParentID =myObject.id,SubscriberId=Iduser);
try{
insert newEN;
} catch (DmlException e) {}
}


}

}

}

 

Thanks,

  • June 18, 2013
  • Like
  • 0

I am creating an apex generated chatter post to put big deals into a big deals group.  I want to put information about the deal including the amount.  I am having issues trying to get the amount to display in its currency format.  I am pushing it to a group so chatter free users can see it too.

 

trigger PostBigDeal on Opportunity (before update) {
    
    //vairables for use later
    List<Opportunity> OppIds = new List<Opportunity>();
    List<FeedItem> feeds = new list<FeedItem>();
            
    for( opportunity opp: Trigger.New){
        	
        if ((opp.Big_Deal_Post__c == true) && (trigger.oldMap.get(opp.id).Big_Deal_Post__c == false )){    
            oppIds.add(opp);
	        }
        }
    
    if (oppIds.size() != 0) {
        
        for( opportunity BigOpp: [SELECT Id, owner.name, Subscription_Type__c, amount FROM opportunity WHERE Id IN :OppIds]){
   
            FeedItem post = new FeedItem();
            post.ParentId = '0F9Q00000004SiM'; //eg. Opportunity id, custom object id..
            post.Body = 'A New ' + BigOpp.Subscription_Type__c + ' has been sold for ' + BigOpp.amount + '.  Congratulation to ' + BigOpp.Owner.Name + ' for their hard work!';
            post.LinkUrl = 'https://cs3.salesforce.com/' + BigOpp.Id;
            feeds.add(post);
        }
        if (feeds.size() > 0) {
        Database.insert(feeds,false); //notice the false value. This will allow some to fail if Chatter isn't available on that object
    }
    }    
}

 

Hello!

 

I'm a little stuck. I'm trying to create a workflow to populate a custom date/time field. 
Our cases first get assigned to a "queue" named "support queue"

 

I have a formula and a workflow the capture the date it is ASSIGNED to the queue. Howeve,r I'm stuck on getting an accurate date on when it leaves the queue. 

 

I was thinking of using a combination of ISCHANGED and PRIOR value functions but I'm not getting it to work. 

 

Basicaly, I need the wofklow to trigger when the owner has CHANGED where the previous owner = Support queue.

 

Would this work for what I"m trying to achieve? Thanks for your help!

 

 

  • June 18, 2013
  • Like
  • 0

Hi 

 

 I have an  object named Details__c and it's look-up is there in Account  object. So obviously we will get a related list of  Details__c over the detail page of  Account..

I would like to create a button such that when user clicks on that that related list will be opened in a seprate window.(We will delete Details__c from related list so user can only access it through custom button)

 

How can i do this???

 

 

Hi,

 

I would like to make a validation rule for our discount products.  If the discount product is selected and the user tries to put in a "Sales Price" of anything above 0 that an error occurs.  I was unsure if this was a product validation rule or an opportunity validation rule.  Please let me know if you can assist.  It would be greatly appreciated.

 

Thanks,

Greetings!

 

I have a problem with my if statement

 

I don't kow where i'm wrong i'm lost with many if lol

 

if (Clasificacion_comercial__c ="ON",if( text(SLA__r.Tipo_de_Edificio_que_Aplica__c )="ON",if (Clasificacion_comercial__c ="SOT",if( text(SLA__r.Tipo_de_Edificio_que_Aplica__c )="SOT",if (Clasificacion_comercial__c ="OTROS",if( text(SLA__r.Tipo_de_Edificio_que_Aplica__c )="OTROS", SLA__r.Name ,"SLA no asignado"),"SLA sin Asignar")))))

 

What i need is that if the clasificiacion comercial (from object1) is equal to tipo de edificio que aplica (from object2) i get the name from the object2

 

I'll really appreciate your help.

while this trigger works on individual records, bulk processing processes all new records instead of the intended records... i've tried several different ways to change this, but am failing miserably... any help would be greatly appreciated... i know the issue is the second "for (Opportunity o: System.Trigger.new)"... but I don't know what the format should be...

 

anyways, thanks for any help!

 

Trigger mfgPriceQuote on Opportunity (before insert, before update) {

// only update 'Print & Mfg Quote' records

  Id recId = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Print & Mfg Quote').getRecordTypeId();
  Id recId2 = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Print Quote').getRecordTypeId();
  system.debug('redId: ' + recId + '    recId2:  ' + recId2);

//set up maps for mfg run charges... 

  Map<Id, Opportunity> oppQuotes = new Map<Id,Opportunity>();
  
  for (Opportunity opp: System.Trigger.new){
     if (opp.RecordTypeId == recId || opp.RecordTypeId == recId2){
         if (opp.Stock_Source__c != null) {
            if (opp.Number_Out__c == null || opp.Number_Out__c == 0){
               opp.addError(' Number Out must be greater than Zero for Manufacturing Quote - Please ReEnter');
            }else{
               if (opp.StageName.contains('Lost')){
                  system.debug('*** in should be Lost: ' + opp.StageName);
                  continue;
               }else{
                  oppQuotes.put(opp.id,opp);
               }
            }
        }else{
           opp.Mfg_Run_Price_1__c = 0.00;
           opp.Mfg_Size_Penalty_1__c = 0.00;
           opp.Other_Charges_1__c = 0.00;
           opp.Tinting_Charges_1__c = 0.00;
           opp.Mfg_Stock_Price_1__c = 0.00; 
        }
     }
  }
  
  if (oppQuotes.size() > 0){
  
     List<Mfg_Run_Charges__c> mrcRC = new List<Mfg_Run_Charges__c>
        ([SELECT Process_Code__c,
               X10_Reg__c,X10_Spcl_Win__c,X10_Std_Win__c,Double_Window__c,Max_Qty__c,Min_Qty__c,
               Non_10_Reg__c,Non_10_Spcl_Win__c,Non_10_Std_Win__c,Size_Penalty_Announcement__c,Size_Penalty_Announcement_M__c,
               Size_Penalty_Large__c,Size_Penalty_Small__c,Special_Window__c,Furnished_Penalty__c,Furnished_Penalty_PrePrin__c,
               Per_M_Charge__c, X14_and_Smaller_M_charge__c,Punch_Patch_Setup__c, Punch_Patch_M__c, Setup_Charge__c,
               Tint_9_and_Smaller__c, Tint_10_and_Larger__c, Miscellaneous_Charge__c
          FROM  Mfg_Run_Charges__c]);

     Map<Id,Envelope_Die__c> env = new Map<Id,Envelope_Die__c>();
  
     for(Envelope_Die__c ed : [SELECT id, X10_Commercial_Flap__c,X14_and_Smaller__c,
                                      X9_and_Smaller__c,Commercial_Size__c,Name,OE_214__c,
                                      OE_57__c,OS_658__c,OS_34__c,OS_534__c,Smaller_than_614__c
                               FROM Envelope_Die__c]){ 
        env.put(ed.id,ed);
     }
     
//****  I KNOW THIS IS MY ISSUE, BUT DON'T KNOW HOW TO FORMAT PROPERLY
     for (Opportunity o: System.Trigger.new){
        boolean mfgEnvYes = false;
        if (o.Envelope_Die_New__c != null){
            mfgEnvYes = true;
        }
        o.Mfg_Run_Price_1__c = 0.00;
        o.Mfg_Size_Penalty_1__c = 0.00;
        o.Other_Charges_1__c = 0.00;
        o.Tinting_Charges_1__c = 0.00;
        o.Mfg_Stock_Price_1__c = 0.00;  
.
.
.
}

 

Hello:

 

I am attempting to delete a group of child records if a parent record is updated. I cannot seem to get the trigger to fire. Any thoughts? Am I over-complicating this?

 

When a Turf__c record is updated, I want to delete all associated Rep_Summary__c records.

 

trigger RepAssignmentDelete on Video_Turf__c (after update) {

    Set<ID> turfDoors = new Set<ID>();
    for(Video_Turf__c turfRep : trigger.old)
    (turfDoors.add(turfRep.ID));
    
    Map<String, Video_Turf__c> turfMap = new Map <String, Video_Turf__c>();
    for(Video_Turf__c turf1 : [Select ID, Name, Date__c, Doors_Per_Rep__c from Video_Turf__c where ID in : turfDoors])
    turfMap.put(turf1.Name, turf1);
    
    List<Rep_Summary__c> repsToDelete = new List<Rep_Summary__c>();
    for(Rep_Summary__c a :[Select Name, Date__c, Doors__c, Release__c from Rep_Summary__c where Release__c in : turfDoors])
    if(turfMap.containskey(a.Release__c)){
        repsToDelete.add(a);
    }
delete repsToDelete;
}

 Thanks,

 

Hampton

I am writing a batch class in which the last step is to send emails to assigned user , that these many " no.s" of tasks are needed to attended by him. So I want  send email in which all tasks are mentioned . What challenge i am facing is how to get all those tasks iterated in the " SingleEmailMessage" class .

 

The code below for now sends different emails for every different task . What I want is to consolidate all tasks into one email to that user.

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
	        for(integer k=0;k<accns.size();k++)
	        {
		        
		       	mail.setToAddresses(new String[] {'abhishek.pandey@sfclouds.com'});
				mail.setReplyTo('abhishek.pandey@sfclouds.com');
				mail.setSenderDisplayName('Saleforce Tasks');
				mail.setSubject(accns[k].Subject);
				mail.setPlainTextBody('Below is the task created for you as respectively');
				String sfdcBaseURL = URL.getSalesforceBaseUrl().toExternalForm();
                //System.debug('Base URL: ' + sfdcBaseURL );
				mail.setHtmlBody('<br/><b>Status of task : ' + accns[k].Status +'<br/>Priority :'+accns[k].Priority +'<br/>Due Date :'+accns[k].ActivityDate+'</b><p>'+
			    '<b> To view your task : </b><a href='+sfdcBaseURL+'/'+accns[k].Id+'>click here.</a>');
				Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
	        }

 

 

I want below area to traversed with the list of all tasks assigned to user , when email is sent . That means no. of tasks is variable and changes for every other user.

 

mail.setHtmlBody('<br/><b>Status of task : ' + accns[k].Status +'<br/>Priority :'+accns[k].Priority +'<br/>Due Date :'+accns[k].ActivityDate+'</b><p>'+
			    '<b> To view your task : </b><a href='+sfdcBaseURL+'/'+accns[k].Id+'>click here.</a>');

Thanks......

 

Below is my code to update a record when a button is clicked.

Its giving me a error

Faultcode soap env client unexpected element urn partner soap sforce.com done during simple deserialization

 

{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")} //adds the proper code for inclusion of AJAX toolkit

var lead_record = new sforce.SObject("Lead"); //creating sobject to hold the values of lead record that this code will ultimately update
lead_record.id = "{!Lead.Id}";
var recTypeName = "Deal Record Type";
var recordType = sforce.connection.query("Select ID, Name From RecordType WHERE Name = 'Deal Registration Record Type'" );
lead_record.RecordTypeId = recordType ;
result = sforce.connection.update([lead_record]); //push the updated records back to Salesforce
alert("Please complete further information on your deal"); //alert the user that their Lead is now able to be edited as a Deal
window.location.reload(); //refresh the page

I have a picklist with percentage values of 25, 50, 75, 100.  I have used them in a formula to fill fields by using VALUE(TEXT(Picklist_1__c))/100.

 

What I am trying to accomplish is a sum of that field in a report.  So if Opportunity A has 25, Opp B has 50, Opp C has 100, Opp D has 75; I get a sum of 250 (or 2.5).

 

Please let me know if this can be done or if I have to create another custom field (number) on my Opportunity to store this data and then get SUM that field.

 

Thanks!

I have a trigger that we use to calculate annual revenue out to 4 years on an opportunity.  It works fine except when the opportunity revenue is changed.  When the amount is changed, I have found that the 3rd and 4th year revenue does not update.  Can someone look at this and tell me what the problem is?

 

trigger reestablishServiceSchedule on Opportunity (after update) {

    Set<Id> oppIds = new Set<Id>();
    List<OpportunityLineItemSchedule> schedules = new List<OpportunityLineItemSchedule>();
    List<OpportunityLineItem> olis = new List<OpportunityLineItem>();

    if(!ProcessorControl.isTriggered){
        
        for(Integer i = 0; i < Trigger.new.size(); i++){
             if(Trigger.new[i].CloseDate!=Trigger.old[i].CloseDate || (Trigger.new[i].Amount!=Trigger.old[i].Amount)){
                oppIds.add(Trigger.new[i].Id);
            }
        }
        
        
        for (OpportunityLineItem oli: [Select Id, Opportunity.CloseDate, ServiceDate, First_Year_Revenue__c, (Select Id, ScheduleDate, Revenue From OpportunityLineItemSchedules Order By ScheduleDate Asc) From OpportunityLineItem Where HasRevenueSchedule = true AND Opportunity.ID IN: oppIds]){
            Date closeDate = oli.Opportunity.CloseDate;
            for(Integer i = 0; i < oli.OpportunityLineItemSchedules.size(); i++){
                oli.OpportunityLineItemSchedules[i].ScheduleDate = closeDate.addMonths(i);
                schedules.add(oli.OpportunityLineItemSchedules[i]);
            }
            oli.ServiceDate = oli.Opportunity.CloseDate;
            olis.add(oli);
        }
        update olis;
        update schedules;
        
        olis = new List<OpportunityLineItem>();
        for (OpportunityLineItem oli: [Select Id, Opportunity.CloseDate, First_Year_Revenue__c, TotalPrice, HasRevenueSchedule, (Select Id, ScheduleDate, Revenue From OpportunityLineItemSchedules Order By ScheduleDate Asc) From OpportunityLineItem Where Opportunity.ID IN: oppIds]){
            double firstYearRevenue = 0;
            double secondYearRevenue = 0;
            double thirdYearRevenue = 0;
            double FourthYearRevenue = 0;
            if(oli.HasRevenueSchedule){
                for(OpportunityLineItemSchedule sched: oli.OpportunityLineItemSchedules){
                    if(oli.Opportunity.CloseDate.year() == sched.ScheduleDate.year()){
                            firstYearRevenue += sched.Revenue;
                    } else if(oli.Opportunity.CloseDate.year()+ 1 == sched.ScheduleDate.year()){
                            secondYearRevenue += sched.Revenue;
                    } else if(oli.Opportunity.CloseDate.year()+ 2 == sched.ScheduleDate.year()){
                            thirdYearRevenue += sched.Revenue;
                    } else if(oli.Opportunity.CloseDate.year() + 3 == sched.ScheduleDate.year()){
                            FourthYearRevenue += sched.Revenue;
                    }
                }
            } else {
                firstYearRevenue = oli.TotalPrice;
            }
            oli.First_Year_Revenue__c = firstYearRevenue;
            oli.Second_Year_Revenue__c = secondYearRevenue;
            oli.Third_Year_Revenue__c = thirdYearRevenue;
            oli.Fourth_Year_Revenue__c = FourthYearRevenue;
            olis.add(oli);
        }
        update olis;
        
            }

}

 I appreciate any help that you can give me.

 

Thanks,

 

Matt

We have had a situation with 2 users today when trying to access contacts - Info is there with name/household etc but the description field now looks like this and below this we have lost address phone numbers & email etc:Can anyone help please? We are a tiny not for profit struggling to understand this! Thnk you
-----------------------------
Importovaný kontakt:
Salutation : Ms.
MailingStreet : Brookhouse Farm Brookhouse Lane
MailingCity : Congleton
MailingState : Cheshire
MailingPostalCode : CW12 3QP
Description : BUPA Gt Manchester Run 2012
OwnerId : 005D0000001ap0xIAA
HasOptedOutOfEmail : 0
HasOptedOutOfFax : 0
DoNotCall : 0
CreatedDate : 27/01/2012 11:47
CreatedById : 005D0000001ap0xIAA
LastModifiedDate : 27/01/2012 11:47
LastModifiedById : 005D0000001ap0xIAA
SystemModstamp : 05/03/2012 15:52
LastActivityDate : 05/03/2012 00:00
npe01__HomeEmail__c : linedwards@hotmail.co.uk
npe01__Preferred_Email__c : Personal
npe01__Primary_Address_Type__c : Other
npe01__Private__c : 0
npe01__SystemAccountProcessor__c : One-to-One
npe01__SystemIsIndividual__c : 0
npo02__Household__c : a00D000000LTYc9IAH
npo02__SystemHouseholdProcessor__c : No Contacts
npo02__AverageAmount__c : 0
npo02__LargestAmount__c : 0
npo02__LastMembershipAmount__c : 0
npo02__LastOppAmount__c : 0
npo02__NumberOfClosedOpps__c : 0
npo02__NumberOfMembershipOpps__c : 0
npo02__OppAmount2YearsAgo__c : 0
npo02__OppAmountLastNDays__c : 0
npo02__OppAmountLastYear__c : 0
npo02__OppAmountThisYear__c : 0
npo02__OppsClosed2YearsAgo__c : 0
npo02__OppsClosedLastNDays__c : 0
npo02__OppsClosedLastYear__c : 0
npo02__OppsClosedThisYear__c : 0
npo02__SmallestAmount__c : 0
npo02__TotalMembershipOppAmount__c : 0
npo02__TotalOppAmount__c : 0
How can we rename a standerd related list on a  particular page layout?This is auto created activity(task) related list on opportunity.

Ways to do this:
renaming via relationship field: this is not applicable as changes will appear across entire org.
translation using translation  workbench :this can be helpful.but i see this is not available in this case. (task are created due to workflow on opportunity and apper under activity history or Open activity related list.these two realted list are standerd one and not avilable  in workbench ).
visulaforce section: is this possible or best solution if we want just to rename related list?
javascript component: no idea ,how to do tht?
Thanks in advance.

Hi All,

Below given is the simple web service.This web service has been written in apex and I am calling it from Apex as I am working on two salesforce orgs.I am calling getMessage () from my org and passing opportunity name as parameter and method queries salesforce database and then return the fetched record.Uptill now it has worked fine and it works fine with one record.It generated an esception that list has more tham one row for assignement.How do I make it work with multipe records.How do I send more than one record as return value to the calling method.Can somebody please help.

 

 

 

global class Greatone  
{  
//set<string> p=new set<string>();
    WebService static String GetMessage(string msg)  
    {  
      string g;
    
       //list<string> g =new list<string>();
       opportunity opp=[select id,name from opportunity where name=:msg];
       g=string.valueof(opp);     
          
        //for(opportunity last:opp)
         //{
         
         //g=string.valueof(opp);     
         //p.add(g);
                  
         //}
         return g;  
    }
     
   
}

I have valiadtion rule which should allow 2 profiles to allow changes to only 3 fields.

 

below is rule but this is not working when i am changing others fields along with fields which is mentione din validation rule:

 

AND(NOT(OR(
ISCHANGED(Close_Date__c),
ISCHANGED(Status__c),
ISCHANGED(Delivery_Date__c)
)),
OR(
($Profile.Name="Profile1"),
($Profile.Name="Profile2")
))

 

 

Any help on this...Its Urgent...

I have the following issue:

 

While deploying to production, I am encountering multiple test class failures, reproting the UNABLE_TO_LOCK_ROW error.

The failure is when the test class is trying to create an account record for testing - the error is thrown when trying to insert an account record.

 

When running all tests in a sandbox, the issue does not occur. I was able to test the deployment to a full sandbox with no issue, it's just the production environemnt that is failing.

 

I read the FAQs and trying switching off all autonumber and external id fields, but that did not make any difference. I don;t have any roll up summery fields, I'm not using any multi-threading, so can;t really find any other issue related to an 'insert' statment

 

I tried SFDC support, which refered me to the FAQ (that's premier support money well spent)

 

I'll attach an exrept of the log file, the class cuasing the issue and the account metadata file

'd appraciate any idea as we are currently stuck with this deployment ...

I need help again. I am still new at this and I don't fully understand Apex.

 

I wrote a vp for a user to create a new record. Here

 

I am not getting any errors when editing the page, but when I run it I get the following error:

 

Attempt to de-reference a null object

Error is in expression '{!Save}' in page requestcreate

 

 

An unexpected error has occurred. Your development organization has been notified.

 

Here is my code:

 

<apex:page standardController="Case" showHeader="true" sidebar="true" extensions="CaseEditExtension">
  <apex:form >

  <apex:sectionHeader title="Visualforce Form" subtitle="Create a Request"/>

    <apex:pageMessages />  
    <apex:pageBlock title="Welcome {!$User.FirstName}!" id="pgBlock" mode="edit">
    <apex:pageBlockButtons location="both">
                <apex:commandButton value="Save" action="{!Save}" />
                <apex:commandButton value="Cancel" action="{!Cancel}"/>
            </apex:pageBlockButtons>

    <apex:pageBlock title="Contact Info">
    <apex:outputLabel >Account Name</apex:outputLabel>                  
    <apex:outputField value="{!case.AccountId}" />
    </apex:pageBlock>
  <apex:pageBlockSection id="pgBlockSectionDescriptionInfo" title="Description Info" collapsible="false" columns="2">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Subject</apex:outputLabel>                  
                    <apex:inputText id="caseSubject" value="{!case.Subject}" size="75" />
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
              
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Description</apex:outputLabel>                  
                    <apex:inputTextArea id="caseDescription" value="{!case.Description}" cols="75" rows="6" />
                </apex:pageBlockSectionItem>               
                <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
                 </apex:pageBlockSection>
   
  <apex:pageBlockSection id="cas5" title="Case Detail:" collapsible="false" columns="2">
        <apex:pageBlockSectionItem >
                   <apex:outputLabel >Type</apex:outputLabel>                  
                   <apex:inputField id="caseType" value="{!case.Type}" />
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>

              <apex:pageBlockSectionItem >
                    <apex:outputLabel >Case Reason</apex:outputLabel>                  
                    <apex:inputField id="caseReason" value="{!case.Reason}" />
              </apex:pageBlockSectionItem>               
                <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
                 </apex:pageBlockSection>
       
                 
  </apex:pageBlock>
  </apex:form>
</apex:page>
                       

Thank you for your help.

  • June 28, 2013
  • Like
  • 0

Ok so i have tried every message on the board over the last 2 days and cant seem to get what im trying to acomplish to work. So here is what i am trying to do and my code snipet.

 

I have a VF page that has a picklist called activity_type. When certain choices are picked i would like for the pageblocksection to go away and if they are not selected to show (i.e. if activity_type != Null or Conference or TradeShow remove venue details section)

 

So below is my code. I have tried actionsupport / rendered / rerendered / onchange / onclick u name i have tried it. What i am seeing is

1. that when the page loads for one the venue detail section is gone all together even with null listed

2. When i move the rendered to a field it  will work but not bring it back when it is changed

 

Below is my code i hope someone can see what im totally missing:

 

Ivan

 

Code from controller:

public Boolean checkMe (){ 
       	if (this.request.Activity_Type__c != null ||
			this.request.Activity_Type__c != 'Conference' ||
			this.request.Activity_Type__c != 'TradeShow'){
       		return false;
       	}
       	return true;
    }   		


Code from VF Page:

<apex:pageBlockSection title="Event Details" id="eventdetails">
        <apex:inputField required="true" value="{!request.Event_Name__c}" styleClass="normalinput"/>
        <apex:inputField required="true" value="{!request.Event_Date__c}"/>
        <apex:inputField required="true" value="{!request.Activity_Type__c}" />
        <apex:actionSupport event="onchange" rerender="venuedetails"/>
        <apex:inputField required="true" value="{!request.Estimated_Leads__c}" styleClass="shortinput"/>
        <apex:pageBlockSectionItem >
            <apex:outputLabel >Description</apex:outputLabel>
            <apex:inputField required="true" value="{!request.Event_Description__c}" styleClass="textarea"/>
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputPanel >
                <apex:outputLabel >Currency</apex:outputLabel> <br></br><br></br>
                <apex:outputLabel >Requested Funding Amount</apex:outputLabel>
            </apex:outputPanel>
            <apex:outputPanel >
                <apex:inputField required="true" value="{!request.Currency__c}"/>
                <apex:inputField required="true" value="{!request.Requested_Funding_Amount__c}" styleClass="shortinput"/>
            </apex:outputPanel>
        </apex:pageBlockSectionItem>

        
        <!-- Materials Section -->
        <apex:pageBlockSectionItem >
            <apex:outputLabel >Materials Needed: <br></br> (select any that apply)</apex:outputLabel>
            <apex:selectCheckboxes value="{!materials}" layout="pageDirection">
                <apex:selectOptions value="{!materialOptions}" />
            </apex:selectCheckboxes>
        </apex:pageBlockSectionItem>
        <!-- END Materials Section -->
        
        <!-- Product Focus -->
        <apex:inputField required="true" value="{!request.Product_Focus__c}"/>
        <!-- END Product Focus -->
        
    </apex:pageBlockSection>
    <!-- END Event Details -->
    
    <!-- Venue Info -->
    <apex:pageBlockSection title="Venue Details" columns="1" id="venuedetails" rendered="{!checkMe}">
        <apex:inputField required="true" value="{!request.Venue_Name__c}"  styleClass="normalinput"/>
        
        <apex:pageBlockSectionItem >
            <apex:outputLabel >Address</apex:outputLabel>
            <apex:inputField required="true" value="{!request.Venue_Address__c}" styleClass="longinput"/>
            
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel >City</apex:outputLabel>
            <apex:inputField required="true" value="{!request.Venue_City__c}"/>
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel >Postal Code</apex:outputLabel>
            <apex:inputField required="true" value="{!request.Venue_Postal__c}"/>
        </apex:pageBlockSectionItem>
        
        <!-- Same actionRegion pattern as above -->
        <apex:pageBlockSectionItem dataStyleClass="requiredInput" >
            <apex:outputLabel >Country</apex:outputLabel>
            <apex:actionRegion >
            <div class="requiredInput">
            <div class="requiredBlock"></div>
            <apex:selectList value="{!request.Venue_Country2__c}" size="1">
                <apex:actionSupport event="onchange" reRender="venuestate"/>
                <apex:selectOptions value="{!CountryOptions}"/>
            </apex:selectList>
            </div>
            </apex:actionRegion>
       </apex:pageBlockSectionItem>
    </apex:pageBlockSection> 
    
    <apex:pageBlockSection columns="1" id="venuestate">
        <apex:pageBlockSectionItem rendered="{!venueRequiresState}">
            <apex:outputLabel >State/Province</apex:outputLabel>
            <apex:inputField required="true" value="{!request.Venue_State__c}"/>
        </apex:pageBlockSectionItem>
    </apex:pageBlockSection>
    <!-- END Venue Info -->

 

 

For some odd reason my Trigger won't deploy because some unrelated test class is failing. Why would my unrelated "Case" trigger cause an "Opportunity" trigger test class to fail?

 

Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (pricebook entry currency code does not match opportunity currency code): [PricebookEntryId]", Failure Stack Trace: "Class.Opp_Trigger_Prod_Qty_Summary_Test_Class.val...

 

We have a button on Cases called Create Change.  If I click it it gives me the edit page of the new record.  If I click Cancel, its stillcreating the record.  How do I get Cancel work like a normal Cancel button?

 

public class SampleCaseButtonController {
    //Create a variable to hold the case that is accessible from the rest of the class
    private Case currCase = new Case();

    public SampleCaseButtonController(ApexPages.StandardController controller) {
       
        List<Case> caseList = [Select AccountId, /*Contact.Phone, Contact.Email, Contact.MobilePhone, ContactId,*/ Product__c, Support_Advocate__c From Case c Where Id = :controller.getId() LIMIT 1];
        //If cases are returned from the query
        if(caseList.size() > 0){
           currCase = caseList[0];
        }
    }
    
    public PageReference changeCase(){
    
        // Create a new Change Record
        Change__c newChange = new Change__c();
          
        // Fill in the values for the new record
        newChange.Account_Lookup__c = currCase.AccountId;
        
        // We put the case contact id field into a string because in the SOQL query,
        // we cannot compare the User ContactId field to an ID field directly. Doing so will
        // throw an "Invalid assignment of Schema.Sobjectfield to Id" error.  Exact reason
        // unknown but likely related to the special construction of the Portal fields in the 
        // User object.
       
        //String tmpId = currCase.ContactId;
        //if(tmpId != null)
        //{
        //newChange.Contact14__c  = [Select id From User Where ContactId = :tmpId LIMIT 1].Id;
        //}
        //newChange.Dealer_Account1__c    = currCase.Dealer__c;
        newChange.ProductChange__c      = currCase.Product__c;
        //newChange.Support_Advocate_Change__c  = currCase.Support_Advocate__c;   
        //newChange.Change_Owner14__c = currCase.Support_Advocate__c;
        //newChange.Contact_Phone__c =  currCase.Contact.Phone;
        //newChange.Contact_Mobile__c = currCase.Contact.MobilePhone;
        //newChange.Contact_Email__c = currCase.Contact.Email;
              
        
        // Insert the change record 
        Database.insert(newChange);
        
          //create a new Case Change Association
        Case_Change_Association__c newCCA = new Case_Change_Association__c();
         // Fill in the values for the new record
         newCCA.Case__c = currCase.Id;
         newCCA.Change__c = newChange.id;
         
        //Insert the new Case Change Association record
        Database.insert (newCCA);
            
        PageReference retPage = new PageReference('/' + newChange.id + '/e' + '?retURL=' + newChange.id);
        return retPage;
    
              }  
}

 

<apex:page standardController="Case" extensions="SampleCaseButtonController" action="{!changeCase}">
   
   </apex:page>

 

 

  • June 26, 2013
  • Like
  • 0

Why Campaign field is unavailable in both Lead Detail and Edit pages?

# Are you salesforce smart?

pick list 

yes 

no 

 

or checkbox 

 

Please explain why?

  • June 26, 2013
  • Like
  • 0

I want to send an email to 4 email addresses from a custom button.  

 

I have a custom detail page button, execute javascript that sends email based on the ID and a workflow.  

 

How do I create a button like this to send to email addresses instead?  

 

2 of the email addresses can be referenced from the fields on the object and the other 2 are external email addresses not referenced on the object . . .

 

This is the current code:

 

{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/19.0/apex.js")}

var result = sforce.connection.query("Select Id, Send_RTA_Declare_Form__c From PAF__Personnel_Action__c where Id = '{!PAF__Personnel_Action__c.Id}' ");

var records = result.getArray("records");

//alert ( records );

records[0].Send_RTA_Declare_Form__c = true;
result = sforce.connection.update(records);

window.location = window.location;

 

Thanks in advance for any feedback.