• shruthi
  • NEWBIE
  • 314 Points
  • Member since 2011

  • Chatter
    Feed
  • 11
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 63
    Replies

Hi,

 

I have the following trigger which creates a New SI record on the SA object.

 

However, If i wanted to update a field on the SA (parent) record, where would i insert the code:

 

///Trigger now includes Creating Service Implementation and also Accounts Approval Case///
trigger AutoCreateSI on Service_Agreement__c (after insert)
{
    if(!StaticClass.flag)
    {
        List<Service_Implementation__c> listSA = new List<Service_Implementation__c>();
        List<Case> listC = new List<Case>();
        Id rtId = [select Id,name from RecordType where name='Client Management' and SObjectType='Case' limit 1].Id;
       
        for(Service_Agreement__c s : trigger.new)
        if(Trigger.isInsert)
            {
                if(s.Name != '' )
                {
                  listSA.add(new Service_Implementation__c(
                  name = s.Name,
                  Service_Agreements__c = s.id,
                  Scriptor__c='00520000001RyDK',
                  Lead_Trainer__c='00520000001xKyY'            
                  ));
                  if(s.Name != '' )
                  s.COUNT_of_AccountsSetupCases__c = 1;
               listC.add(new Case(
                  Service_Agreement__c = s.id,
                  Requested_By__c=userinfo.getUserId(),
                  RecordTypeId=rtId,
                  AccountID=s.Related_Account__c,
                  Origin='Automated Process',
                  Case_Type__c='Accounts',
                  Case_Reason__c='Approve Set-up',
                  Subject='Account Set-up - Initial Approval',
                  Description='Please update the Status of this case to indicate that you have all the required financial information for this client and where appropriate, you have been successful in collecting any deposits or advance payments.'
                  ));
               		
               	
               }
               
               
               
            }
    
        if(listSA.size() > 0)
        {
            insert listSA;
        }
        if(listC.size() > 0)
        {
            insert listC;
        }
        StaticClass.flag = true ;
    }
    }

 

I have a custom object with 4 record types.Each RT has a custom VF page and I want to replace the standard "View" so that each record type displays it's respective VF page.

 

I was using a formula based, page include methid (pasted below) which was working but I changed something and can't seem to fix it. It now renders the same VF page for both RT's.

 

<apex:page standardController="Sales_Tool__c">
<apex:outputPanel rendered="{!IF(Sales_Tool__c.RecordTypeId!='012S00000004SX5',true,false)}">
<apex:include pageName="Assessment_Form" />
</apex:outputPanel>
<apex:outputPanel rendered="{!IF(Job_Aid__c.RecordTypeId!='012S00000004SX0',true,false)}">
<apex:include pageName="CompellingEvent_Form" /> 
</apex:outputPanel>
</apex:page>

Can someone please help me figure what's wrong this?I have a deadline to deploy this so any help would be appreciated. 

 

If you're wondering why I'm not using all apex class/page sample from the cookbook, the reason is I've inherited an sfdc environment where there poor test coverage for existing code and until that's fixed,I cant do anything new.

 

Apex page action may be the answer, I did toy around with that but I'm not too familiar with VF and couldn't quite get that to work. 

 

Thanks

  • October 03, 2011
  • Like
  • 0
