• MVJ
  • NEWBIE
  • 285 Points
  • Member since 2007

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

I want to be able to send an email from cases where the "Additional To" field is automatically populated with a custom email address we have on cases (as we do not use contacts).

 

I have been looking around for some code to do this and I have found some but I cannot get it to work for me. Can anyone see where I am going wrong? Or are you aware of another solution for this issue. The code I have been trying is:

 

Public class SendEmail
{
    public String subject {get; set;}
    public String body {get; set;}
 
    private Case cas;
   
    // Constructor to populate instance of your object
    public SendEmail(ApexPages.StandardController controller) {
    this.cas= (Case )controller.getRecord();
    cas= [SELECT cas fields required
             FROM Case
             WHERE id = :ApexPages.CurrentPage().getParameters().get('id')​];
    }
             
    public Case getCase(){
    return cas;
    }
   
   
    public pageReference send(){
    Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();  
     
    email.setSubject(subject);
    email.setToAddresses(Customer_Email_Address__c);//Use SOQL to retrieve addresses in the address
    email.setPlainTextBody(body);
    email.setBccSender(true);
   
    Messaging.SendEmailResult [] r = Messaging.SendEmail(new Messaging.SingleEmailMessage[] {email});     
    for ( Messaging.sendEmailResult result : r ) {

           if ( !r[0].isSuccess () ) {
              
               System.debug ( result  );
           }

           else{

               ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'Email Sent Successfully' );
               ApexPages.addMessage(msg);
           }
       }
    return null;  
}
}

VF Page

 

<apex:page StandardController="Case" extensions="SendEmail">
<apex:pageblock title="">
<apex:pageMessages ></apex:pageMessages>
<apex:form >

<apex:outputLabel value="Subject" for="Subject"/>:<br/>
<apex:inputText value="{!subject}" id="Subject" maxlength="80"/>
<br/><br/>
<apex:outputLabel value="Body" for="Body"/>:<br/>
<apex:inputTextarea value="{!body}" id="Body" rows="10" cols="80"/>
<br/><br/><br/>
<apex:commandButton value="Send Email" action="{!send}"/>
</apex:form>
</apex:pageblock>
</apex:page>



 

I also tried a URL hack but could not get it to work because I am not a developer and not fully sure of what is needed.

 

Any help would be greatly appreciated.

 

Regards,

 

Clubli

Whenever I create an inputfield on a Visualforce page for a Lookup field, it is displays lower than other input fileds.  Here is some sample code --- in this example, the input field for Account appears lower thatn the field for lastname:

 

<apex:page standardController="Contact" > <apex:form > <apex:sectionHeader title="Contact"> <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons > <apex:pageBlockSection > <apex:inputField value="{!Contact.AccountID}"></apex:inputField> <apex:inputField value="{!Contact.Lastname}"></apex:inputField> </apex:pageBlockSection> </apex:pageBlock> </apex:sectionHeader> </apex:form> </apex:page>

 What is wrong?

 

 

  • January 26, 2010
  • Like
  • 0

I have just started using the "Contains" syntax fuction and I now need to know what the "Does not Contain" function formula.

 

Thanks,

  • August 24, 2009
  • Like
  • 0
Hi,
 
In formulas you can use ISCHANGED function. Is there a similar method in Apex or is there some recommended design pattern for checking if a field value has changed in after update event?
 
How about ISNEW function?
 
Thanks!
  • November 28, 2008
  • Like
  • 0
Hi all,
I'm new to VisualForce but have been told this might be the solution to my issue.
 
What I'm trying to achieve is pretty simple :
- Some users are allowed to see only certain types of Activities (which are identified through a custom checkbox called isPublic__c)
- I am thus trying to create a VisualForce page for cases that would filter the Activities related list based on that checkbox (isPublic__c == true).
 
Do I need to create a custom/extended controller for that ?
I yes, do you have any sample code that would achieve this ?
 
Thanks for your help that would greatly be apreciated...
  • October 29, 2008
  • Like
  • 0
Is there anyway i can program a time workflow in apex?
I developed an XML member to do a simple extract of data from SalesForce using DataLoader. When I execute the process using a .bat file, the screen flashes and then nothing. No error messages or other messages. Is there a way to have a walkthrough on the code to see what it is actually doing? It isn't creating the extract, so something is incorrect. This is my first try at the command line processing, so I'm sure it is something simple I'm missing.
Any help would be appreciated.
  • June 25, 2008
  • Like
  • 0
I have a master product list. Each client gets a different percentage off price on products. Can I do this and will everything stay in sync with master price book?
 
Example : Have master price book with 1000 products (each with its own price of course). Client X gets 10% off each product. Client Y gets 20% off. Client Z gets 30% off. I am assuming (please correct me if there is a better way) that I need to create 3 cloned price books for this and set the prices appropriately.
 
1) I do not see any way to set a formulae in a price book, so I would have to enter each price manually. (A pain to have to program something for this, but doable). It would of course be great if I could just set a discount formulae though ... ie price book A has 10% discount on all items.
 
2) Can I set the other price books to automatically be updated with new products ftom the master list (since all the price books have the same exact products). For example, if a add 50 new products to the master list, I would ideally like the other 3 price books to pick up the products and of course have the discounts correctly applied for these products. (Again, a pain to have to program something in for this, like maybe a trigger on master price book change, blah, blah ... but if there is something already available for this, that would be fantastic).

I downloaded the enterprise WSDL for my ORG and I see that the XSD Schema is included in the WSDL.  I want to generate and XSD file for each object so I can import it into CastIron to parse the XML returned into the specific XML format for the given Object.  Is there an easy way to do this?

 

Thanks in advance.

  • October 25, 2010
  • Like
  • 0

I have an embedded VF page that links the user to an external website.

 

Only users in a specific profile can access this embedded site.

 

I have two pageblock sections on the VF Page.  Only one of them gets rendered. 

 

When the user should not see the embedded website I want to change the height of VF page so that I do not have excess white space.

 

When I add the VF Page to the page layout I set the height in pixels.  Can I change that height when the page is rendered?

 

Any help is appreciated.

 

Thanks

 

Mike

  • May 19, 2010
  • Like
  • 0

I am looking for a way to have SFDC automatically place a call thru the CTI Plug in when a user opens a lead recordThis will speed up our call center users by not having to wait for them to click the icon to place the phone call.

 

I have looked around and could not find anything relevantAny suggestions are welcomed.

 

Thanks in advance

 

Mike

 

 

  • March 01, 2010
  • Like
  • 0

I have a VF page that overrides the new button on a custom object related to opportunites.  When the user clicks to create a new quote we confirm that there exists a Contact role.  If not we redirect the user to the contact role edit page so they can select on.  If on e exists we let them create the quote.  It all works great.

 

However our business partners want us to show a message to the user why they have been redirected to the contact role edit page.

 

Since I can not popup an alert (if someone knows how to do that from a controller please advise) I created a visual force page with the message and a button that will take them to the edit page.

 

This does not work.  When I try to redirect to a VF page the redirect does not work.  What am I missing.  i can redirect to any standard SFDC page not a VF page.

 

Here os the code:

 

Redirect Page:

 

<apex:page standardController="cmgtQuote__c" extensions="DispatcherQuoteNewController" action="{!nullValue(redir.url, urlFor($Action.cmgtQuote__c.New, null, null, true))}"> </apex:page>

 

 The controller:

 

 

public class DispatcherQuoteNewController { public String opptyID {get; set;} public DispatcherQuoteNewController(ApexPages.StandardController controller) { this.controller = controller; } public PageReference gotoOpptyContactEdit(){ string opptyID = ApexPages.currentPage().getParameters().get('oppid'); //string opptyID = '006Q0000003dVVR'; PageReference newPage; newPage = new PageReference('/p/opp/ContactRoleEditUi/e?oppid='+opptyID+'&retURL=/'+opptyID); newPage.getParameters().put('nooverride', '1'); return newPage.setRedirect(true); } public PageReference getRedir() { //string opptyID = '006Q0000003dVVR'; string opptyID = ApexPages.currentPage().getParameters().get('CF00N30000002Bott_lkid'); PageReference newPage; string newQuoteURL = '/a0E/e?CF00N30000002Bott=Test&CF00N30000002Bott_lkid='+opptyID+'&retURL=%2F'+opptyID; if (hasOpportunityContact(opptyID)) { newPage = new PageReference('/a0E/e?CF00N30000002Bott=Test&CF00N30000002Bott_lkid='+opptyID+'&retURL=%2F'+opptyID); newPage.getParameters().put('nooverride', '1'); return newPage.setRedirect(true); } else { //newPage = new PageReference('/p/opp/ContactRoleEditUi/e?oppid='+opptyID+'&retURL=/'+opptyID); //newPage = new PageReference('/home/home.jsp'); newPage = new PageReference('/apex/OpportunityContactRoleError'); newPage.getParameters().put('nooverride', '1'); newPage.getParameters().put('oppid', opptyID); return newPage.setRedirect(true); } } private final ApexPages.StandardController controller; public boolean hasOpportunityContact(string opptyid){ Boolean rv = false; OpportunityContactRole [] ocr = [Select Id, OpportunityId From OpportunityContactRole Where OpportunityId = :opptyid]; if (ocr.size() > 0) {rv = true;} return rv; } }

 

When I try to redirect to the Apex Page it does not redirect. 

 

Thanks

 

 

 

  • February 18, 2010
  • Like
  • 0

I updated my version of firefox to 3.6. 

 

After the updated I notice a strange behavior on visual force pages while in developer mode. 

 

When I go to a visual force page for the first time it displays a white screen.  No borders no heading nothing a completely white page. 

 

I hit refresh then the page displays correctly.  This was not happening in version 3.5 of firefox.  Has anyone else experianced any strange behavior with VF pages in Firefox 3.6

 

When not on developer mode the page renders correctly.

 

Thanks

