• insanedukeposse
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 15
    Replies

I have a requirement where I would like to lock some fields, but not all fields.

 

Specifically:

1. We have an "approval process" for solutions. We use the "record lock" feature that prevents everyone but the approver from editing the record.

2. The approver needs to be able to edit the solution - i.e. editorial changes to the solution itself, etc.

3. However, there is another field that should be changed. This field changes the nature of the solution, and would drive it down a different workflow process.

4. Once an approval process is initiated, it does not change even if the "entry criteria" have changed. 

5. So...if the field the controls the entry criteria changes (i.e. is not locked) we end up with a bad result (i.e. an approval process is enforced that is no longer valid).

 

If I could simply create a validation rule that was able to check whether the record id "locked" or not, I'd be all set. I would much prefer to use the value set in the approval process, and not have to create a custom field.  

(see this thread: http://community.salesforce.com/sforce/board/message?board.id=custom_formula&thread.id=7581 )

 

 

 

Any help?

 

I have a problem I'd like some feedback on. This only happens occasionally, but it is annoying to everybody involved.

 

I have a custom controller that expects that have an id passed as a parameter. If the id is passed correctly, the contructor loads the record no problem. However, when an action happens to the record, the URL changes from /apex/myAccount?acctid=0014000000aaaaa to simply /apex/myAccount. This is no problem within the context of this session of this controller. However, the next thing that happens is that someone bookmarks this page - they don't finish their work or they need to come back to this record later, etc.

 

I have a sample of how I handle this situation below, but I'm wondering if there is a better way.

 

You'll notice that what I do to prevent an error from being thrown when no record is returned, and to prevent the rest of the controller code from blowing up, and the VF from thowing an error, is to create a new/blank record. This is NOT ideal. You'll also notice that Salesforce core platform logic handles this in a very unique way with the "URL Does Not Exist" message you get if you put in a bogus salesforce id into the URL. 

 

Thanks for the feedback!

 

Controller - with 2 different methods that wipe out the URL parameters...

 

 

public class myController{ public Account myAccount {get; set;} //constructor public myController() { string id = System.currentPageReference().getParameters().get('acctid'); //get temp record Account[] tempAccount = [select id, name from account where id = :id]; //did you get an actual record? if (tempAccount.size() == 1) { myAccount = tempAccount[0]; } else { ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Error , 'Oops! We could not load your record.'); ApexPages.addMessage(myMsg); myAccount = new Account(); } } public void dosomething (){ myAccount.Name = 'Elvis.' + myAccount.Name; } public PageReference dosomethingelse () { myAccount.Name = myAccount.Name + '.Presley' ; return null; } }

 

 

 

 Here's the VF...

 

 

<apex:page tabstyle="Account" Controller="myController"> <apex:pageMessages /> <apex:form id="form"> <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton action="{!dosomething}" value="Do Something" /> <apex:commandButton action="{!dosomethingelse}" value="Do Something Else" /> </apex:pageBlockButtons> <apex:pageBlockSection > <apex:inputField value="{!myAccount.Name}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

 

I am running a Apex trigger on the Case object that sends an email. The Apex trigger is required as workflow rules to not meet some specific requirements that I have.

 

The snippet below associates the email to the Contact + Case. I can see the activity associated with both objects. However, on the case, the email does not show under the "Emails" related list. (Apex Explorer confirms that an EmailMessage is not created for the outbound email.) Is there a way to force the save of an EmailMessage record?

 

 

system.debug ('contact: ' + Trigger.new[0].ContactId);system.debug ('id : ' + Trigger.new[0].id);mail.setTargetObjectId(Trigger.new[0].ContactId);mail.setWhatId(Trigger.new[0].id);mail.setSaveAsActivity(True);

 

 

 

Is there such a thing as "assignment rules" for custom objects?

 

I have a custom object that requires an assignment rule no differently than a lead or case would. As far as I know, custom objects do not have assignment rules. The interesting thing is that in the system log it LOOKS like the platform is aware that there could be assignment rules for every oject, they just haven't been exposed. The first thing that starts evaluating in the log below is the workflow rule.

 

Why would an assignment rule be preferable in this case? Assignment rules stop evaluating after the first rule is found to evaluate  to true. In workflow rules, you can have rules that step all over each (unless you are very, very careful, or somebody know how to stop the evaluation of a rules after one hits)

 

16:57:17 DEBUG -
*** Beginning Workflow Evaluation
User: XXXXX
Start Time: 20090519235719.529
Starting All Rules Evaluation
Starting evaluation of rule type Assignment
Starting evaluation of rule type Response
Starting evaluation of rule type Workflow

[CustomObject: RecordName a016000000xxxxx]
Rule Name: Assignment: NA 2

I have a problem I'd like some feedback on. This only happens occasionally, but it is annoying to everybody involved.

 

I have a custom controller that expects that have an id passed as a parameter. If the id is passed correctly, the contructor loads the record no problem. However, when an action happens to the record, the URL changes from /apex/myAccount?acctid=0014000000aaaaa to simply /apex/myAccount. This is no problem within the context of this session of this controller. However, the next thing that happens is that someone bookmarks this page - they don't finish their work or they need to come back to this record later, etc.

 

I have a sample of how I handle this situation below, but I'm wondering if there is a better way.

 

You'll notice that what I do to prevent an error from being thrown when no record is returned, and to prevent the rest of the controller code from blowing up, and the VF from thowing an error, is to create a new/blank record. This is NOT ideal. You'll also notice that Salesforce core platform logic handles this in a very unique way with the "URL Does Not Exist" message you get if you put in a bogus salesforce id into the URL. 

 

Thanks for the feedback!

 

Controller - with 2 different methods that wipe out the URL parameters...

 

 

public class myController{ public Account myAccount {get; set;} //constructor public myController() { string id = System.currentPageReference().getParameters().get('acctid'); //get temp record Account[] tempAccount = [select id, name from account where id = :id]; //did you get an actual record? if (tempAccount.size() == 1) { myAccount = tempAccount[0]; } else { ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Error , 'Oops! We could not load your record.'); ApexPages.addMessage(myMsg); myAccount = new Account(); } } public void dosomething (){ myAccount.Name = 'Elvis.' + myAccount.Name; } public PageReference dosomethingelse () { myAccount.Name = myAccount.Name + '.Presley' ; return null; } }

 

 

 

 Here's the VF...

 

 

<apex:page tabstyle="Account" Controller="myController"> <apex:pageMessages /> <apex:form id="form"> <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton action="{!dosomething}" value="Do Something" /> <apex:commandButton action="{!dosomethingelse}" value="Do Something Else" /> </apex:pageBlockButtons> <apex:pageBlockSection > <apex:inputField value="{!myAccount.Name}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

 

Hi there,

 

I have created three VF pages (view, edit and new) to display my data in three columns and have overridden the relevant buttons, but I'm having a bit of trouble with the clone override. I can get the clone to work using this syntax in the view VF page:

 

<apex:commandButton action="{!UrlFor($Action.CustomObject__c.Clone,CustomObject__c.Id)}" value="Clone"/>

 This returns a standard clone page with the URL:

 

https://na6.salesforce.com/{!CustomObject__c.Id}/e?clone=1&retURL=/apex/ViewCustomObject

 

 

This works a treat apart from two things:

 

1. Pressing 'Cancel' returns a blank ViewCustomObject page. How can I get 'Cancel' to return to the original Custom Object?

 

2. I want to display my data in three columns, so I set the 'Clone' override to my 'New' VF page, but the clone functionality doesn't work any more and I just get the original custom object in my 'New' VF page format. Is there any way to get the clone functionality to work with VF pages?

 

I dug around in the forums and found the following example syntax for a clone:

 

<apex:commandButton action="!UrlFor($Action.CustomObject__c.Clone,CustomObject__c.Id,[cloneli=1],true)}" value="Clone"/>

I tried this with the clone override I described above in point 2 and it just returned the standard clone page. Having checked out the documentation for URLFOR (http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#StartTopic=Content/pages_variables_functions.htm?SearchType=Stem) I was wondering where people got the example syntax.

 

The documentation just specifies resource and path as attributes for the function, but the example syntax has two further attributes: [cloneli=1] and a boolean set to 'true'. Can someone please shed some light on this?

 

Thanks.

Message Edited by paddington on 12-05-2009 04:40 AM

As discussed in Ideas (http://ideas.salesforce.com/article/show/69729) here's a solution we have used for clients to enable customisation of the Clone button on Opportunities. This can be used to selectively choose which fields to copy and set default values:

 

For full details and the code to clone opportunity Line Items please contact me directly. We will be re-writing this in VisualForce over the coming months to make it futureproof.

 

Steps to Implement - Admins only

1. Setup -> Customize -> Opportunity -> Buttons and Links

2. Create new custom button called Clone, behaviour is Execute Javascript, Display Type Detail Page Button.

3. Paste in the code below and edit to match your requirements.

4. Remember to add the new button to the Opportunity page layout(s) and hide the original Clone button.

4. Test!

 

// Copyright 2008 BrightGen Ltd - All Rights Reserved try{ {!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")} // ** EDIT THIS QUERY TO LIST THE FIELDS YOU WANT TO COPY ** var result = sforce.connection.query("Select o.Type, o.StageName, o.Product_Type__c, o.Planned_Opportunity__c, o.MarketSector__c, o.CampaignId, o.Business_Unit__c, o.Amount, o.AccountId From Opportunity o WHERE o.Id = '{!Opportunity.Id}'"); var newOpp = result.getArray("records"); // Reset the Opp Id and reset fields to default values newOpp[0].Id = ''; newOpp[0].Name = "Clone {!Opportunity.Name}"; // ** EDIT THESE FIELDS TO SET DEFAULT ANY VALUES ** newOpp[0].StageName = "1. Prospecting"; newOpp[0].CloseDate = new Date(2099, 0, 1); var saveResult = sforce.connection.create(newOpp); if (saveResult[0].getBoolean("success")) { newOpp[0].id = saveResult[0].id; alert("Opportunity cloned without line items"); } else { alert("Failed to create clone: " + saveResult[0]); } // Refresh the page to display the new oppportunity window.location = newOpp[0].id; } catch (err) { alert (err.description ); }

 

 
Message Edited by bg_richard on 02-05-2009 07:11 AM
I'm trying to use visualforce to perform the following:
A. Show related lists (and all headings) only if a related record exists.
B. If a related record does not exist, the particular section is not displayed.
 
I'm trying to use the apex:relatedList tag with the rendered attribute.
 
Is it possible to check if the list is empty as a boolean expression within visualforce without having to create a custom controller method? I have a working solution, but if I want to add this functionality for all related lists, it's a lot of extra controller code to write.
 
Thanks in advance.
 
 
VisualForce View Page
<apex:page standardController="Account" extensions="AccountHiddenListController">
    <apex:detail relatedList="false">
        <apex:relatedList list="Opportunities" rendered="{!relatedOpportunitiesExist}">    
        </apex:relatedList>
    </apex:detail>
</apex:page>
 
 
Controller Code:
public class AccountHiddenListController
{
    private final Account account;
    private boolean relatedOpportunitiesExist;
   
    public AccountHiddenListController (ApexPages.StandardController accountController)
    {
        this.account = (Account) accountController.getRecord();
    }
   
    public boolean getRelatedOpportunitiesExist()
    {
        if (this.relatedOpportunitiesExist != null)
        {
            return this.relatedOpportunitiesExist;
        }
   
        List<Opportunity> opp = this.getOpportunitiesList();
        if (opp.size() > 0)
        {
            this.relatedOpportunitiesExist = true;
        }
        else
        {
            this.relatedOpportunitiesExist = false;       
        }
        return this.relatedOpportunitiesExist;
           
    }
   
    public void setRelatedOpportunitiesExist()
    {
   
    }
   
    public List<Opportunity> getOpportunitiesList()
    {
        if (this.account == null)        
            return null;       
        return [select o.id
        from Opportunity o
        where o.AccountId = :account.id];
       
    }
   
}
I am trying to find a way to import an existing report directly from SFDC using vba alone.
I want it to work as the Excel SFDC add-in does except the login and password would be hard coded.
 
Ideally i want it to create a macro which will import my report at the click of a button.
 
Does anyone have any ideas?
  • October 29, 2008
  • Like
  • 0
I received the above error message when using the Amount merge field from the Opportunity on a VF page.  Any ideas or work arounds?
  • September 23, 2008
  • Like
  • 0
Hi,

I know I should probably use visualforce somehow, but i've inherited a system that i'm not ready to make wholesale changes to just yet.

A matrix report is embedded in an S-Control using the following code:

Code:
Embedded Report:<br>
<!--
https://emea.salesforce.com/00O20000001uILK—pv0=00120000008XmLY
-->

<div style="vertical-align: middle; align:center; cursor:pointer;" align="center" id="embedreport" name="embedreport" onclick="clicked('00O20000001uILK', accid);" onLoad="loadreport('00O20000001uILK', accid);”>
<img src="/img/waiting_dots.gif" border="0">
</div>

<script>loadreport('00O20000001uILK', accid, 'embedreport');</script>

<br>

Hopefully someone knows a way to prevent the Grand Total Column displaying, either at the source or just by cropping the image. Any suggestions would be greatly appreciated.

Regards
Adrian
 

  • August 28, 2008
  • Like
  • 0
I am trying to made tabbedCases (like the example tabbedAccounts).  Here is the code:

Code:
<apex:page standardController="Case" showHeader="true" tabStyle="case" >
    <style> 
    .activeTab {background-color: #B7A752; color:white; background-image:none} 
    .inactiveTab { background-color: lightgrey; color:black; background-image:none} 
    </style>
   <apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel"  tabClass="activeTab" inactiveTabClass="inactiveTab">
      <apex:tab label="Detail" name="CaseDetails" id="tabdetails">
         <apex:detail relatedList="true" title="true"/>
      </apex:tab>
      <apex:tab label="Open Activities" name="OpenActivities" id="tabOpenAct">
         <apex:relatedList subject="{!case}" list="OpenActivities" />
      </apex:tab>
         <apex:tab label="Activity History" name="ActivityHistory" id="tabActHis">
      <apex:relatedList subject="{!case}" list="ActivityHistories" />
      </apex:tab>
         <apex:tab label="Case Comments" name="CaseComments" id="tabCaseComments">
      <apex:relatedList subject="{!case}" list="CaseComments" />
      </apex:tab>
   </apex:tabPanel>
</apex:page>

 
I get the error: 'CaseComments' is not a valid child relationship name for entity Case.  This looks to be the correct name according to the WSDL.

Any thoughts?


Message Edited by billgreenhaw on 07-14-2008 02:18 PM
I'm looking at using email2case. I'm curios as to how replies to a case are appended. Do they become case comments, an email activity, or something else?

Cheers,

Derek
I am having problems getting email attachments to generate case attachments using the email2case agent. I can successfully generate cases from emails, however the email attachments do not get passed through.  Has anyone else encountered issues with this and if so how did you resolve them.
 
It shouldn't make a difference but I am using a developer Salesforce account.
 
Thanks in advance for any help.
 
Tim
  • July 13, 2007
  • Like
  • 0