public with sharing class Single_Invoice

 {

//Date d1;
Set<Id> tskNo = new Set<Id>();

public List<Opportunity> opp99{get;set;} 
public Opportunity userInputAppointment {get; set;}
public Opportunity o1 {get; set;}
 public Opportunity[] o ;
 public account[] acct ;


Set<Id> oppacctname = new Set<Id>();
 public Task[] t;
 //public invoice__c[] inv;
public Task[] tsk ;

public ApexPages.StandardSetController con {
get {
if(con == null) {

userInputAppointment = new Opportunity();
userInputAppointment.From_Date__c=Date.valueof(ApexPages.currentPage().getParameters().get('fromdate'));
userInputAppointment.To_Date__c=Date.valueof(ApexPages.currentPage().getParameters().get('todate'));

 tsk=[select id, description,whatid,ActivityDate, who.type,subject, whoid from task where Priority='Renewal' and ActivityDate>=:userInputAppointment.From_Date__c and  ActivityDate<=:userInputAppointment.To_Date__c]; 
 

for(Task aa: tsk)
 {
 tskNo.add(aa.whatid);
 } 


con = new ApexPages.StandardSetController(Database.getQueryLocator
([select id,name, Account.FirstName ,CloseDate, Director_ID__r.AccountId , Director_ID__r.FirstName ,
Director_ID__c,Amount,Account.Name, Account.Id ,Account.Director_ID__c,Start_Issue__c,Expire_Issue__c,
 Account.Salutation ,Invoice_Effort__c,Payment_Date__c,Refunded_Amount__c,
 Account.Mailing_Address__c,Account.Mailing_Ste_Apt__c,
Account.Mailing_State__c,Account.Mailing_City__c,Tax__c,Total__c,
Account.Mailing_Zip__c from Opportunity where id in:tskNo and recordType.id=:'012V0000000CgYl']));

// sets the number of records in each page set
con.setPageSize(1000);
}
return con;
}
set;
}

/*
public ApexPages.StandardSetController con {
get {
if(con == null) {

 opp99=(List<opportunity>)con3.getRecords();
 for(opportunity oo1: opp99)
 {
 oppacctname.add(oo1.AccountId );
 }
con = new ApexPages.StandardSetController(Database.getQueryLocator([Select id,Salutation,Verification_Date__c,FirstName ,PersonFirstNameLocal,Asset_Size__c,Mailing_Address__c,Mailing_Ste_Apt__c,Mailing_City__c,Mailing_Zip__c,Mailing_State__c,Director_ID__c,Bank_Status__c,Bill_To__c ,name,Bill_To__r.Id  FROM Account  where id in:oppacctname order by name  ]));
// sets the number of records in each page set
con.setPageSize(1000);
}
return con;
}
set;
}

public List<Account> getAccounts() 
{
return (List<Account>)con.getRecords();
}
*/

public List<opportunity> getopp() {
return (List<opportunity>)con.getRecords();
}



// returns the page number of the current page set
public Integer pageNumber {
get {
return con.getPageNumber();
}
set;
}


// returns the next page of records
public void next() {
con.next();
}


// indicates whether there are more records before the current page set.
public Boolean hasPrevious {
get {
return con.getHasPrevious();
}
set;
}

// returns the first page of records
public void first() {
con.first();
}

// returns the last page of records
public void last() {
con.last();
}
 
// returns the previous page of records
public void previous() {
con.previous();
}

 public PageReference deliverAsPDF() {
     
     
    PageReference pdf = new PageReference('/apex/Single_Invoice_VF');     
     // PageReference pdf =  Page.page;
        pdf.getParameters().put('p','p');
        return pdf;
  }

/*
public account[] getacct() 
{
return acct;
}

public Opportunity[] geto() 
{
return o;
}
public Task[] gett() 
{
return t;
}

public Task[] gettsk() 
{
return tsk;
}
*/

}

 

  • October 01, 2011
  • Like
  • 0

Hello All,

 

I am currently working on a page which displays the Name of the payer and the payee details.

This is my VF Page code:

 