  • February 03, 2010
  • Like
  • 0

I have a VF page that uses a custom controller to query the Account Object.  It uses the Apex:DataTable to display the data returned fromthe controller.  It works perfect when there is 1,000 rows or less since that is the max size of a list.

 

How can I change the code to return more data?  Can the Apex:DataTable go thru a Map?  Can it go thru an object?

 

What changes do I need to make to the code?

 

Thanks in advance.

 

VF Page:

 

 

<apex:page Controller="AllAccountSearchController" tabstyle="Account" sidebar="false"> <!-- Used to include sorttable static resource for applying client sorting functionality --> <script type="text/javascript" src="{!URLFOR($Resource.sorttable, 'sorttable.js')}"/> <!-- Filter criteria --> <apex:form id="Filter"> <apex:pageBlock title="Filter"> <apex:outputPanel id="searchpanel"> <apex:pageMessages ></apex:pageMessages> </apex:outputPanel> <apex:pageBlockSection title="Criteria" columns="6" collapsible="false"> <apex:panelGrid columns="6" id="theGrid"> <apex:outputLabel style="font-weight:bold;" value="Duns Number" for="DunsNumber"/> <apex:inputText id="searchDunsNumber" value="{!searchDunsNumber}" size="10"/> <apex:outputLabel style="font-weight:bold;" value="" for=""/> <apex:outputLabel style="font-weight:bold;" value="" for=""/> <apex:commandButton action="{!search}" value="Search" id="searchBtn"/> </apex:panelGrid> </apex:pageBlockSection> </apex:pageBlock> </apex:form> <!-- Displays the Search Results section --> <apex:pageBlock title="Account(s)" > <apex:pageBlockSection title="Search Results" columns="1" collapsible="false"> <apex:dataTable value="{!AllAccounts}" var="each" cellpadding="10" border="0" width="100%" columnsWidth="1000,200,200,200,200,200,200,200" style="vertical-align:top;word-wrap: break-word;" styleClass="sortable list"> <apex:column headerValue="Account Name"><a href="/{!each.Id}">{!each.Name}</a>&nbsp;</apex:column> <apex:column headerValue="Account Duns">{!each.Site}&nbsp;</apex:column> <apex:column headerValue="Address">{!each.BillingStreet}&nbsp;</apex:column> <apex:column headerValue="City">{!each.BillingCity}&nbsp;</apex:column> <apex:column headerValue="State">{!each.BillingState}&nbsp;</apex:column> <apex:column headerValue="Zip">{!each.BillingPostalCode}&nbsp;</apex:column> <apex:column headerValue="Account Owner">{!each.Owner.Name}&nbsp;</apex:column> <apex:column headerValue="Owner email">{!each.Owner.email}&nbsp;</apex:column> <apex:column headerValue="Created Date">{!each.createddate}&nbsp;</apex:column> <apex:column headerValue="Modified Date">{!each.LastModifiedDate}&nbsp;</apex:column> </apex:dataTable> </apex:pageBlockSection> </apex:PageBlock> </apex:page>

 

Controller:

 

 

public class AllAccountSearchController { private Boolean searched = False; private String searchDunsNumber = removedashes(ApexPages.currentPage().getParameters().get('duns')); String strQuery = 'Select id, name, site, BillingStreet, BillingCity, BillingState, BillingPostalCode, createddate, LastModifiedDate, Owner.Name, Owner.email from Account where site like ' +'\'%'+searchDunsNumber +'%\'' + 'order by Name asc limit 10000'; public string removedashes(string str){ return str.replaceall( '-', '' ); } public PageReference search() { searchDunsNumber = removedashes(searchDunsNumber); if (this.searchDunsNumber.length() > 3 && this.searchDunsNumber.length() < 10){ //this.searched = True; strQuery = 'Select id, name, site, BillingStreet, BillingCity, BillingState, BillingPostalCode, createddate, LastModifiedDate, Owner.Name, Owner.email from Account where site like ' +'\'%'+searchDunsNumber +'%\'' + 'order by Name asc limit 10000'; } else{ ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please enter a DUNS Number with at least 4 characters and less then 10.'); ApexPages.addMessage(myMsg); } PageReference pr = New PageReference('/apex/accountownersearch?DUNS='+removedashes(searchDunsNumber)); pr.setRedirect(true); return pr; } public Account getAllAccounts(){ Account listAccounts = new Account(); //listAccounts = [Select id, name, site, BillingStreet, BillingCity, BillingState, BillingPostalCode, createddate, LastModifiedDate, Owner.Name, Owner.email from Account where site like'%123456789%' order by Name desc]; //if (searched) listAccounts = Database.query(strQuery ); if (this.searchDunsNumber.length() > 3 && this.searchDunsNumber.length() < 10){ try{listAccounts = Database.query(strQuery);} catch(Exception ex){ApexPages.addMessages(ex);} } else{ ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please enter a DUNS Number with at least 4 characters and less then 10.'); ApexPages.addMessage(myMsg); } return listAccounts ; } public String getsearchDunsNumber() { return removedashes(searchDunsNumber); } public void setsearchDunsNumber(String searchDunsNumber){ this.searchDunsNumber = removedashes(searchDunsNumber.trim()); } }

 

 

 

 

 

  • February 02, 2010
  • Like
  • 0

I have a VF page that allows a team member to do a search.  The page has an error message tag that shows any errors that we validate for when the user clicks on the Search button.

 

What I want to do is if the user clicks the button I want to clear any messages that may currently being displayed and no longer relavante.

 

How can I do that?  Any help is aprriciated.

 

Here is the VF Page:

 

 

<apex:page Controller="AllAccountSearchController" tabstyle="Account" sidebar="false"> <!-- Used to include sorttable static resource for applying client sorting functionality --> <script type="text/javascript" src="{!URLFOR($Resource.sorttable, 'sorttable.js')}"/> <!-- Filter criteria --> <apex:form id="Filter"> <apex:pageBlock title="Filter"> <apex:pageMessages ></apex:pageMessages> <apex:pageBlockSection title="Criteria" columns="6" collapsible="false"> <apex:panelGrid columns="6" id="theGrid"> <apex:outputLabel style="font-weight:bold;" value="Duns Number" for="DunsNumber"/> <apex:inputText id="searchDunsNumber" value="{!searchDunsNumber}" size="10"/> <apex:outputLabel style="font-weight:bold;" value="" for=""/> <apex:outputLabel style="font-weight:bold;" value="" for=""/> <apex:commandButton action="{!search}" value="Search" id="searchBtn"/> </apex:panelGrid> </apex:pageBlockSection> </apex:pageBlock> </apex:form> <!-- Displays the Search Results section --> <apex:pageBlock title="Account(s)" > <apex:pageBlockSection title="Search Results" columns="1" collapsible="false"> <apex:dataTable value="{!AllAccounts}" var="each" cellpadding="10" border="0" width="100%" columnsWidth="1000,200,200,200,200,200,200,200" style="vertical-align:top;word-wrap: break-word;" styleClass="sortable list"> <apex:column headerValue="Account Name"><a href="/{!each.Id}">{!each.Name}</a>&nbsp;</apex:column> <apex:column headerValue="Account Duns">{!each.Site}&nbsp;</apex:column> <apex:column headerValue="Address">{!each.BillingStreet}&nbsp;</apex:column> <apex:column headerValue="City">{!each.BillingCity}&nbsp;</apex:column> <apex:column headerValue="State">{!each.BillingState}&nbsp;</apex:column> <apex:column headerValue="Zip">{!each.BillingPostalCode}&nbsp;</apex:column> <apex:column headerValue="Account Owner">{!each.Owner.Name}&nbsp;</apex:column> <apex:column headerValue="Owner email">{!each.Owner.email}&nbsp;</apex:column> <apex:column headerValue="Created Date">{!each.createddate}&nbsp;</apex:column> <apex:column headerValue="Modified Date">{!each.LastModifiedDate}&nbsp;</apex:column> </apex:dataTable> </apex:pageBlockSection> </apex:PageBlock> </apex:page>

 

Here is the Controller:

 

 

public class AllAccountSearchController { private Boolean searched = False; private String searchDunsNumber = removedashes(ApexPages.currentPage().getParameters().get('duns')); String strQuery = 'Select id, name, site, BillingStreet, BillingCity, BillingState, BillingPostalCode, createddate, LastModifiedDate, Owner.Name, Owner.email from Account where site like ' +'\'%'+searchDunsNumber +'%\'' + 'order by Name asc'; public string removedashes(string str){ return str.replaceall( '-', '' ); } public void search() { searchDunsNumber = removedashes(searchDunsNumber); if (this.searchDunsNumber.length() > 3 && this.searchDunsNumber.length() < 10){ //this.searched = True; strQuery = 'Select id, name, site, BillingStreet, BillingCity, BillingState, BillingPostalCode, createddate, LastModifiedDate, Owner.Name, Owner.email from Account where site like ' +'\'%'+searchDunsNumber +'%\'' + 'order by Name asc'; } else{ ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please enter a DUNS Number with at least 4 characters and less then 10.'); ApexPages.addMessage(myMsg); } } public List<Account> getAllAccounts(){ List<Account> listAccounts = new List<Account>(); //listAccounts = [Select id, name, site, BillingStreet, BillingCity, BillingState, BillingPostalCode, createddate, LastModifiedDate, Owner.Name, Owner.email from Account where site like'%123456789%' order by Name desc]; //if (searched) listAccounts = Database.query(strQuery ); if (this.searchDunsNumber.length() > 3 && this.searchDunsNumber.length() < 10){ listAccounts = Database.query(strQuery ); } else{ ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please enter a DUNS Number with at least 4 characters and less then 10.'); ApexPages.addMessage(myMsg); } return listAccounts ; } public String getsearchDunsNumber() { return removedashes(searchDunsNumber); } public void setsearchDunsNumber(String searchDunsNumber){ this.searchDunsNumber = removedashes(searchDunsNumber.trim()); } }

 

 

 

 

 