<apex:page controller="newExpenditureController" >
  
  <apex:pageBlock >
  <p>Welcome, <b>{!$User.FirstName} {!$User.LastName}</b></p>
  <p>Please select any following options to proceed</p>
  </apex:pageBlock>
  <!-- Section containing all the Action Buttons -->
  <apex:form >
  <apex:pageBlock title="Select Choice">
  <apex:pageBlockSection >
      <apex:commandButton action="{!addExpend}" value="Add Expenditure" disabled="{!b_addexp}"></apex:commandButton>
      <apex:commandButton action="{!closeAll}" value="Close All" disabled="{!b_cloall}"></apex:commandButton>
  </apex:pageBlockSection>
  </apex:pageBlock>
  </apex:form>
  
  <apex:pageBlock title="Create New Expenditure" mode="edit" rendered="{!addexp}">
  <apex:pageMessages />
  <apex:form >
  <apex:pageBlockSection columns="1">
  <apex:inputField value="{!bb.Date__c}"/>
  </apex:pageBlockSection>
  
  <apex:pageBlockSection columns="2" >
  <apex:inputField value="{!bb.Payed_By__c}" required="true" />
  <apex:inputField value="{!bb.Payed_For__c}" required="true" />
  </apex:pageBlockSection>
  
  <apex:pageBlockSection columns="2">
  <apex:inputField value="{!bb.Amount__c}"/>
  <apex:inputField value="{!bb.Description__c}" required="true"/>
  </apex:pageBlockSection>
  
  <apex:pageBlockSection >
  
  </apex:pageBlockSection>
  
  <!-- SAVE Option -->
  <center>
  <apex:pageBlockSection columns="1" showHeader="true">
  <apex:commandButton value="Save" action="{!save}"/>
  </apex:pageBlockSection>
  </center>
  
  </apex:form>
  </apex:pageBlock>
  <apex:form >
  <apex:pageBlock title="Current Details" mode="edit">
      <apex:dataTable value="{!Bill_Book}" var="bbc" width="100%">
      <apex:detail /> 
        <apex:column ><apex:facet name="header"><b>Payed By</b></apex:facet> {!bbc.Payed_By__c}</apex:column>
        <apex:column ><apex:facet name="header"><b>Payed For</b></apex:facet> {!bbc.Payed_For__c}</apex:column>
        <apex:column ><apex:facet name="header"><b>Amount</b></apex:facet> {!bbc.Amount__c}</apex:column>
        <apex:column ><apex:facet name="header"><b>Date</b></apex:facet> {!bbc.Date__c}</apex:column>
        <apex:column ><apex:facet name="header"><b>Description</b></apex:facet> {!bbc.Description__c}</apex:column>
        </apex:dataTable>
        </apex:pageBlock>
  </apex:form>
  
  
</apex:page>

 

And the following is my controller code:

 

public class newExpenditureController
{

    //Object Definition        
    public Boolean addexp {get; set;}
    public Boolean b_addexp {get; set;}
    public Boolean b_cloall {get; set;}
    public Bill_Book__c bb {get; set;}
    private final String RedirectUrl = 'https://c.ap1.visual.force.com/apex/New_Expenditure?sfdc.tabName=01r900000001gV7';
    ID id = null;   
    
    
    
    //Constructor    
    public newExpenditureController() 
    {
        Id id = ApexPages.currentPage().getParameters().get('id');    
        addexp = false;
        b_addexp = false;
        b_cloall = true;
        
        //object bb creation
        bb = new Bill_Book__c();       
    }
    
    public List<Bill_Book__c> getBill_Book()
    {
        return [SELECT
                    Payed_By__c,
                    Payed_For__c,
                    Amount__c,
                    Date__c,
                    Description__c
                    
                    FROM
                    
                    Bill_Book__c
                    
                    ORDER BY LastModifiedDate DESC LIMIT 10];
    }
    
    //Toggle Button
    public PageReference addExpend() 
    {
        //Page Access
        addexp = true;
        
        //Button access
        b_addexp = true;
        b_cloall = false;
       
        return null;
    }

    public Bill_Book__c getAccount() 
    {
        return bb;
    }
    
    public PageReference save() 
    {
        bb.Status__c = 'P';   
        try
        {
            upsert(bb);
        }
        catch(System.DMLException e) 
        {
            ApexPages.addMessages(e);
            return null;
        }
        return (redirectTab());
    }
    
    
    
    public PageReference closeAll() 
    {
        addexp = false;
                
        //Button access
        b_addexp = false;
        b_cloall = true;
        return null;
    }
    
    public String getName(String id)
    {    
        String name = null;
        name = [SELECT Name, Age__c FROM Person__c WHERE ID=:id].Name;
        return name;
    }
    
      
    public PageReference redirectTab()
    {          
       PageReference newPage = new PageReference(RedirectUrl);          
       newPage.setRedirect(true);  
       return newPage;  
    } 
        
}

 

This Object (Bill_Book__c ) has 2 lookup fields Payed_By__c and Payed_For__c, which link to another object Person__c through local relationship.

 

Currently this code provides me only the ID of the Payed By and Payed For details.

What I require is to display the First Name of these fields.

(First Name is a field of Person__c object)

 

Please help in this issue. Thanks.......... :)

How can I span a PageBlockSection into two columns in a one column display?

In the following code when I use columns="2" it spans two columns (you know the correct number here is four). When I use columns="1" it shows both fields in the first column.

 

How can show the label in the first half of the page and value in the second half of the page? I am also OK with any CSS gotcha as a solution.

 

<apex:pageBlockSection title="Span Entire Page" columns="1" collapsible="true" >
   	<apex:inputField value="{!attr.Width__c}"/>
    	<apex:inputField value="{!attr.Height__c}"/>
</apex:pageBlockSection>   

 

 

 

  • September 29, 2011
  • Like
  • 0

Can you helpm for adding the error message here? I am getting SObject row does not allow errors message

 

trigger beforeCase on Case (before insert, before update) {/*

   // List <Case> cs = Trigger.new;
   // 	TaxNumberDuplicate.checkDuplicates (cs);
   	
   		
        
         Set<String> taxNumber =new Set<String>();
         for (Case c : trigger.new) { 
         		
				taxNumber.add(c.Tax_Number__c);
			}
		
			List<Case> duplicatecaseList = new List<Case>();
			
			for(Case c : [SELECT id, Tax_Number__c, permit_duplicate__c FROM Case WHERE Tax_Number__c IN: TaxNumber])	
			
			duplicatecaseList.add(c);
			
            for(Case cs : duplicatecaseList){
            
            if(trigger.isInsert){
            
            
            		if(duplicatecaseList.size()> 0 && 
               		cs.permit_duplicate__c == FALSE && 
               		cs.Tax_Number__c != Null){
            
            		cs.Tax_Number__c.addError('ERROR!!!!!');
            	}
            }
            
            else if(trigger.isUpdate){
      
               
                if(duplicatecaseList.size()> 0 && 
                   cs.permit_duplicate__c == FALSE && 
                   cs.Tax_Number__c != Null &&
                   System.trigger.oldMap.get(cs.id).Tax_Number__c != System.trigger.newMap.get(cs.id).Tax_Number__c ){
            
                	cs.Tax_Number__c.addError('ERROR!!!!!');
            
               		 }
            }
        }    */
}

 

  • September 28, 2011
  • Like
  • 0

Hi,
is there a way to define a lookup field to a custom object from activities?.
I need to related a custom object to a task and I've been told that you can define a custom field in the activity object to define this lookUp relationship, but throught the setup UI I couldn't find out how to do.
thanks in advance,

I have a trigger that acts On INSERT Case and calls a class. This class in it's simplest form has been working quite well for some months.

 

Now I have expanded the functionality of the class to include some IF and  ELSE IF statements inside a FOR loop. This does not work because seemingly the FOR loop fails to enter. The code compiles nicely with no errors.

 

ccs is the trigger.new object passed into the class.

Debug messages in the first FOR loop confirms that there is case data available. The debug messages in the next FOR loop never executes let alone the IsIC part.

 