  • February 01, 2010
  • Like
  • 0

We are using the private sharing model.  I have a need for my users to be able to query all accounts and see if an account already exists before they create a new one.  Since we have a Private sharing model a general query will onlt return accounts that they have visibility to.

 

My thought is to create a VF page that will search all the accounst and display the matches.  In order to do that I will need to execite the querry with a sysadmin access.  

 

Can this be done?  Can a users submit a query with sysadmin rights so they have visibility to all accounts.

 

Thanks

  • January 26, 2010
  • Like
  • 0

I have a visual force page that was created in Summer 10 in my FCS to update cases.

 

The page allowed the user to change the case status and also create an entry into a customer object and create a case comment all from the same page.

 

It was working perfect in until today.  the only change was my Sandbox was updated to Spring 10.

 

Now whenever I try to update the case from the Visual Force Page I get the following error:

 

System.DmlException: Update failed. First exception on row 0 with id 50030000005o8ETAAY; first error: FIELD_INTEGRITY_EXCEPTION, No selected contact: [ContactId]

 

If I edit the case from GUI I do not get the error.  If I select a contact (Which is not a required field) and then execute the visual force page ot works fine.

 

What has chnaged in Spring 10 that is causing this to happen.

 

Any help is apprciated.

 

 

Here is the page:

 

 

<apex:page Controller="newEnhancemnetController" tabStyle="Case" id="thePage"> <script> function confirmCancel() { var isCancel = confirm("Are you sure you wish to cancel?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="New Enhancemnet Approval" subtitle="for change board Case"/> <apex:form > <apex:pageBlock mode="edit"> <apex:pageMessages ></apex:pageMessages> <apex:pageBlockButtons > <apex:commandButton action="{!Save}" value="Save"/> <apex:commandButton action="{!Cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Change Current Case Status" columns="1"> <apex:outputField value="{!Case.id}"/> <apex:outputField value="{!Case.subject}"/> <apex:outputField value="{!Case.description}"/> <apex:pageBlockSectionItem > <apex:outputLabel value="{!$ObjectType.Case.fields.Status.label}" for="casestatus" style="font-weight:bold"/> <apex:outputPanel styleClass="requiredInput" layout="block"> <apex:outputPanel styleClass="requiredBlock" layout="block"/> <apex:selectList value="{!casestatus}" id="casestatus" size="1" title="Status" required="true"> <apex:selectOptions value="{!items}"/> </apex:selectList> </apex:outputPanel> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Add Enhancement Approval Information" columns="2"> <apex:inputField id="eaAprovedFor" value="{!EnhancementApproval.Approved_For__c}" required="true"/> <apex:inputField id="eaEnvironment" value="{!EnhancementApproval.Environment__c}" required="true"/> <apex:inputField id="eaValidFrom" value="{!EnhancementApproval.Valid_From__c}" required="true"/> <apex:inputField id="eaOtherQCS" value="{!EnhancementApproval.Other_QCS__c}" required="False"/> <apex:inputField id="eaValidTo" value="{!EnhancementApproval.Valid_To__c}" required="true"/> </apex:pageBlockSection> <apex:pageBlockSection title="Add a Case Comment"> <apex:inputField id="caseComment" value="{!CaseComment.CommentBody}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

 Here is the controller:

 

 

public class newEnhancemnetController { String casestatus; Case oCase; Enhancement_Approval__c oEnahncemnetApproval; Contact contact; CaseComment casecomment; Map<String,String> mCaseStatus = new Map<String,String>(); public Case getCase() { oCase = [select id, subject, status, description from Case where id = :ApexPages.currentPage().getParameters().get('id')]; if(oCase== null) oCase= new Case(); return oCase; } public Contact getContact() { if(contact== null) contact= new Contact(); return contact; } public String getCaseStatus() { if(casestatus==null){casestatus=oCase.Status;} return casestatus ; } public void setCaseStatus(String casestatus ) { this.casestatus = casestatus ; } public List<SelectOption> getItems() { mCaseStatus.Put('New','New'); mCaseStatus.Put('Approved for Analysis & Design','Approved for Analysis & Design'); mCaseStatus.Put('Reqmts/A&D In Progress','Reqmts/A&D In Progress'); mCaseStatus.Put('Reqmts/A&D Completed','Reqmts/A&D Completed'); mCaseStatus.Put('Approved for Sandbox Build/Config/Test','Approved for Sandbox Build/Config/Test'); mCaseStatus.Put('Sandbox Build In Progress','Sandbox Build In Progress'); mCaseStatus.Put('Sandbox Testing Failed','Sandbox Testing Failed'); mCaseStatus.Put('Sandbox Testing Passed','Sandbox Testing Passed'); mCaseStatus.Put('Waiting for Production Release Date','Waiting for Production Release Date'); mCaseStatus.Put('Release Date Assigned/Approved for Prod','Release Date Assigned/Approved for Prod'); mCaseStatus.Put('Production Testing Failed','Production Testing Failed'); mCaseStatus.Put('Production Testing Passed','Production Testing Passed'); mCaseStatus.Put('On Hold / No Activity','On Hold / No Activity'); mCaseStatus.Put('On Hold / Lack of Funding','On Hold / Lack of Funding'); //mCaseStatus.Put('',''); List<SelectOption> options = new List<SelectOption>(); Schema.DescribeFieldResult fieldResult = Schema.sObjectType.Case.Fields.Status; fieldResult = fieldResult.getSObjectField().getDescribe(); List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues(); for( Schema.PicklistEntry f : ple) { if (mCaseStatus.containskey(f.getValue())) options.add(new SelectOption(f.getLabel(), f.getValue())); //options.add(new SelectOption(f.getLabel(), f.getValue())); } return options; } //public List<SelectOption> getItems() { // List<SelectOption> options = new List<SelectOption>(); // for (CaseStatus cs : [Select MasterLabel from CaseStatus order by sortorder]){ // options.add(new SelectOption(cs.MasterLabel,cs.MasterLabel)); // } // return options; //} public CaseComment getCaseComment () { if(casecomment== null) casecomment= new CaseComment(); return casecomment; } public Enhancement_Approval__c getEnhancementApproval() { if(oEnahncemnetApproval== null) oEnahncemnetApproval= new Enhancement_Approval__c(); return oEnahncemnetApproval; } public PageReference cancel() { PageReference casePage = new ApexPages.StandardController(oCase).view(); casePage .setRedirect(true); return casePage ; } public PageReference Save() { if (oEnahncemnetApproval.Environment__c == 'QCS - Other' && oEnahncemnetApproval.Other_QCS__c ==Null ){ ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Other QCS is Required when Environment is equal to "QCS - Other"'); ApexPages.addMessage(myMsg); return null; } oCase.Status=this.casestatus; update oCase; Enhancement_Approval__c oEA; oEA = new Enhancement_Approval__c(); oEA.Approved_For__c = oEnahncemnetApproval.Approved_For__c; oEA.Case__c = ApexPages.currentPage().getParameters().get('id'); oEA.Environment__c = oEnahncemnetApproval.Environment__c; oEA.Valid_From__c = oEnahncemnetApproval.Valid_From__c; oEA.Valid_To__c = oEnahncemnetApproval.Valid_To__c; oEA.Other_QCS__c = oEnahncemnetApproval.Other_QCS__c; insert oEA; if (casecomment.CommentBody != null){ casecomment.ParentId = ApexPages.currentPage().getParameters().get('id'); insert casecomment; } PageReference casePage = new ApexPages.StandardController(oCase).view(); casePage.setRedirect(true); return casePage ; } //*************************************************************************** //** Test Method //** //*************************************************************************** public static testMethod void testChangeBoardApproval() { pageReference p = Page.ChangeBoardApproval; p.getParameters().put('id', [select id from Case limit 1].id); test.setCurrentPage(p); newEnhancemnetController enhancmenetController = new newEnhancemnetController(); //enhancemnetController.cancel(); enhancmenetController.getCase(); enhancmenetController.getitems(); enhancmenetController.getcasestatus(); enhancmenetController.getEnhancementApproval(); enhancmenetController.getContact(); enhancmenetController.getCaseComment(); enhancmenetController.save(); } }

 

 

 

 

 

  • January 25, 2010
  • Like
  • 0

I am trying to find out how I can get the list of available CaseStatus values for a specific Support Process assigned to a case record type.

 

As you know there are many values for the case status and depending on the support process and record type you can control what valid choices are for.

 

I need to find out where that data is stored so I can execute a SOQL queery to retrive that data.

 

Thanks in advance.

 

 

  • December 09, 2009
  • Like
  • 0

I created a Visual Force page to allow the user to modify the status of a Cases at the same time as creating a case note and adding an Enahncement Aproval to the case.  The enhancemnet approval is a custom object.

 

I have evrything working just fine with one small quirk.  On Cases you can have a huge list of status with a diffrent pick list for each record type. 

 

 When you go to the Visual Force page and select the Status dropdown it shows ALL the status values.  I want that limited to only the values for the Enhancemnt record type.

 

Can this be done?

 

Here is the VF Page:

 

 

<apex:page Controller="newEnhancemnetController" tabStyle="Case" id="thePage"> <script> function confirmCancel() { var isCancel = confirm("Are you sure you wish to cancel?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="New Enhancemnet Approval" subtitle="for change board Case"/> <apex:form > <apex:pageBlock mode="edit"> <apex:pageMessages ></apex:pageMessages> <apex:pageBlockButtons > <apex:commandButton action="{!Save}" value="Save"/> <apex:commandButton action="{!Cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Change Current Case Status" columns="1"> <apex:inputField value="{!Case.id}"/> <apex:outputField value="{!Case.subject}"/> <apex:inputField value="{!Case.status}" required="true"/> <apex:inputField value="{!Case.description}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Add Enhancement Approval Information" columns="1"> <apex:inputField id="eaAprovedFor" value="{!EnhancementApproval.Approved_For__c}" required="true"/> <apex:inputField id="eaEnvironment" value="{!EnhancementApproval.Environment__c}" required="true"/> <apex:inputField id="eaValidFrom" value="{!EnhancementApproval.Valid_From__c}" required="true"/> <apex:inputField id="eaValidTo" value="{!EnhancementApproval.Valid_To__c}" required="true"/> </apex:pageBlockSection> <apex:pageBlockSection title="Add a Case Comment"> <apex:inputField id="caseComment" value="{!CaseComment.CommentBody}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

 Here is the controller:

 

 

public class newEnhancemnetController { Case oCase; Enhancement_Approval__c oEnahncemnetApproval; Contact contact; CaseComment casecomment; public Case getCase() { oCase = [select id, subject, status, description from Case where id = :ApexPages.currentPage().getParameters().get('id')]; if(oCase== null) oCase= new Case(); return oCase; } public Contact getContact() { if(contact== null) contact= new Contact(); return contact; } public CaseComment getCaseComment () { if(casecomment== null) casecomment= new CaseComment(); return casecomment; } public Enhancement_Approval__c getEnhancementApproval() { if(oEnahncemnetApproval== null) oEnahncemnetApproval= new Enhancement_Approval__c(); return oEnahncemnetApproval; } public PageReference cancel() { PageReference casePage = new ApexPages.StandardController(oCase).view(); casePage .setRedirect(true); return casePage ; } public PageReference Save() { //oEnahncemnetApproval.Case__c = oCase.id; //insert oEnahncemnetApproval; update oCase; //contact.accountid = '001Q0000005ktVx'; //insert contact; Enhancement_Approval__c oEA; oEA = new Enhancement_Approval__c(); oEA.Approved_For__c = oEnahncemnetApproval.Approved_For__c; oEA.Case__c = ApexPages.currentPage().getParameters().get('id'); oEA.Environment__c = oEnahncemnetApproval.Environment__c; oEA.Valid_From__c = oEnahncemnetApproval.Valid_From__c; oEA.Valid_To__c = oEnahncemnetApproval.Valid_To__c; insert oEA; if (casecomment.CommentBody != null){ casecomment.ParentId = ApexPages.currentPage().getParameters().get('id'); insert casecomment; } PageReference casePage = new ApexPages.StandardController(oCase).view(); casePage .setRedirect(true); return casePage ; } //*************************************************************************** //** Test Method //** //*************************************************************************** public static testMethod void testChangeBoardApproval() { pageReference p = Page.ChangeBoardApproval; p.getParameters().put('id', [select id from Case limit 1].id); test.setCurrentPage(p); newEnhancemnetController enhancemnetController = new newEnhancemnetController(); //enhancemnetController.cancel(); enhancemnetController.getCase(); enhancemnetController.getEnhancementApproval(); enhancemnetController.getContact(); enhancemnetController.getCaseComment(); enhancemnetController.save(); } }

 

 

 

 

  • December 08, 2009
  • Like
  • 0

I am currently running version 3.3.2 of Eclipse with the Force.com IDE version 16.0.0.200906151227.

 

Is that the most current version?  If not where can I find the most current version.

 

Thanks

  • November 17, 2009
  • Like
  • 0

I have a custom object "Quote" that is related to an opportunity.  Original we had setup the visibility to the Quote object as Private.  This was problematic as we had support team members that needed to view the quote.

 

We have changed that to Public and now all the users can see the Quote.  That has solved the initial problem but raise a new one.  All team members can now edit the quote.  We want to restrict the editing of the Quote to the Owner and the users that are team members of the related opportunity.

 

I could not find a validation rule to do this.  I know I can do this with a apex trigger.

 

The way I would like to implement this is to not even let the user get to the edit detail page.  I would like the user to get an error when they click on the edit button.  With the trigger I would have to wait till the user completes the edit and hits save.

 

Any thoughts on overriding the button?

 

Thanks

 

 

  • July 21, 2009
  • Like
  • 0

I have a multi-select pick list that tracks when a customer has responded to a survey.  The values available to be selected are:

 

2008 Mid Year

2008 Full Year

2009 Mid Year

2009 Full Year

 

Currently a customer has the 2008 Full Year selected.

 

The customer just tok the 2009 Mid Year.

 

When I use the data loader to update the field I load the following CSV file

 

ID, Survey

"001xxxxxxxxxxxx","2009 Mid Year"

 

When I run the dataloader it does the updae but i do not get the expected result.

 

What happens is that the Survey field now has "2009 Mid Year".

 

I want the field to read "2008 Full Year; 2009 Mid Year"

 

Can this be done with our having to setup the CSV as follows:

ID, Survey

"001xxxxxxxxxxxx","2008 Full Year;2009 Mid Year"

 

 

Thanks in advance.

 

  • July 07, 2009
  • Like
  • 0
I have created a custome VF page to display a summary of cases for a specific account.
 
I have a custom controller and evrything is wroking just fine except I can not find a way to get the Case Owner name.
 
Since cases can be owned by either a Queu or a user how do I return the name to display that in my VF page.
 
The page and controller are below for refrence.
 
How do I get the Owner Name?
 
Here is the VF Page:
 
Code:
<apex:page Controller="CaseController" tabstyle="Account">
    
    <apex:pageBlock title="Account">
    <apex:pageBlockSection title="Account Detail" columns="2" collapsible="true">
        <apex:outputField value="{!Account.Name}" id="AccountName"></apex:OutputField>
        <apex:pageBlockSectionItem>
            <apex:outputLabel value="Account Owner" for="AccountOwner"></apex:outputLabel>
            <apex:outputField value="{!Account.Owner.name}" id="AccountOwner"></apex:OutputField>
        </apex:pageBlockSectionItem>
        <apex:outputField value="{!Account.Site}"></apex:OutputField><apex:outputText></apex:outputText>
        <apex:outputField value="{!Account.BillingStreet}"></apex:OutputField><apex:outputText></apex:outputText>
        <apex:outputField value="{!Account.BillingCity}"></apex:OutputField><apex:outputText></apex:outputText>
        <apex:outputField value="{!Account.BillingState}"></apex:OutputField><apex:outputText></apex:outputText>
        <apex:outputField value="{!Account.BillingPostalCode}"></apex:OutputField><apex:outputText></apex:outputText>
    </apex:pageBlockSection>
    </apex:pageBlock>
        
    <apex:pageBlock title="Summary of cases">
    <table class="list" border="0" cellspacing="0" cellpadding="0">
    <tr class="headerRow"><th scope="col" class=""></th><th scope="col" class="">Total Number<br>Cases</br></th><th scope="col" class="">Cases<br></br>Open to date</th><th scope="col" class="">Cases<br></br>This Week</th><th scope="col" class="">Last Case Opened<br></br>Request #</th><th scope="col" class=""><br></br>Date Opened</th><th scope="col" class=""><br></br>Description</th></tr>
    <tr><td scope="col">Service</td><td scope="col" class="">{!ServiceCount}</td><td scope="col" class="">{!ServiceCountOpen}</td><td scope="col" class="">{!ServiceCountOpenThisWeek}</td><td scope="col" class=""><a href="/{!LastOpenServiceCase.Id}">{!LastOpenServiceCase.CaseNumber}</a></td><td scope="col" class="">{!LastOpenServiceCase.CreatedDate}</td><td scope="col" class="">{!LastOpenServiceCase.subject}</td></tr>
    <tr><td scope="col">Project</td><td scope="col" class="">{!ProjectCount}</td><td scope="col" class="">{!ProjectCountOpen}</td><td scope="col" class="">{!ProjectCountOpenThisWeek}</td><td scope="col" class=""><a href="/{!LastOpenProjectCase.Id}">{!LastOpenProjectCase.CaseNumber}</a></td><td scope="col" class="">{!LastOpenProjectCase.CreatedDate}</td><td scope="col" class="">{!LastOpenProjectCase.subject}</td></tr>
    </table>
    </apex:pageBlock>


    <apex:pageBlock title="Service / Project Cases" >
    <apex:pageBlockSection title="Open Service Requests" columns="1" collapsible="true">
    <apex:dataTable value="{!ServiceCases}" var="each" cellpadding="10" border="0" styleClass="list">
        <apex:column headerValue="Action"><a href="/{!each.Id}/e—retURL=/apex/CaseSummaryView–Id={!account.Id}"><b>Edit</b></a><b>&nbsp;|&nbsp;</b><a href="/{!each.Id}/s˜retURL=/apex/CaseSummaryView™Id={!account.Id}"><b>Cls</b></a> </apex:column>
        <apex:column headerValue="Case"><a href="/{!each.Id}">{!each.CaseNumber}</a></apex:column>  
        <apex:column headerValue="Contact Name">{!each.Contact.Name}</apex:column>  
        <apex:column headerValue="Subject">{!each.subject}</apex:column>  
        <apex:column headerValue="Priority">{!each.Priority}</apex:column>
        <apex:column headerValue="Status">{!each.Status}</apex:column>
        <apex:column headerValue="OwnerId">{!each.OwnerId}</apex:column>
    </apex:dataTable>
    </apex:pageBlockSection>

    <apex:pageBlockSection title="Open Timekeeper Projects" columns="1" collapsible="true">
    <apex:dataTable value="{!ProjectCases}" var="each" cellpadding="10" border="0" styleClass="list">
        <apex:column headerValue="Action"><a href="/{!each.Id}/e?retURL=/apex/CaseSummaryView?Id={!account.Id}"><b>Edit</b></a><b>&nbsp;|&nbsp;</b><a href="/{!each.Id}/s?retURL=/apex/CaseSummaryView?Id={!account.Id}"><b>Cls</b></a> </apex:column>
        <apex:column headerValue="Case"><a href="/{!each.Id}">{!each.CaseNumber}</a></apex:column>  
        <apex:column headerValue="Contact Name">{!each.Contact.Name}</apex:column>  
        <apex:column headerValue="Subject">{!each.subject}</apex:column>  
        <apex:column headerValue="Priority">{!each.Priority}</apex:column>
        <apex:column headerValue="Status">{!each.Status}</apex:column>
        <apex:column headerValue="OwnerId">{!each.OwnerId}</apex:column>
    </apex:dataTable>
    </apex:pageBlockSection>
    </apex:pageBlock>
    
    <apex:pageBlock title="Customer Service Center Cases" >
        <apex:pageBlockSection title="Service Cases" columns="1" collapsible="true">
        </apex:pageBlockSection>

        <apex:pageBlockSection title="Adjustment Cases" columns="1" collapsible="true">
        </apex:pageBlockSection>
        
        <apex:pageBlockSection title="Trouble Tickets" columns="1" collapsible="true">
        </apex:pageBlockSection>
        
        <apex:pageBlockSection title="Orders" columns="1" collapsible="true">
        </apex:pageBlockSection>

    </apex:pageBlock>

</apex:page>

 
Here is the Controller:
Code:
public class CaseController{
//** Service Request Functions
        Public Integer getServiceCount(){
                return [Select Count() from Case where AccountId= :System.currentPageReference().getParameters().get('id')and RecordType.Name = 'Service Request'];
        }
        Public Integer getServiceCountOpen(){
                return [Select Count() from Case where AccountId= :System.currentPageReference().getParameters().get('id') and isClosed = false and RecordType.Name = 'Service Request' ];

        }
        Public Integer getServiceCountOpenThisWeek(){
                return [Select Count() from Case where AccountId= :System.currentPageReference().getParameters().get('id') and isClosed = false and CreatedDate = THIS_WEEK and RecordType.Name = 'Service Request'];

        }
        Public Case getLastOpenServiceCase(){
                return [Select Id, CaseNumber, Subject, CreatedDate from Case where AccountId= :System.currentPageReference().getParameters().get('id') and isClosed = false and RecordType.Name = 'Service Request' Order By CreatedDate desc limit 1];
        }

        Public Case[] getServiceCases(){
                return [Select id, CaseNumber, ContactId, Contact.Name, OwnerId, Priority, Status, Subject from Case where accountid = :System.currentPageReference().getParameters().get('id') and isclosed = false and RecordType.Name = 'Service Request'];
        }

//** TimeKeeper Project Functions
        Public Integer getProjectCount(){
                return [Select Count() from Case where AccountId= :System.currentPageReference().getParameters().get('id')and RecordType.Name = 'TimeKeeper Project'];
        }
        Public Integer getProjectCountOpen(){
                return [Select Count() from Case where AccountId= :System.currentPageReference().getParameters().get('id') and isClosed = false and RecordType.Name = 'Timekeeper Project' ];

        }
        Public Integer getProjectCountOpenThisWeek(){
                return [Select Count() from Case where AccountId= :System.currentPageReference().getParameters().get('id') and isClosed = false and CreatedDate = THIS_WEEK and RecordType.Name = 'Timekeeper Project'];

        }
        Public Case getLastOpenProjectCase(){
                return [Select Id, CaseNumber, Subject, CreatedDate from Case where AccountId= :System.currentPageReference().getParameters().get('id') and isClosed = false and RecordType.Name = 'Timekeeper Project' Order By CreatedDate desc limit 1];
        }

        Public Case[] getProjectCases(){
                return [Select id, CaseNumber, ContactId, Contact.Name, OwnerId, Priority, Status, Subject from Case where accountid = :System.currentPageReference().getParameters().get('id') and isClosed = false and RecordType.Name = 'Timekeeper Project'];
        }
        
//** Other functions
        Public Account getAccount(){
                //return [Select id, name from Account where id = :System.currentPageReference().getParameters().get('id')];
                return [Select id, name, Owner.Name, Site, BillingStreet, BillingCity, BillingState, BillingPostalCode
                        from Account where id = :System.currentPageReference().getParameters().get('id')];

        }
        
        Public Case[] getAccountCases(){
                return [Select id, CaseNumber, ContactId, Contact.Name, OwnerId, Priority, Status, Subject from Case where accountid = :System.currentPageReference().getParameters().get('id')];
        }

}

 
  • October 28, 2008
  • Like
  • 0
I have the following visual force page:
 
Code:
    <apex:pageBlock title="Account">
    <apex:pageBlockSection title="Account Detail" columns="2" collapsible="true">
        <apex:outputField value="{!Account.Name}" id="AccountName"></apex:OutputField><apex:outputField value="{!Account.Owner.name}"></apex:OutputField>
        <apex:outputField value="{!Account.Site}"></apex:OutputField><apex:outputText></apex:outputText>
        <apex:outputField value="{!Account.BillingStreet}"></apex:OutputField><apex:outputText></apex:outputText>
        <apex:outputField value="{!Account.BillingCity}"></apex:OutputField><apex:outputText></apex:outputText>
        <apex:outputField value="{!Account.BillingState}"></apex:OutputField><apex:outputText></apex:outputText>
        <apex:outputField value="{!Account.BillingPostalCode}"></apex:OutputField><apex:outputText></apex:outputText>
    </apex:pageBlockSection>
    </apex:pageBlock>

 
It outputs the field label for the specific object.  When it outputs the Account Owner it displays the Label as "Name" when I want the label to read "Account Owner".  I have tried to use the Title option and can noit get that to work.  I also tried to use the outPutLabel and that does not seem to work either.
 
So how do I change the default label on this page.
 
Thanks
 
 
  • October 28, 2008
  • Like
  • 0
Is there any way in APEX to tell where the user is createing an Opportunity from.  I need to build a process that will create an activty to notify the User that they did not create the Opportunity from the Contact Tab.

We want to instill best practices by having the user create new opportuities from the contact tab so that the contact role will be automaticly populated for the user.

When you click new on the contact page the url has a contactid parameter that gets passed to the new page and SFDC knows to create the role but I need to know if in a Trigger I can read that URL or not.

Thanks in advance.

Mike
  • August 13, 2008
  • Like
  • 0
When a user creates an opportunity from a contact SFDC relates the Opportunity to the Account and creates a Contact Role.

Is there any way that I can flag a field onthe Opportunity record so I know that the user created the opportunity from the contact.

When the URL is generated the connid is set to the contact id that the users started from.  Is there a way that I can read the URL and predefault a check box to true so I can identify the opportunities that were created directly from the contact.

We are trying to force this behavior to our sales team and we want to see how many team members are creating the opportunity from the contact.

Any advise would be greatly appricated.

  • July 30, 2008
  • Like
  • 0
I have created a batch process that will export data from the account object using the CLI for the data loader. 

I want the job to extract data that has been modified since the job was last run.

How can I leverage the last run properties file in the pull the date time into the SOQL statement so I do not need to mnually modify the process-conf.xml each time.

Here is a copy of the processfile:


Code:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <bean id="MDRAccountExtractProcess"
          class="com.salesforce.lexiloader.process.ProcessRunner"
          singleton="false">
      <description>MDRAccountExtract job gets account info from salesforce and saves info into a CSV file."</description>
        <property name="name" value="MDRAccountExtract"/>
        <property name="configOverrideMap">
            <map>
                <entry key="sfdc.debugMessages" value="False"/>
                <entry key="sfdc.debugMessagesFile" value="D:\SFDC\DataLoader\conf\MVJTrace.log"/>
                <entry key="sfdc.endpoint" value="https://test.salesforce.com"/>
                <entry key="sfdc.username" value="xxxxxxxxxxx"/>
                <entry key="sfdc.password" value="xxxxxxxxxxx"/>
                <entry key="sfdc.timeoutSecs" value="600"/>
                <entry key="sfdc.loadBatchSize" value="200"/>
                <entry key="sfdc.entity" value="Account"/>
                <entry key="sfdc.extractionRequestSize" value="500"/>
                <entry key="sfdc.extractionSOQL" 
    value="
    Select Id,MDR_Account_Size__c,AnnualRevenue,MDR_Contract_Data_Lease__c,BillingCity,BillingCountry,BillingPostalCode,BillingState,BillingStreet,MDR_Bubble_Up__c,
    MDR_Bubble_Up_Expiration__c,MDR_Bubble_Up_Original_Account_Owner__c,MDR_Bubble_Up_Start__c,MDR_CDL_Contract_End_Date__c,CreatedDate,Description,Fax,Industry,
    LastModifiedById,LastModifiedDate,MDR_Account_Status__c,MDR_Customer_No__c,MDR_Territory_Code__c,Name,OwnerId,Phone,ShippingCity,ShippingCountry,
    ShippingPostalCode,ShippingState,ShippingStreet,Type,Website,MDR_Market__c,
    Competitive_Account__c from Account where LastModifiedDate > 2008-05-01T10:12:25Z and 
    Owner.Employee_Type__c like 'MDR%'
    "/>
            <entry key="sfdc.proxyHost" value="bastion2.us.dnb.com"/>
      <entry key="sfdc.proxyPort" value="8080"/>
                <entry key="process.operation" value="extract"/>
                <entry key="process.mappingFile" value="D:\SFDC\DataLoader\conf\MDRaccountExtractMap.sdl"/>
                <entry key="process.encryptionKeyFile" value="D:\SFDC\DataLoader\conf\MVJ.key"/>
      <entry key="process.enableExtractSuccessOutput" value="True"/>
           <entry key="process.outputSuccess" value="D:\sfdc\DataLoader\conf\MDRAccountExtractSuccessFile.csv"/>
                <entry key="dataAccess.type" value="csvWrite"/>
                <entry key="dataAccess.name" value="D:\SFDC\DataLoader\conf\MDRextract.csv"/>
            </map>
        </property>
    </bean>
</beans>

 

Thanks in advance

Mike
  • July 08, 2008
  • Like
  • 0
I have created a custom object that hangs off of the case object.

When the user creates a new record on the custom reltaed list and hits save it leaves them on the newly created record
nsted of redirecting them back to the case.

The user can always click the link to the case but that is an extra step and not the same functionality that exists with other
related lists.

I would like this to work the same as creating a new task for the case.  Afetr you save the new task it takes you back to the
case instead of leaving you on the newly created task.

Any ideas on how I can do this?
  • June 12, 2008
  • Like
  • 0

I have this trigger on accounts wich is based on a custom look up field (users) Gestor_a__c

 

If Gestor_a__c has any open task related to an account,  when I change the acount Gestor the ownership of the open task related to him/her also change to the new Gestor.

 

It is working fine, but it also changes completed tasks??

 

what I am mising?

 

 

trigger reAssignTask on Account (after update) 
{
    Set<Id> accId = new Set<Id>();
    MAP<Id , ID> accId_NewMangID  = new MAP<Id , ID>();
    Set<Id> oldManagerId = new Set<Id>();
    for(Account a : trigger.new)
    {
        if(a.Gestor_a__c != trigger.oldMap.get(a.id).Gestor_a__c)
        {
            accId.add(a.id);
            oldManagerId.add(trigger.oldMap.get(a.id).Gestor_a__c);  
            accId_NewMangID.put(a.id , a.Gestor_a__c);
        }
    }
    
    List<Task> listTask = [Select id , OwnerID , whatID From Task where whatID in: accId and OwnerId in: oldManagerId];
    
    for(Task t : listTask)
    {
        t.OwnerID = accId_NewMangID.get(t.whatID);
    }
    update listTask;
}

 

 

I want to be able to send an email from cases where the "Additional To" field is automatically populated with a custom email address we have on cases (as we do not use contacts).

 

I have been looking around for some code to do this and I have found some but I cannot get it to work for me. Can anyone see where I am going wrong? Or are you aware of another solution for this issue. The code I have been trying is:

 

Public class SendEmail
{
    public String subject {get; set;}
    public String body {get; set;}
 
    private Case cas;
   
    // Constructor to populate instance of your object
    public SendEmail(ApexPages.StandardController controller) {
    this.cas= (Case )controller.getRecord();
    cas= [SELECT cas fields required
             FROM Case
             WHERE id = :ApexPages.CurrentPage().getParameters().get('id')​];
    }
             
    public Case getCase(){
    return cas;
    }
   
   
    public pageReference send(){
    Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();  
     
    email.setSubject(subject);
    email.setToAddresses(Customer_Email_Address__c);//Use SOQL to retrieve addresses in the address
    email.setPlainTextBody(body);
    email.setBccSender(true);
   
    Messaging.SendEmailResult [] r = Messaging.SendEmail(new Messaging.SingleEmailMessage[] {email});     
    for ( Messaging.sendEmailResult result : r ) {

           if ( !r[0].isSuccess () ) {
              
               System.debug ( result  );
           }

           else{

               ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'Email Sent Successfully' );
               ApexPages.addMessage(msg);
           }
       }
    return null;  
}
}

VF Page

 

<apex:page StandardController="Case" extensions="SendEmail">
<apex:pageblock title="">
<apex:pageMessages ></apex:pageMessages>
<apex:form >

<apex:outputLabel value="Subject" for="Subject"/>:<br/>
<apex:inputText value="{!subject}" id="Subject" maxlength="80"/>
<br/><br/>
<apex:outputLabel value="Body" for="Body"/>:<br/>
<apex:inputTextarea value="{!body}" id="Body" rows="10" cols="80"/>
<br/><br/><br/>
<apex:commandButton value="Send Email" action="{!send}"/>
</apex:form>
</apex:pageblock>
</apex:page>



 

I also tried a URL hack but could not get it to work because I am not a developer and not fully sure of what is needed.

 

Any help would be greatly appreciated.

 

Regards,

 

Clubli

Hi,

Please help in finding out the difference between two date and time fields.

Scenario:

 

I have to send an email notification if the case created date is greater than 4 hours.

So I written the rule criteria as NOW() - Date_Time_Opened>4.

But the workflow fails(it is not sending any email notification).

I also tried with Case escalation rule.,it is also not working.

 

Please help a better approach.

 

Thanks,

 

 

  • September 23, 2010
  • Like
  • 0

Please suggest me how I should Implement this request

Change owner of lead to a specified queue if no activity on the lead in the last 10 days.

Hi ,

I am having an issue , there is a an opportunity trigger with event before insert and before update which will update the values of two field with corresponding two  values from  the owner record. For example if the owner of the opportunity  record is changed those two fields will also get updated with the corresponding values of  two fields from the owner record. This trigger works perfectly when the owner is changed directly from  opportunity record. but the problem is when the owner of the opportunity record getting changed indirectly by selecting options(Transfer closed opportunities ,Transfer open cases owned by the existing account owner ,Transfer closed cases) while changing owner of the master account record in that case  opportunity trigger is not firing at all, due to that fields opportunity records are not getting updated with the owner field values .Can any one help me.

  • September 20, 2010
  • Like
  • 0

HI,

 

I have a SandBox instance that I have created a months ago and now we have a new user created on our production instance who I want to be able to acess the sandbox.

 

For some reason any new user who was created after the sandbox snapshot cannot login to the SandBox.

 

Any ideas why? Do I need to refresh my sandbox and if I do so will my changes (vforce pages, object fields) be overwritten?

 

Thanks in advance.

  • August 02, 2010
  • Like
  • 0

Hey all,

 I have a lookup for contacts in my custom object. I can select the contact name if I click on that lookup. If I want to select mobile number along with the name, what method should I use??

Any help will be greatly appreciated.

 

Thanks.

I'm running an extract via the command line. All runs OK, data extracted OK and no errors, but the success/error files aren't being created. Any ideas?

 

My config is here:

 

<entry key="sfdc.bulkApiSerialMode" value="true"/>
<entry key="sfdc.extractionRequestSize" value="1000"/>

 

<entry key="process.operation" value="extract"/>

<entry key="process.enableExtractSuccessOutput" value="true"/>

<entry key="process.statusOutputDirectory" value="Z:\dataloader"/>

<entry key="process.outputSuccess" value="Z:\dataloader\cb_prods_export_success.csv"/>
<entry key="process.outputError" value="Z:\dataloader\cb_prods_export_error.csv"/>

 

<entry key="process.lastRunOutputDirectory" value="Z:\dataloader\"/>

<entry key="dataAccess.type" value="csvWrite"/>
<entry key="dataAccess.writeUTF8" value="true" />
<entry key="dataAccess.name" value="z:\dataloader\cb_prods.csv"/>

 

<entry key="sfdc.debugMessages" value="true"/>
<entry key="sfdc.debugMessagesFile" value="z:\dataloader\cb_prods_SOAP_debug.log"/>

 

I've tried local and the mapped network drive in the paths above. The lastRun is created OK.

Tried with SOAP debug off too, no change.

 

Any clues would be appreciated, thanks.

I want to put a button on a VF Page that does the following--

 

  1. Runs some Apex code to create a new record via some backend processing.
  2. If successful, just transfer to the new record.
  3. If not successful, then display some error message. 

What I was thinking is that the button would ask for a VF page.  The constructor on the controller would do the work of creating the record.  If an error was detected, then the VF page would display the errors and the only button would be close.  If success, that's where I haven't figured it out yet.  I don't want to display a page here, I just want to go to the record.  I don't know if there's a way to do a redirect within the controller constructor.

 

Any ideas how to design this?

 

I have a VF page that uses a custom controller to query the Account Object.  It uses the Apex:DataTable to display the data returned fromthe controller.  It works perfect when there is 1,000 rows or less since that is the max size of a list.

 

How can I change the code to return more data?  Can the Apex:DataTable go thru a Map?  Can it go thru an object?

 

What changes do I need to make to the code?

 

Thanks in advance.

 

VF Page:

 

 

<apex:page Controller="AllAccountSearchController" tabstyle="Account" sidebar="false"> <!-- Used to include sorttable static resource for applying client sorting functionality --> <script type="text/javascript" src="{!URLFOR($Resource.sorttable, 'sorttable.js')}"/> <!-- Filter criteria --> <apex:form id="Filter"> <apex:pageBlock title="Filter"> <apex:outputPanel id="searchpanel"> <apex:pageMessages ></apex:pageMessages> </apex:outputPanel> <apex:pageBlockSection title="Criteria" columns="6" collapsible="false"> <apex:panelGrid columns="6" id="theGrid"> <apex:outputLabel style="font-weight:bold;" value="Duns Number" for="DunsNumber"/> <apex:inputText id="searchDunsNumber" value="{!searchDunsNumber}" size="10"/> <apex:outputLabel style="font-weight:bold;" value="" for=""/> <apex:outputLabel style="font-weight:bold;" value="" for=""/> <apex:commandButton action="{!search}" value="Search" id="searchBtn"/> </apex:panelGrid> </apex:pageBlockSection> </apex:pageBlock> </apex:form> <!-- Displays the Search Results section --> <apex:pageBlock title="Account(s)" > <apex:pageBlockSection title="Search Results" columns="1" collapsible="false"> <apex:dataTable value="{!AllAccounts}" var="each" cellpadding="10" border="0" width="100%" columnsWidth="1000,200,200,200,200,200,200,200" style="vertical-align:top;word-wrap: break-word;" styleClass="sortable list"> <apex:column headerValue="Account Name"><a href="/{!each.Id}">{!each.Name}</a>&nbsp;</apex:column> <apex:column headerValue="Account Duns">{!each.Site}&nbsp;</apex:column> <apex:column headerValue="Address">{!each.BillingStreet}&nbsp;</apex:column> <apex:column headerValue="City">{!each.BillingCity}&nbsp;</apex:column> <apex:column headerValue="State">{!each.BillingState}&nbsp;</apex:column> <apex:column headerValue="Zip">{!each.BillingPostalCode}&nbsp;</apex:column> <apex:column headerValue="Account Owner">{!each.Owner.Name}&nbsp;</apex:column> <apex:column headerValue="Owner email">{!each.Owner.email}&nbsp;</apex:column> <apex:column headerValue="Created Date">{!each.createddate}&nbsp;</apex:column> <apex:column headerValue="Modified Date">{!each.LastModifiedDate}&nbsp;</apex:column> </apex:dataTable> </apex:pageBlockSection> </apex:PageBlock> </apex:page>

 

Controller:

 

 

public class AllAccountSearchController { private Boolean searched = False; private String searchDunsNumber = removedashes(ApexPages.currentPage().getParameters().get('duns')); String strQuery = 'Select id, name, site, BillingStreet, BillingCity, BillingState, BillingPostalCode, createddate, LastModifiedDate, Owner.Name, Owner.email from Account where site like ' +'\'%'+searchDunsNumber +'%\'' + 'order by Name asc limit 10000'; public string removedashes(string str){ return str.replaceall( '-', '' ); } public PageReference search() { searchDunsNumber = removedashes(searchDunsNumber); if (this.searchDunsNumber.length() > 3 && this.searchDunsNumber.length() < 10){ //this.searched = True; strQuery = 'Select id, name, site, BillingStreet, BillingCity, BillingState, BillingPostalCode, createddate, LastModifiedDate, Owner.Name, Owner.email from Account where site like ' +'\'%'+searchDunsNumber +'%\'' + 'order by Name asc limit 10000'; } else{ ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please enter a DUNS Number with at least 4 characters and less then 10.'); ApexPages.addMessage(myMsg); } PageReference pr = New PageReference('/apex/accountownersearch?DUNS='+removedashes(searchDunsNumber)); pr.setRedirect(true); return pr; } public Account getAllAccounts(){ Account listAccounts = new Account(); //listAccounts = [Select id, name, site, BillingStreet, BillingCity, BillingState, BillingPostalCode, createddate, LastModifiedDate, Owner.Name, Owner.email from Account where site like'%123456789%' order by Name desc]; //if (searched) listAccounts = Database.query(strQuery ); if (this.searchDunsNumber.length() > 3 && this.searchDunsNumber.length() < 10){ try{listAccounts = Database.query(strQuery);} catch(Exception ex){ApexPages.addMessages(ex);} } else{ ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please enter a DUNS Number with at least 4 characters and less then 10.'); ApexPages.addMessage(myMsg); } return listAccounts ; } public String getsearchDunsNumber() { return removedashes(searchDunsNumber); } public void setsearchDunsNumber(String searchDunsNumber){ this.searchDunsNumber = removedashes(searchDunsNumber.trim()); } }

 

 

 

 

 

  • February 02, 2010
  • Like
  • 0

I have a VF page that allows a team member to do a search.  The page has an error message tag that shows any errors that we validate for when the user clicks on the Search button.

 

What I want to do is if the user clicks the button I want to clear any messages that may currently being displayed and no longer relavante.

 

How can I do that?  Any help is aprriciated.

 

Here is the VF Page:

 

 

<apex:page Controller="AllAccountSearchController" tabstyle="Account" sidebar="false"> <!-- Used to include sorttable static resource for applying client sorting functionality --> <script type="text/javascript" src="{!URLFOR($Resource.sorttable, 'sorttable.js')}"/> <!-- Filter criteria --> <apex:form id="Filter"> <apex:pageBlock title="Filter"> <apex:pageMessages ></apex:pageMessages> <apex:pageBlockSection title="Criteria" columns="6" collapsible="false"> <apex:panelGrid columns="6" id="theGrid"> <apex:outputLabel style="font-weight:bold;" value="Duns Number" for="DunsNumber"/> <apex:inputText id="searchDunsNumber" value="{!searchDunsNumber}" size="10"/> <apex:outputLabel style="font-weight:bold;" value="" for=""/> <apex:outputLabel style="font-weight:bold;" value="" for=""/> <apex:commandButton action="{!search}" value="Search" id="searchBtn"/> </apex:panelGrid> </apex:pageBlockSection> </apex:pageBlock> </apex:form> <!-- Displays the Search Results section --> <apex:pageBlock title="Account(s)" > <apex:pageBlockSection title="Search Results" columns="1" collapsible="false"> <apex:dataTable value="{!AllAccounts}" var="each" cellpadding="10" border="0" width="100%" columnsWidth="1000,200,200,200,200,200,200,200" style="vertical-align:top;word-wrap: break-word;" styleClass="sortable list"> <apex:column headerValue="Account Name"><a href="/{!each.Id}">{!each.Name}</a>&nbsp;</apex:column> <apex:column headerValue="Account Duns">{!each.Site}&nbsp;</apex:column> <apex:column headerValue="Address">{!each.BillingStreet}&nbsp;</apex:column> <apex:column headerValue="City">{!each.BillingCity}&nbsp;</apex:column> <apex:column headerValue="State">{!each.BillingState}&nbsp;</apex:column> <apex:column headerValue="Zip">{!each.BillingPostalCode}&nbsp;</apex:column> <apex:column headerValue="Account Owner">{!each.Owner.Name}&nbsp;</apex:column> <apex:column headerValue="Owner email">{!each.Owner.email}&nbsp;</apex:column> <apex:column headerValue="Created Date">{!each.createddate}&nbsp;</apex:column> <apex:column headerValue="Modified Date">{!each.LastModifiedDate}&nbsp;</apex:column> </apex:dataTable> </apex:pageBlockSection> </apex:PageBlock> </apex:page>

 

Here is the Controller:

 

 

public class AllAccountSearchController { private Boolean searched = False; private String searchDunsNumber = removedashes(ApexPages.currentPage().getParameters().get('duns')); String strQuery = 'Select id, name, site, BillingStreet, BillingCity, BillingState, BillingPostalCode, createddate, LastModifiedDate, Owner.Name, Owner.email from Account where site like ' +'\'%'+searchDunsNumber +'%\'' + 'order by Name asc'; public string removedashes(string str){ return str.replaceall( '-', '' ); } public void search() { searchDunsNumber = removedashes(searchDunsNumber); if (this.searchDunsNumber.length() > 3 && this.searchDunsNumber.length() < 10){ //this.searched = True; strQuery = 'Select id, name, site, BillingStreet, BillingCity, BillingState, BillingPostalCode, createddate, LastModifiedDate, Owner.Name, Owner.email from Account where site like ' +'\'%'+searchDunsNumber +'%\'' + 'order by Name asc'; } else{ ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please enter a DUNS Number with at least 4 characters and less then 10.'); ApexPages.addMessage(myMsg); } } public List<Account> getAllAccounts(){ List<Account> listAccounts = new List<Account>(); //listAccounts = [Select id, name, site, BillingStreet, BillingCity, BillingState, BillingPostalCode, createddate, LastModifiedDate, Owner.Name, Owner.email from Account where site like'%123456789%' order by Name desc]; //if (searched) listAccounts = Database.query(strQuery ); if (this.searchDunsNumber.length() > 3 && this.searchDunsNumber.length() < 10){ listAccounts = Database.query(strQuery ); } else{ ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please enter a DUNS Number with at least 4 characters and less then 10.'); ApexPages.addMessage(myMsg); } return listAccounts ; } public String getsearchDunsNumber() { return removedashes(searchDunsNumber); } public void setsearchDunsNumber(String searchDunsNumber){ this.searchDunsNumber = removedashes(searchDunsNumber.trim()); } }

 

 

 

 

 

  • February 01, 2010
  • Like
  • 0

Whenever I create an inputfield on a Visualforce page for a Lookup field, it is displays lower than other input fileds.  Here is some sample code --- in this example, the input field for Account appears lower thatn the field for lastname:

 

<apex:page standardController="Contact" > <apex:form > <apex:sectionHeader title="Contact"> <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons > <apex:pageBlockSection > <apex:inputField value="{!Contact.AccountID}"></apex:inputField> <apex:inputField value="{!Contact.Lastname}"></apex:inputField> </apex:pageBlockSection> </apex:pageBlock> </apex:sectionHeader> </apex:form> </apex:page>

 What is wrong?

 

 

  • January 26, 2010
  • Like
  • 0

I have a visual force page that was created in Summer 10 in my FCS to update cases.

 

The page allowed the user to change the case status and also create an entry into a customer object and create a case comment all from the same page.

 

It was working perfect in until today.  the only change was my Sandbox was updated to Spring 10.

 

Now whenever I try to update the case from the Visual Force Page I get the following error:

 

System.DmlException: Update failed. First exception on row 0 with id 50030000005o8ETAAY; first error: FIELD_INTEGRITY_EXCEPTION, No selected contact: [ContactId]

 

If I edit the case from GUI I do not get the error.  If I select a contact (Which is not a required field) and then execute the visual force page ot works fine.

 

What has chnaged in Spring 10 that is causing this to happen.

 

Any help is apprciated.

 

 

Here is the page:

 

 

<apex:page Controller="newEnhancemnetController" tabStyle="Case" id="thePage"> <script> function confirmCancel() { var isCancel = confirm("Are you sure you wish to cancel?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="New Enhancemnet Approval" subtitle="for change board Case"/> <apex:form > <apex:pageBlock mode="edit"> <apex:pageMessages ></apex:pageMessages> <apex:pageBlockButtons > <apex:commandButton action="{!Save}" value="Save"/> <apex:commandButton action="{!Cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Change Current Case Status" columns="1"> <apex:outputField value="{!Case.id}"/> <apex:outputField value="{!Case.subject}"/> <apex:outputField value="{!Case.description}"/> <apex:pageBlockSectionItem > <apex:outputLabel value="{!$ObjectType.Case.fields.Status.label}" for="casestatus" style="font-weight:bold"/> <apex:outputPanel styleClass="requiredInput" layout="block"> <apex:outputPanel styleClass="requiredBlock" layout="block"/> <apex:selectList value="{!casestatus}" id="casestatus" size="1" title="Status" required="true"> <apex:selectOptions value="{!items}"/> </apex:selectList> </apex:outputPanel> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Add Enhancement Approval Information" columns="2"> <apex:inputField id="eaAprovedFor" value="{!EnhancementApproval.Approved_For__c}" required="true"/> <apex:inputField id="eaEnvironment" value="{!EnhancementApproval.Environment__c}" required="true"/> <apex:inputField id="eaValidFrom" value="{!EnhancementApproval.Valid_From__c}" required="true"/> <apex:inputField id="eaOtherQCS" value="{!EnhancementApproval.Other_QCS__c}" required="False"/> <apex:inputField id="eaValidTo" value="{!EnhancementApproval.Valid_To__c}" required="true"/> </apex:pageBlockSection> <apex:pageBlockSection title="Add a Case Comment"> <apex:inputField id="caseComment" value="{!CaseComment.CommentBody}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

 Here is the controller:

 

 

public class newEnhancemnetController { String casestatus; Case oCase; Enhancement_Approval__c oEnahncemnetApproval; Contact contact; CaseComment casecomment; Map<String,String> mCaseStatus = new Map<String,String>(); public Case getCase() { oCase = [select id, subject, status, description from Case where id = :ApexPages.currentPage().getParameters().get('id')]; if(oCase== null) oCase= new Case(); return oCase; } public Contact getContact() { if(contact== null) contact= new Contact(); return contact; } public String getCaseStatus() { if(casestatus==null){casestatus=oCase.Status;} return casestatus ; } public void setCaseStatus(String casestatus ) { this.casestatus = casestatus ; } public List<SelectOption> getItems() { mCaseStatus.Put('New','New'); mCaseStatus.Put('Approved for Analysis & Design','Approved for Analysis & Design'); mCaseStatus.Put('Reqmts/A&D In Progress','Reqmts/A&D In Progress'); mCaseStatus.Put('Reqmts/A&D Completed','Reqmts/A&D Completed'); mCaseStatus.Put('Approved for Sandbox Build/Config/Test','Approved for Sandbox Build/Config/Test'); mCaseStatus.Put('Sandbox Build In Progress','Sandbox Build In Progress'); mCaseStatus.Put('Sandbox Testing Failed','Sandbox Testing Failed'); mCaseStatus.Put('Sandbox Testing Passed','Sandbox Testing Passed'); mCaseStatus.Put('Waiting for Production Release Date','Waiting for Production Release Date'); mCaseStatus.Put('Release Date Assigned/Approved for Prod','Release Date Assigned/Approved for Prod'); mCaseStatus.Put('Production Testing Failed','Production Testing Failed'); mCaseStatus.Put('Production Testing Passed','Production Testing Passed'); mCaseStatus.Put('On Hold / No Activity','On Hold / No Activity'); mCaseStatus.Put('On Hold / Lack of Funding','On Hold / Lack of Funding'); //mCaseStatus.Put('',''); List<SelectOption> options = new List<SelectOption>(); Schema.DescribeFieldResult fieldResult = Schema.sObjectType.Case.Fields.Status; fieldResult = fieldResult.getSObjectField().getDescribe(); List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues(); for( Schema.PicklistEntry f : ple) { if (mCaseStatus.containskey(f.getValue())) options.add(new SelectOption(f.getLabel(), f.getValue())); //options.add(new SelectOption(f.getLabel(), f.getValue())); } return options; } //public List<SelectOption> getItems() { // List<SelectOption> options = new List<SelectOption>(); // for (CaseStatus cs : [Select MasterLabel from CaseStatus order by sortorder]){ // options.add(new SelectOption(cs.MasterLabel,cs.MasterLabel)); // } // return options; //} public CaseComment getCaseComment () { if(casecomment== null) casecomment= new CaseComment(); return casecomment; } public Enhancement_Approval__c getEnhancementApproval() { if(oEnahncemnetApproval== null) oEnahncemnetApproval= new Enhancement_Approval__c(); return oEnahncemnetApproval; } public PageReference cancel() { PageReference casePage = new ApexPages.StandardController(oCase).view(); casePage .setRedirect(true); return casePage ; } public PageReference Save() { if (oEnahncemnetApproval.Environment__c == 'QCS - Other' && oEnahncemnetApproval.Other_QCS__c ==Null ){ ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Other QCS is Required when Environment is equal to "QCS - Other"'); ApexPages.addMessage(myMsg); return null; } oCase.Status=this.casestatus; update oCase; Enhancement_Approval__c oEA; oEA = new Enhancement_Approval__c(); oEA.Approved_For__c = oEnahncemnetApproval.Approved_For__c; oEA.Case__c = ApexPages.currentPage().getParameters().get('id'); oEA.Environment__c = oEnahncemnetApproval.Environment__c; oEA.Valid_From__c = oEnahncemnetApproval.Valid_From__c; oEA.Valid_To__c = oEnahncemnetApproval.Valid_To__c; oEA.Other_QCS__c = oEnahncemnetApproval.Other_QCS__c; insert oEA; if (casecomment.CommentBody != null){ casecomment.ParentId = ApexPages.currentPage().getParameters().get('id'); insert casecomment; } PageReference casePage = new ApexPages.StandardController(oCase).view(); casePage.setRedirect(true); return casePage ; } //*************************************************************************** //** Test Method //** //*************************************************************************** public static testMethod void testChangeBoardApproval() { pageReference p = Page.ChangeBoardApproval; p.getParameters().put('id', [select id from Case limit 1].id); test.setCurrentPage(p); newEnhancemnetController enhancmenetController = new newEnhancemnetController(); //enhancemnetController.cancel(); enhancmenetController.getCase(); enhancmenetController.getitems(); enhancmenetController.getcasestatus(); enhancmenetController.getEnhancementApproval(); enhancmenetController.getContact(); enhancmenetController.getCaseComment(); enhancmenetController.save(); } }

 

 

 

 

 

  • January 25, 2010
  • Like
  • 0

Hi,

 

I have a need to copy data from a standard object (Opportunity) to a related custom object (Proposal) when "New Proposal" button is clicked on the Proposal related list on the Opportunity detail page.

 

I think my only two options are Visualforce page and s-control. Considering s-controls will be retiring soon, I think my only option is Visualforce. However, I am a Visualforce novice and want to know the following:

 

Can I create a visualforce page without any user interface by overriding "New" button on the custom object (Proposal) that will allow me to take data from standard object (Opportunity) fields and copy it to related custom object (Proposal) fields?

 

If the answer is Yes, can you get me started with some details or a code sample on how to do this?

 

Thanks.

I have created the page and have gone to the proper section under customization for buttons and links. I am having trouble creating the button and having it link to a visual force page. When I go to the drop down of Visual Force page, the content is empty. I am assuming that I need to somehow enable or associate the pages so that they will work with content. If anyone could help I'd greatly appreciate it.

 

Thanks,

Kyle

In our world, case owners work a case, create a case comment, and then have to separately edit the case to change the status to either "Open - Waiting on Feedback" or "Closed - Waiting on Feedback." The case submitter follows a similar workflow where they use comments to communicate back to the case owner and also have to edit the case to set the status back to Open after they add a comment.

 

Does anyone have any suggestions on ways to allow users to change the case status in the same window when they are creating a new case comment? 

 

Possible ideas (but not sure how to accomplish):

 - Custom field on the case comments window to set the status (either the actual status field or a field that fired a workflow rule to update the real status field once the case comment was saved).

 - Custom button to "Save and Update Status" on the case comments window.

 - Custom button on the case to "Create Comment and Update Status."

 

If anyone has any code snippets or can point me to other examples of how this can be accomplished, that would be great!

 

Thanks!

Hello.  I have a pageBlockSection with various inputField lines.  I also have one inputText line along with an outputLabel to provide the field label.  However, the label is placed on top of the inputText field, not to the left, and the font color and size do not match the labels of the standard fields.

 

How do I get the outputLabel to match the standard style?  I've searched the documentation and forums but haven't found anything obvious.

 

 

<apex:pageBlockSection title="Contact Details Left Column" columns="1" ShowHeader="False"> <apex:inputField id="contactSalutation" value="{!contact.Salutation}"/> <apex:inputField id="contactFirstName" value="{!contact.FirstName}"/> <apex:inputField id="contactMiddleName" value="{!contact.Middle_Name__c}"/> <apex:inputField id="contactLastName" value="{!contact.LastName}"/> <apex:outputLabel for="accountName" value="Account Name" style="font-weight:bold"/> <apex:inputText id="accountName" value="{!acctName}" title="Account Name"/> <apex:inputField id="contactTitle" value="{!contact.Title}"/> </apex:pageBlockSection>