I use this methodology in many places and it normally works well (iterating through the trigger object pulling Id's into a list and then a FOR loop with an SOQL statement)

 

public with sharing class ChangeCaseFieldsOnFirstSave {
	public static void ChangeCaseFields(Case[] ccs){

		List<Case> CasesToUpdate = new List<Case>(); 
		List <Id> lstCases= new List<Id>();
		
		for (Case t:ccs){
				lstCases.add(t.Id);
		}
		
		for(Case c:[Select c.id, c.Subject, c.CustomerName__c, c.Status, c.IsSS__c, c.IsIc__c, c.IsKF__c, c.account.IsSS__c, c.account.IsIc__c, c.account.IsKF__c from  Case c where (c.Id in :lstCases)]) {	
			system.debug('#### - Start');
			if (c.account.IsSS__c==true) {
				c.IsSS__c=true;
				CasesToUpdate.add(c);
			}

			else if (c.account.IsIc__c==true){
				system.debug('#### - IsIC');
				c.IsIc__c=true;
				c.Subject=c.CustomerName__c;
				CasesToUpdate.add(c);
			}
			else if (c.account.IsKF__c==true){
				c.IsKF__c=true;
				CasesToUpdate.add(c);
			}
		}
		 update CasesToUpdate;
	}
}

 

 Anyone that could tell me what is wrong?

 

 

/Mats

 

 

 

 

 

Newbie Question -
 I am trying to write a trigger which creates a new task when the Contract is saved.
In the task I need to populate the Sales_Name__c field with the value from the contract field Sales_Rep_c.
I am gettin a compile error indicating an invalid foreign key relationship for c.Sales_Rep_c;

Sales_Name__c = [SELECT Name From User Where Id = : c.Sales_Rep_c.id];


If I look at the properties of the Contract field Sales_rep_c it is a reference(custom) with foreign key Sales_rep_r
The Contract field Sales_Rep_c is populated with the correct id value for the user name.

Any help is appreciated!



Hello,

 

I'm working on migrating data out of our legacy systems and am having a heck of a time as I can't seem to get the dataloader to bring in Contract records.  Everytime it runs the file it says it completes, with 0 errors and 0 successes.  The file I am using has 1928 records, and the data loader sees the records as it reports that that will be the total as soon as I point @ the csv

 

The file structure I am using includes:

InTouch_Installation_ID__c

InTouch_Account_ID__c

AccountID

DivisionID__c

Status

CustomerSignedDate

ActivatedDate

EndDate

CustomerSigned

ContractTerm 

 

Can anybody shed light on WHY the data loader isn't reporting errors, and is not importing any records?

 

Thanks!

I currently have a date field that displays a date 3 days from the date the form is opened. Here is the formula I used: TODAY() + 3

 

I would like to modify the formula to show a value of 3 business days instead of 3 days.  Can someone help?


Thanks in advance.

  • March 16, 2011
  • Like
  • 1

I am working on Q1 commissions and I see that Reps can go back and change the amount of opportunity after they have closed the opportunity. Can you please change the settings so that only I can do that and no reps after opportunity is closed? This is really urgent as it is messing up my commission calculations.

 

Suzie Squiers 703-509-2825

Hi,

 

Can u plz give the solution to the following questions.

 

1. Can we insert multiple Knowledge articles at a time using either salesforce customization or coding from system log or from apex class?

 

2. If it is possible list of articles insertion at a time, then how can i relate these articles to a particular case? While inserting any article from system log it shows all fields which are in article is not writable? so as per my understanding, its not possible to insert bulk articles or a single article from any apex code? is my understading correct?

 

3. To relate the articles to a case, i went through case related list -> articles section -> clicked on new button -> then i chosen an article type .................then i created a new article. Now this article created from case related list  is related to that particular case. But while going with any dataloader or any list insertion from code how can we related all the list of articles to case? here i can able to see  sourceid field on article, but its not useful to enter case id. Because all fields which are from articles object are not writable.? 

 

 

Please give your valuable reply.

 

 

 

Hi All,

 

trigger CountArchivedSCsonSA on ServiceContract (before update) {

     Set<Id> esIds=new Set<Id>();
     for (ServiceContract es : trigger.new)
     {
        esIds.add(es.Service_Agreement__c);
     }

     List<Service_Agreement__c> sis=[select id, DEBUG_HasArchivedSC_Indicator__c, (select id from service_contracts__r) from Service_Agreement__c where id in :esIds];
    
     for(Service_Agreement__c si : sis) {
      
      si.DEBUG_HasArchivedSC_Indicator__c  = si.service_contracts__r.size();
      si.Stage__c = si.service_contracts__r.Stage__c
  }
  update sis;
}

 The above trigger is quite simple - provides a count of records on a related list and updates a field (DEBUG_HasArchivedSC_Indicator__c) on the parent object.

 

However , when i add  si.Stage__c = si.service_contracts__r.Stage__c it dosnt work - i get : 

 

Save error: Invalid foreign key relationship: Service_Agreement__c.service_contracts__r

 

Dont quite understand why - as i am not doing anything different from the line above it, part from Instead of counting the records, I want to pass the value of the a field on one of the records back to the parent object. NB. Their will only ever be 1 record of type Service_Contract__c

 

Thanks in advance for your help.

 

Steve 

I have a trigger which will update the number of contacts on an account.

 

It is giving a problem when i am trying to update 800 records with dataloader out of which 600 got updated and gives me an exceptionlike this:

Apex script unhandled trigger exception by user/organization: 00xxx/00xxx

 contactCount: System.LimitException: Too many script statements: 200001

 

How do i solve this problem,is it a bulk trigger or do we need to change anything in the code. Pls send me the right code to handle this.

I appreciate any help on this

 

Here is the code of the trigger,
 

trigger contactCount on Contact (after insert, after update, after delete, after undelete) {

   Contact[] con;
    
    if (Trigger.isDelete) {
        con = Trigger.old;
    }
    else { 
        con = Trigger.new;
    }
    
    Set<ID> accIds = new Set<ID>();
    
    if (Trigger.isUpdate){
        for(Contact c: Trigger.old){
            if(c.AccountId != null) {
                accIds.add(c.AccountId);
            }
        }
    }
    
    for (Contact c : con) {
        accIds.add(c.AccountId);
    }
    
    Map<ID, Contact> conmap = new Map<ID, Contact>([select Id, AccountId from Contact where AccountId in :accIds And AccountId != null]);
    Map<ID, Account> accmap = new Map<ID, Account>([select Id, Number_of_Contacts__c from Account where Id in :accIds]);

    for (Account a : accmap.values()) {
        
        Set<ID> conIds = new Set<ID>();
        
        for (Contact c : conmap.values()) {
            if (c.AccountId == a.Id) {
                conIds.add(c.Id);
            }          
        }
        if (a.Number_of_Contacts__c != conIds.size()) {
            a.Number_of_Contacts__c = conIds.size();
        }      
    }   
    update accmap.values();
}

  • October 20, 2011
  • Like
  • 0

I'm honestly starting to wonder whether I will EVER get this .... here's what I'm trying to do:

 

1./  Ask user for Account Name on page 1 of wizard

2./  Display account name chosen AS WELL AS value of custom field on that account record on page 2 of wizard.

3./  Ask user for Request Type, Category and Action on page 2 of wizard.  The picklist options in the Request Type, Category and Action fields will be based on  the value of the custom field (Global Region) in the account record.

 

I am COMPLETELY FRUSTRATED and lost in trying to get this to work.  It just seems like it should be SOOO simple ... although I'm new to Apex, I know other programming languages ... why is this so difficult to grasp?

 

If anyone can help, I would be forever grateful.   And please ... give me notes and reasons why I'm doing things ... others have tried to help by just giving me links to other wizards, but because those wizards aren't doing what I want to do, they don't help me understand how to build mine.

 

Thanks ...

 

Current Custom Controller Code

public class ARWizard {

    public ApexPages.standardController controller {get; set;}
    
             
    public Assistance_Request__c assistanceRequest { get; set; }
     
    public Account account {get;set;}
    
    public ID accountID {get;set;}
    
    public ARWizard (ApexPages.standardController controller) {
        //Added by Lokesh
        if(assistanceRequest ==null)
             assistanceRequest =  new Assistance_Request__c();
      
  }   
  

    public PageReference step1() {
        return Page.arStep1;
    }

     public PageReference step2() {

      
        try {
            account = [SELECT Id,Name,Global_Region__c
                       FROM Account
                       WHERE Id =: AssistanceRequest.Account_Name__c];
                      
           }
        catch(Exception e)  {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,e.getMessage()));
    }
    return Page.arStep2;
     }


       public PageReference save() {
                System.debug('&&&&&&& Account=' + account);
            try{
                insert assistanceRequest;
            } catch (System.DmlException e) {
                ApexPages.addMessages(e);
                return null;
            }
            controller = new ApexPages.standardController(assistanceRequest);
            return controller.view();
        }
}

 

Current Page 1 Code:

<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c">
  
    <script>
    function confirmCancel(){
    var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?");
    if (isCancel) return true;
    return false;
    }
    </script>
    
    <apex:sectionHeader title="Assistance Request" subtitle="Step 1 of X"/>
  <apex:form > 
      <apex:pageBlock id="theBlock" title="Assistance Request Creation" mode="edit">
          <apex:pageBlockButtons >
              <apex:commandButton action="{!step2}" value="Next"/>
              <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/>
          </apex:pageBlockButtons>
          <apex:pageBlockSection title="Account Information" columns="1">
              <apex:inputField value="{!AssistanceRequest.Account_Name__c}"/>
          </apex:pageBlockSection>
      </apex:pageBlock> 
  </apex:form>
</apex:page>

 Current Page 2 Code:

<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c">
  
        <script>
    function confirmCancel(){
    var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?");
    if (isCancel) return true;
    return false;
    }
    </script>
    
    <apex:sectionHeader title="Assistance Request" subtitle="Step 2 of X"/>
    
  <apex:form > 
      <apex:pageBlock id="theBlock" title="Assistance Request Creation - Request Details" mode="edit">
          <apex:pageBlockButtons >
              <apex:commandButton action="{!step1}" value="Previous"/>
              <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/>
          </apex:pageBlockButtons>
          <apex:pageBlockSection title="Account Information" columns="2">
              <apex:outputField value="{!AssistanceRequest.Account_Name__c}"/>
              <apex:outputField value="{!AssistanceRequest__r.Account.Global_Region__c}"/>
          </apex:pageBlockSection>
          
           <apex:pageBlockSection title="Request Information" columns="2">
              This is where the request product, category and action will go.
          </apex:pageBlockSection>
      </apex:pageBlock> 
  </apex:form>
</apex:page>

 

I am pretty new to salesforce and I am struggling to create a validation rule.  I want to use the ISCHANGED function with a phone or fax number.  So if the phone or fax number is changed on an account then it triggers a field update on a custom object.  The workflow keeps telling me that I cannot use ISCHANGED with a phone or fax number.  Does anyone have a work around?  Thanks for the help.

 

Bladen

How to compare two lists in your trigger and update one of them so that you can do a single update. My trigger now has two update statements on Account object as below:

    if(!OppAccts.isEmpty()){update(OppAccts);}
    if(!CCPAccts.isEmpty()){update(CCPAccts);}

The reason for two different list is due to differeing criteria and logic that need to occur after update.

Any idea?



  • October 19, 2011
  • Like
  • 0

Hi

 

I'm trying to get a workflow rule to work but am having some trouble with my rule criteria.

 

I'm trying to send an email alert when the below criteria is met.

 

budget  >= $10,000.

flight days <= 5 days

 

Tried this but it's not working: 

AND((End_Date__c - Start_Date__c) <= 5, ( UnitPrice >= 10000))

 

Any help would be appreciated. Thank you.

  • October 19, 2011
  • Like
  • 0

Hi, if you open a standard page there is a related list called notes & attachments.

I want to show it on a visualforce page and cannot find out how anywhere in the documentation. 

I am a very new developer learning as I go. Could someone please help.

Sorry it is probably very easy but so much documentation and over 2hrs searching with no results!!

 

Thanks

 

Steve

I am trying to update a custom field on an OpportunityLine using an APEX trigger.  I am receiving an error message stating that the record is Read Only.  The sharing settings on the Opportunity are Public Read/Write.  Don't quite understand why the record is Read Only.  Any ideas?  The code in the Trigger follows.

 

trigger AddAssetTagOnOpportunityProduct on OpportunityLineItem (after insert) {

    if(Trigger.isInsert ){ 
    
        for(OpportunityLineItem lineItem : Trigger.new){
        
            String wppItemNumber = lineItem.WPP_Item_Number__c;
            
            System.debug('WPP Item Number : ' + wppItemNumber);
            
            sm1e__smEquipment__c maintenanceAsset = [SELECT Id, Name FROM sm1e__smEquipment__c WHERE
                                                     sm1e__External_Asset_ID__c = :wppItemNumber];
                                                     
            System.debug('Asset Tag : ' + maintenanceAsset.Name);
            
            lineItem.Asset_Tag__c =  maintenanceAsset.Id;
            
            update lineItem;
       
        }
    }
  • October 19, 2011
  • Like
  • 0

Hi,

 

Can i use multiple controller class in a single VF page. My Vf page dont have standardcontroller , i want to use only two or more user defined controller class. Is it possible, please let me know about its syntax or solutions.

 

 

 

  • October 19, 2011
  • Like
  • 0

I have a field called Activity_Type__c which I want to be populated based on the value of Status__c in other custom object.

Eg: IF Status__c = 'Submitted' , Activity__c = 'Submitted'. Like wise based on the Status__c value, there are 6 different Activity__c values.

 

I can do this through work flow, but that would mean creating 6 workflows for Field Update when each condition is satisfied.  I want to do this through Trigger but need help. 

 

Can somone please help me get started? Thanks in advance.

  • October 18, 2011
  • Like
  • 0
Hi,

I'm looking for a formula that's adds business days only, I.e Friday + 3 business days = Tuesday

Any help appreciated.

I have a very basic Visualforce page that displays multiple Pagemessages at the top of the page if certain fields are not filled out.  The Visualforce page is overriding the View mode of the Opportunity.  The Pagemessages update correctly when a user clicks Edit and updates the null field values.  However, when a user uses inline editing to update one of the fields and clicks Save, the Pagemessage(s) stay displayed.  How can I make it so that the Pagemessages update after someone edits the Opportunity using inline editing?  If a user updates one of the two fields with inline editing then I would like the messages to go away after the record is saved.  My code is below.

 

<apex:page standardController="Opportunity" >
    
    <apex:pagemessage summary="Number of Eligible Retirees is null." severity="warning" strength="1" rendered="{!Opportunity.Number_of_Eligible_Retirees__c==null}" />
    <apex:pagemessage summary="Current Rates is null." severity="warning" strength="1" rendered="{!Opportunity.Current_Rates__c==null}" />
    
    <apex:detail inlineEdit="true" rerender="{!Opportunity.id}" />
    
</apex:page>

Hi All,

 

I need to call two functions and want a delay of 10 seconds between then.

 

It is possible with Apex code ?

 

Thanks,

Deepak

This may seem a simple question but I would like to make a custom page layout on a custom object that has more than two columns and would like to have the fields show up in edit and view mode.

 

I assume this is done with visual force pages but are there any examples I can use to get me started?

  • October 06, 2011
  • Like
  • 0

Hi,

 

      I want to implement search functionality in my pages. where as, i have five fields.. In that,one field is Keywords:

 

     Now, i want to compare the values of keywords with the values of object and i need to populate the matched data.

 

     I split the string of keywords into into a array.

 

     For this string comparison , while using like operator, the query returns null even though i gave exact matched data.

 

     so, is there any way to compare the strings.

 

 

Regards,

Phanikumar

  • September 26, 2011
  • Like
  • 0