• zen_nj
  • NEWBIE
  • 265 Points
  • Member since 2006

  • Chatter
    Feed
  • 10
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 31
    Questions
  • 69
    Replies

Hey Folks, I'm new to SF, so I apologize if this is an obvious problem, but I've been unable to find a solution through searching.

 

I have a simple customer object with a few custom fields, the data for which is entered by a basic user. I am the SysAdmin, and have read/write access to everything. In views of this custom object, I can see all of the records, but in creating based on the data in this custom object, only those records that I own appear in the report. I've tried everything I can think of, removing any filtering options from the report, making sure that my user account is SysAdmin and that my access rights are universal, but I can't seem to find the solution.

 

Thanks in advance for any help you can provide!

--Jim 

Currently it's set up to set the close date to the last day in the quarter, but I would prefer it just be 120 days from the date of entry.  I need some help deciding if this is a worklfow or validiation solution.  thanks!

  • September 14, 2009
  • Like
  • 0

Hi,

 

I probably posted this already, but I never got a respond. 

 

Here is my question: I need to check on my custom validation rule's formula if the current user is a member of particular queue.

 

Is this possible to check against the queue in formula and how?

 

Thank you very much.

  • September 11, 2009
  • Like
  • 0

Hi,

 

I need to apply a validation rule on my pick list where I need to check if the value on this particular picklist changed (ISCHANGED) then I need to see what was the prior value???

 

Is there a way I can get the original value of the picklist before it changed?

 

Thank you.

  • September 10, 2009
  • Like
  • 0

I am trying to create my first APEX class. 

 

I go to setup/Develop/Apex Classes

 

I do not see a new button?

 

What am I doing wrong???

 

Thanks in advance for ony help!

 

John

I'm trying to create a simple charging button or script that will apply a numerical value to a field based on text in another field.

 

I'm not a programmer at all but this is so simple i hopping i can figure it out on my own without having to get some outside help.

 

We are using Group Edition and this applies to a custom object.

 

the script is for a button, but ideally i would like this action to take place when the record is created.

 

This is what we have:

 

CASE(Inventory__c.Type__c, "Computer",2.50, "Monitor",7.50, 0)

 

The Type field has several different text optionsI started with just two "Computer" and "Monitor".  the idea is that if these values show up on the type field the numerical value will then show up in a field called charges (Charges__c). 

 

Any help would be great!

I would like SF to create a new case automatically when another one with certain conditions has been closed.

- Create a new case with custom case type and assign it to a queue.

- Closed case has to fill certain criterias: case type, some field values must match criteria, and so on..

 

How can this be done? I'm not able to do very complicated programming. Do you have any pointers on how to proceed with this task?

  • September 09, 2009
  • Like
  • 0

My client has two record types ("Label Clients" and "Project Clients") for each of the standard sObjects "Leads", "Accounts", and "Objects".

 

As should seem obvious, when my client converts a Lead, the resulting Accounts and Opportunities *should* be of the corresponding type.

 

However, in practice, all conversions results in conversions to "Label Client" records.

 

"Map Lead Fields" doesn't seem to include "Record Type" as mappable.

 

Is there somewhere else I should look to map this?

 

Or can I create some sort of custom Convert using Apex?

 

Or, is the best solution to make a trigger which will change the record type based upon a picklist?  Would conversion be considered an "insert" or an "update"?

 

-Brian. 

 

 

Hi

 

We have a formula field (text) in our Opportunity called Account Manager which essentially is just a formula field that is referencing the same-named field in the Account entry: Opportunity.Account_Manager__c=Account.Account_Manager__c

This allows us to show our users who is the Account Manager associated with this Opportunity.
This works great for when the opportunity is still Open since we want to know who is the Account Manager associated with this Opportunity while it's still being worked on.

 

But once the opportunity is closed, we don't want the value in the Opportunity.Account_Manager__c to be updated any more with subsequent changes to the Account.Account_Manger__c since when we run reports later, we want to make sure we show who was in fact the Account Manager associated with this opportunity during its life cycle and not have a situation where after the opportunity has closed, the Account went through an ownership change and so the Account.Account_Manager__c now has a new value and this then gets automatically pushed into our closed opportunity's Opportunity.Account_Manager__c field (even though this person is not at all involved with the opportunity)

 

I tried to do something in the formula like this where if the Opportunity is closed, then the formula field won't get changed:

Opportunity.Account_Manager__c=If (IsClosed, Account.Account_Manager__c, Account_Manager__c)

but i get the error message "Formula cannot use another formula field that directly or indirectly refers to itself"

 

Is there a way to selectively disable a formula field from being updated?

Or can someone think of a way to do this elegantly?

 

I thought of using workflow rules and instead of Opportunity.Account_Manager__c being a formula field, just a text field. And then the workflow will automatically update Opportunities each time it is being updated (i.e. field update to always get the Account.Account_Manager__c value for as long as Opportunity is Open), but this won't work if someone just updated the Account entry and the opportunity itself doesn't get updated.

 

I thought of having a custom button from account page labeled "New Opportunity" so that when someone clicks on that, it will create a new opportunity with the Account Manager field pre-populated in Opportunity. But again, this doesn't allow changes in Account.Account_Manager__c to be automatically reflected in the Opportunity.Account_Manager__c field.

I think I can do this using apex code/trigger but I want to avoid doing that if there is another way to do this.

 

  • April 05, 2013
  • Like
  • 0

I have a simple requirement and I am hoping it's straight forward to do.  I am still a beginner in Visualforce and apex code so am looking for someone to help out.

 

The requirement is pretty simple - when someone edits an entry in the custom object (but it can be standard object as well like Case),  and if one of the field in the object has a certain value, then when the entry has been saved, I want to have a pop up window with a message reminding someone to do something.

 

So for simplicity, let's say the custom object is called Conn__c, and the field is a picklist field called Status__c.

So whenever Status__c="Closed" (or other value), I want to have a message window pop up reminding the user to do xyz.

There should be an ok button in the popup window that the user could then click to get rid of the pop-up window and return control back to the main window (i.e. the Conn__c entry that was just saved)

 

Can someone please provide me with some guidance on this. It doesn't have to be a complete code, but something specific (and combined with pseudocode) would be helpful so I can at least figure out what direction to take.

 

I guess I need to have an apex class/trigger that will check whenever the Conn__c object is saved/edited and if the condition is met, then it will generate a popup message. 

Or maybe it can just be a custom button that override the "Save" button when someone is in edit.

I had some sample code before from someone that was using s-control but that isn't supported anymore in salesforce and it looks like the way to go now is with apex code and visualforce page.


Thanks in advance.

 

  • March 12, 2013
  • Like
  • 0

New to VF and we have a requirement where for specific picklist field  values, we want to be able to display additional fields.  So I have seen some sample VF examples (i.e. the DynamicEditPage (http://wiki.developerforce.com/page/Visualforce_DynamicEditPage) which shows how this can be done.

 

But what I need though is to still have different page layouts for the various opportunities record types and so wanted to know if there is a way to still use the settings (i.e. fields and sections created for those oppty page layout) and just somehow add on to the page layout with a VF section that will display additional fields depending on specific picklist field value (in our case, it is also the Opportunity stage picklist).

 

The example provided only show how we can call on the VF page to edit some basic oppty info and the VF page actually had to define the fields to be displayed and the section name where the fields are being created.  This is not really practical for us since we have 6 opportunity page layouts for each of our oppty record type and then each page layout can easily have over 50 fields and 4/5 sections.  And I don't want to be maintaining the VF page whenever we are just adding a new field or removing a field from a specific opportunity record type.

 

Can someone let me know if we can in fact use VF page so that it will just call on the default oppty page layout and then have a section where depending on the picklist values, it wll pop up/display additional fields?

And if this is do-able, please point me to the right link/discussion or provide some sample code?

 

I tried to search through the board but wasn't sure how exactly to find the right discussions on this (assuming someone else had asked this before - and I would think someone else surely must have)

 

Thanks in advance for your help.

  • September 20, 2012
  • Like
  • 0

I don't really know html well and what I need to do is to just copy a simple microsoft word doc's content/format into a salesforce email template.  It looks like salesforce's email template would need to be html so that we retain the format.

The Microsoft word doc essentially just contains this 5 lines of simple text but there is one line where it's a text box and there is some text in the book. I was trying to see what online tools are available for converting word.doc to html but most of them only seems to copy the text info but not the actual box.

 

i tried to save the word doc as a web page so it is an html file and then just view the source page on firefox and copy/paste the code into salesforce's email template (for html), but the formatting is not exactly right and instead of showing the text in the box, it actually has in the box itself the text "Text Box: xxxxx" where xxxxx is the text that should be in the box. And also the xxxx was truncated so not all the text in the box showed up.

 

Can anyone offer some nifty way to convert word doc to an html email template?

  • December 16, 2011
  • Like
  • 0

Hi


We currently are using Workspace/Content to store our executed contracts (i.e. MSA, Amendments, NDA, etc) and we have created Content type which contain custom fields like a lookup to Account as well as Contract type picklist.  So from this we can see from our Account page the various Content (i.e. legal documents) associated with the customer.

 

Now we would also like to leverage our Content library so that in a new custom object "Order Request",  we want our users to be filling out a Order Request for a customer (so a lookup field to Account) and also a lookup field to Content where it essentially would return the MSA associated with that account that authorizes the order.

However, it looks like when we are creating a new lookup field, there is no option to select Content as the object to be looked up.  

 

Does someone have a way around this or have some best practice/alternative options on how this can be done?

 

I know salesforce have a standard object Contract but we haven't really been using that. And I don't really want to revamp the way the company is currently using salesforce (i.e. we require sales to upload any signed contract to Content and associate it with an account) and now tell them they need to not only do that, but also now create a Contract entry and then associate somehow that Contract entry with a Content entry (i.e. signed legal doc that was uploaded to salesforce content).

 

Any advice/suggestion?

 

 

 

Hi

 

I have a requirement to create a "Channel Revenue" field in Opportunity where the value would be based on the picklist value of a field (say Field B) and then the result of multiplying a custom Field (Number of Channels) with hard-coded amount that's given in USD dollar.

 

So:

 

If Field B has value of xyz,

then Channel Revenue = 12 * Number of Channels * $100

 

If Field B has value of abc,

then Channel Revenue = 12 * Number of Channels * $200

 

So I can create a formula field easy enough to return the amount here. But the problem is that this Channel Revenue is assuming that the total amount is always based on USD currency (since the $100 and $200 is USD based).

 

So if a user has a default currency of Euro, and he creates an Opportunity and has Field B=xyz and Number of Channels = 20, then the Channel Revenue would return = 12 * 20 * 100 => 24000.

But because the currency here is Euro, the result would be 24000 Euro, when it really should be $24000 (USD)

 

Is there some clever way to handle this?  Is there a way that I can create another formula field which essentially contains the currency conversion rate so that it knows first of all what the default opportunity currency is and based on that, this "currency conversion rate" formula field would return say 1.00 when default opportunity currency is USD, but would return say 0.789 if default opporunity currency is Euro (and in our company's salesforce instance, we have defined a currency conversion rate of  0.789 Euro equals $1)

 

 

  • August 24, 2010
  • Like
  • 0

I had created a controller extension code that works fine in sandbox, but when I am running test against the controller code, it would fail with the generic error message:

System.NullPointerException: Attempt to de-reference a null object

 

Specifically, I needed a way to simulate what the detailed link of an object is but since we can't select that from visualforce page, I was trying to use the following code:

 

 

PageReference FSLpage = new PageReference('/'+FSL.id);     // this returns the id of the custom object entry.

string hostname = ApexPages.CurrentPage().getHeaders().get('Host');  // this would return c.cs0.visual.force

 

host = host.replace('c.cs0.visual.force','tapp0.salesforce');

 

FSL_Link = 'https://"+host+FSLpage.getURL();

 

 

and this would return the appropriate value when the visualforce page is invoked so that instead of

something like:

 https://c.cs0.visual.force.com/xxxxxyyyzzz

 it would return

 https://tapp0.salesforce.com/xxxxxxyyyzzz

 

However when running unit testing on this controller extension, it would fail - even though it looks like it runs fine.  So how can i fix this so that I can actually deploy this to our production or make sure the test doesn't fail?

  • February 09, 2010
  • Like
  • 0

Hi


I am new to visualforce so am probably doing things by trial and error and looking at examples (and so not getting the whole picture).

 

But I have controller extension for a custom object (call it FSL) and part of what the controller extension is trying to do is to generate a case off the save of this FSL custom object (PageReference save() function) and then have in the Case Description field the value of the full url of this custom object's entry.

 

Specifically, if this custom object entryhas id of xxxyyz and I am in my sandbox instance, then I want to be able to have in Case Description something like 'For more detail on this object, please refer to '+CustomObject_Link;  and the CustomerObject_Link would return say https://tapp0.salesforce.com/xxxyyz.

 

Right now, I  have the following code:

 

public PageReference Save() {

PageReference CustomObject_Link = new PageReference('/' + FSL.id);

.

.

cases.Description='You can see more detail for the FSL entry related to this request by clicking on this link: '+CustomObject_Link;

 

 

And when the case is generated, the Case Description would just contain:

 

 You can see more detail for the FSL entry related to this request by clicking on this link:/xxxyyz.

 

 

I can hardcode the CustomObject_link in sandbox so that it has:

public PageReference Save() {

PageReference CustomObject_Link = 'https://tapp0.salesforce.com'+new PageReference('/' + FSL.id);

 

And this will allow Case Description to contain:

 You can see more detail for the FSL entry related to this request by clicking on this link:https://tapp0.salesforce.com/xxxyyz.

 

Problem is when I bring this to production, we have a different instance (i.e. it would be https://na2.salesforce.com).

 

So how does one extract the instance information (i.e. that it's na2 instead of tapp0) in visualforce so I can do something like:

 

  PageReference CustomObject_Link = 'https://'+CurrentInstance+'.salesforce.com'+new PageReference('/' + FSL.id);

 

Or how do I just issue a PageReference properly so that it would return the full url (https://<salesforce instance url>/xxyyz) and not just /xxxyyz?

 

 

 

 

 

  • February 02, 2010
  • Like
  • 0

I have a visualforce page where I am displaying selected fields from the Case objects in a table (for list of cases).

So essentially the table would have following columns:

 

Case Number  Owner   Status  DateOpened  DateClosed

 

But what's happening is the DateOpened and DateClosed field would contain something like:

 

Tue May 29 20:19:21 GMT 2007   instead of say what's display in normal case page screen:

5/29/2007 4:19 PM

 

Is there some kind of conversion function I can use in apex code or visualforce to get the display on visualforce not to display the result in GMT format?

 

My code in apexpage to display the Open Date column is something like this:

     <apex:column >    
    <apex:facet name="header"><b>Date Opened</b></apex:facet>      {!case.createdDate}   
    </apex:column>    

 

Is there some way I can manipulate/convert this code so that it either displays the Date field with the full date and time value but in our local time zone (instead of GMT), or just to display it strictly as a Date field (no time)??

 

 

 

I am writing a trigger that checks to see when a Case is Closed, that there are no Open Child Cases associated with that Case.

I can get it working fine with plain trigger code:

 

trigger CloseCase_whenNoOpenChildCase on Case (after insert, after update) {

Case[] cc = Trigger.new;

for (Case c:cc)
{
if (c.IsClosed)
{

Integer OpenChildCase = 0;
for (Case ChildCase : [select id from case where ParentId = :c.id and (isClosed != true)])
OpenChildCase++;
if (OpenChildCase > 0)
c.addError('You are trying to Close a Parent Case that still has open child case! Parent Case number is '+c.casenumber+' or Parent Case id = '+c.id);
}
}
}
 
But now I want to use apex classes and so I created a CloseParentCase_NoOpenChildCase class with the CloseoutParentCase method and so replaced the trigger code to this:
trigger CloseCase_whenNoOpenChildCase on Case (after insert, after update) {

Case[] cc = Trigger.new;

for (Case c:cc)
{
if (c.IsClosed)
{
CloseParentCase_NoOpenChildCase.CloseoutParentCase(c);
}
}
}
And the class I created is as followed: 
public class CloseParentCase_NoOpenChildCase
{

public static void CloseoutParentCase (Case c)
{
if (c.isClosed)
{


Integer OpenChildCase = 0;
for (Case ChildCase : [select id from case where ParentId = :c.id and (isClosed != true)])
OpenChildCase++;
if (OpenChildCase > 0)
c.addError('You are trying to Close a Parent Case that still has open child case! Parent Case number is '+c.casenumber+' or Parent Case id = '+c.id);
}
}
 
 
 
And I wanted to create testmethods that will show when I try to close out a case that has child case, it will fail.  But the problem is it looks like when I run the test, it will fail because of the addError call within the class, so the running of the test will fail.
 For example, in my testmethod, I would do something like the code below, but the problem is it would fail at the statement:     update parent_case;
and this is because it would hit the logic in the the CloseoutParentCase method which issues the addError call.
 
So what is the proper way to write a test method when the logic of the trigger/class itself is to result in a failure when certain situation occurs? 
 
  static testmethod void testCloseoutParentCase ()
{


Case parent_case = new Case(RecordTypeId = '0120000000002Ld',Status ='New');
insert parent_case; // hit the trigger

// make sure Case is created
System.assert(parent_case.id != null);
System.assertEquals(parent_case.Status,'New');


Case SRchild_case0 = new Case(RecordTypeId = '0120000000002Ld',Status ='New',parentid=parent_case.id);
insert SRchild_case0; // hit the trigger

// make sure Case is created
System.assert(SRchild_case0.id != null);

// double check

Case SRchild_case = [ select Status from case where parentid = :parent_case.id];

// make sure Case is created
System.assert(SRchild_case.id != null);


// Now try to update the parent case to Closed, it should fail since we have an open child case
// and therefore parent case status should still be New

parent_case.Status='Closed';
update parent_case;

System.assertEquals(parent_case.Status,'New');
 

delete SRchild_case0;
delete SRchild_case;
delete parent_case;
}
}
 
 
 
 

 

  • February 06, 2009
  • Like
  • 0

I was able to set up a web-to-case html page and have it generate a salesforce case. However, the problem I am having is that even though in the web-to-case html page, I am specifying the case record type of the case, when it gets generated into salesforce, it looks like it is changing that case record type to the default case record type specified in the profile of our "Default Case Owner" as specified in the Cases Support Settings.

 

Is there anyway to override this behavior or this shouldn't be happening at all and somehow in my web-to-case page I need to specify some keyword/syntax?

  • February 02, 2009
  • Like
  • 0

Hello

 

Using salesforce web-to-case, I was able to generate an html page where  it contains something like this:

 

 

 

<label for="subject">Subject</label><input  id="subject" maxlength="80" name="subject" size="20" type="text" /><br>

 

<label for="description">Description</label><textarea name="description"></textarea><br>

Request Category:<select  id="00N00000006tk2h" name="00N00000006tk2h" title="Request Category"><option value="">--None--</option>

<option value="Blackberry">Blackberry</option>
<option value="CD Burning">CD Burning</option>
<option value="Directory Creation (Network Storage)">Directory Creation (Network Storage)</option>
<option value="Workstations">Workstations</option>
</select><br>
 

 

So essentially in the webpage, someone can then type in values for:

 

Subject

Description

Request Category (this is a custom field)

 

I also have some javascript code where I can use to enforce that certain fields must be populated/filled out and the code contains something like:

 

function form_validation(){

 

.

.

 

if (form.subject.value == "") {

alert("Subject - required.");

form.subject.focus();

return false;

 

if (form.description.value == "") {

alert("Description - required.");

form.description.focus();

return false;

 

So based on that, it looks like the form.x.value and form.x.focus are operating either on the name or id of the element in the form.

 

 My problem is that I also need the custom field "Request Category" to be populated. And I am not sure if I am having problem because this is a picklist field, or if it's a custom field. But I tried to do something like this:

 

if (form.00N00000006tk2h.value == "") {

alert("Request Category - required.");

form.00N00000006tk2h.focus();

return false;

 

It doesn't do anything and in fact, it seems to deactivate the logic/check on the previous form.description.value .

 

I tried to change the web page logic so that instead of

 


Request Category:<select  id="00N00000006tk2h" name="00N00000006tk2h" title="Request Category">


I use:

 

Request Category:<select  id="00N00000006tk2h" name="RequestCategory" title="Request Category">

 

and then in the form_validation, use

if (form.RequestCategory.value == "") {

alert("Request Category - required.");

form.RequestCategory.focus();

return false;

 

And that works fine, except when the case does get generated, whatever value was selected from the webpage does not get saved into the case generated. SO it looks like i can't just change the name from 00N00000006tk2h to RequestCategory.

 

Any help would be greatly appreciated. thx

 

  • January 30, 2009
  • Like
  • 0
Hi

Is there a way to format or set up a visualforce pageBlock so that the text of my title (which happens to be pretty long) can be better formatted, especially alongside the Save and Cancel buttons>

Specifically, I  have the following section of code:

<apex:pageBlock title="A very long title since it really is more like a help text to let people know what will be happening next and as such it will wrap around on the screen somehow... and so on and so on ...">
<apex:pageBlockButtons>
<apex:commandButton action="{!Save}" value="Save"/>
<apex:commandButton action="{!Cancel}" value="Cancel"/>
</apex:PageBlockButtons>
.
.
</apex:PageBlock>


And so what's appearing on screen is something like this:


A very long title since it really is more like a help text
to let people know what will be happening next and                 <Save button> <Cancel button>
as such it will wrap around on the screen somehow.
... and so on and so on ...

And what I really would like to have been displayed would be really having the title text wrap only after it's gone thru the whole width of the page and so would be more like:

A very long title since it really is more like a help text to let people know what will be happening next and as such it will wrap around on the screen somehow... and so on and son on  ...

                                                           <Save button>  <Cancel button>
  • January 13, 2009
  • Like
  • 0
Hi

I am using visualforce and custom controller to try and extract and save information from a custom object (call it FSL) and then automatically store certain information from an FSL entry into various fields in the Case object.
So the FSL custom object would contain fields like Account and Contact that are lookups to Account and Contact entries, as well as containing other info.

And the goal is then to automatically create a Case entry that will then use the same Account Name, Contact Name, and other info from the FSL object.

So somewhere in my Class code, I would do something like:

Case c = new Case();
c.AccountID = FSL.Account;  
c.ContactID=FSL.Contact;

And one of the things that I do want to store in the Case's Description field would be a reference to how to access the FSL entry in salesforce (i.e. something like https://na0.salesforce.com/5000R00000zf)

I know that when I am writing custom button or link and I select Content Sounrce to be URL, I can extract from the
Insert fields of the custom object FSL the Detailed Link field (!FSL.Link}

But in my visualforce class, if I try to access that, it tells me that it is an invalid field Link for Sobject FSL.

That is, I can't do something like this:
c.Description='This case is based on a specific custom object FSL entry. To access it, please click on this link '+FSL.Link;


So the only way I can think of to somehow store that info in the Description field is to somehow use the PageReference
function.

In the class, we have methods like this:

public PageReference Save() {
PageReference FSLpage = new PageReference('/' +FSL.id);
.
.
}

and so the PageReferenceFSLpage is storing this info. But how to get this info to be extracted/converted into a string value so that in my code,  that I can't seem to get it working properly.

If I put in something like this in the code above:

PageReference FSLpage = new PageReference('/' +FSL.id);
String FSL_Link = FSLpage.getURL;

c.Description = 'This case is based on a specific custom object FSL entry. To access it, please click on this link '+FSL_Link;

Then what happens is that the FSL_Link will only provide just the id, and not the full url path. So the Description would contain:
This case is based on a specific custom object FSL entry. To access it, please click on this link 5000R00000zf

instead of:
This case is based on a specific custom object FSL entry. To access it, please click on this link https://na0.salesforce.com/5000R00000zf


Can someone show me how to get the complete url?
thx in advance



  • January 08, 2009
  • Like
  • 0
Hi

I am writing an apex code (in visualforce page) where I have the following three objects:

standard object Account
standard object Case
custom object FSL, which contains a lookup field called Account__c that is a lookup to Account object.

So in my code, I am doing something like this:

FSL a;
Case cases;

a = [select id,Account__c, xxx   from FSL where id = :ApexPages.currentPage().getParameters().get('id')];

// so this will return one entry from the FSL custom object which will contain the id, the Account__c value)

// and now I would like to create a Case where the Account Name in the Case object is the same as the Account that was
// referenced in my FSL object.

cases.Account=a.Account__c;

However, this will throw the following compiler error:
Illegal assignemnt from Id to SOBJECT

I remember reading something about this and I think there's a way to get around this, but not sure what exactly I can do?

Any help would be greatly appreciated! thx.

  • January 08, 2009
  • Like
  • 0
I have set up a visualforce page (using a custom controller) on a custom object (call it FSL) and that works ok if I was evoking it by doing something  like:

.../apex/VisualPageName/?id=a140000R000dx1df  (whatever object id for an FSL entry that I want to run it against)

But now I want to create a custom button for FSL and associate it with the visualforce page so that when the user is a a particular FSL entry, they can click on this button and it will invoke the visualforce page (and it's workflow).

I thought I had done it before and when I did it in the past, I would click on the Create new custom button and select Detailed Page Buttno and then in the Content Source, select "Visualforce Page". And when I do that, I should be able to see in the Content pull-down menu a list of all the available VisualForce Pages.

But when I do this, the Content pull-down menu is empty, even though I have 3 visualforce pages set up.

Am I forgetting to do some additional configuration/setup to "publish" the visualforce page? 
It's strange but I can see that I do have an older set up where I created a Case custom button that is invoking a Case visualforce page. But if I try to create a new button and use the exact same set up in the custom button, I would still see blank selection in the Content field.

Can someone please shed some light on this?
thx

Zen


  • January 08, 2009
  • Like
  • 0
Hi all

I am writing a trigger code on the Case object that saved/compiled fine, but when I test it out by actually creating a new Case entry, I get an error on screen about: Apex trigger <triggerName> caused an unexpected exception.


Specifically, my trigger code only contains the following lines:

trigger CloseoutParentSRCancelCase_allChildCaseClosed on Case (after insert, after update) {
Case[] cc = Trigger.new;

for (Case c:cc)
{
/* only fire the trigger when record type is service request, or when Original Business Unit  */
/* contains 'Cancel Service' keyword and the record type is NOT Customer Trouble Ticket */

       if ((c.RecordTypeId == '0120000000002H7') || ((c.RecordTypeId != '0120000000002G4') && c.OriginalBusinessUnit__c.contains('Cancel Service'))) */
CloseParentSRCancelCase_ChildCaseClosed.CloseoutParentSRCancelCase(c);
}
}


And essentially, I want the trigger to fire off when the Case record type is a specific record type, or it is not a specific record type but the OriginalBusinessUnit__c (custom field) would contain the phrase 'Cancel Service'.

So this works fine when I am creating a new Case entry where RecordType is '0120000000002H7' - meaning it will proceed to call the trigger logic defined in my class method (CloseParentSRCancelCase_ChildCaseClosed.ClosedoutParentSRCancelCase).

And it also works fine when I am creating a new Case entry where RecordType is '0120000000002G4', which I think means it by-pass the class method since none of the condition is met.

However, if I create a new Case entry where RecordType is something else (neither '0120000000002H7' or '0120000000002G4'), and the OriginalBusinessUnit__c is left blank, then I get this trigger exception error.

I would have thought that since the OriginalBusinessUnit__c is a blank value, the condition in blue would not have been met and so it would behave the same way as when I had just created a Case where RecordType is '0120000000002G4' 

The OriginalBusinessUnit__c is a picklist field which would contain various values like:
ABC - Billable Service
ABC - Cancel Service
DDD - Billable Service
DDD - Cancel Service
.
.
ZZZ - Billable Service
ZZZ - Cancel Service

So rather than trying to list out all the entries that has Cancel Service, I am using the contain syntax. So is that the problem?

Can someone please help shed some light on this? thx in advance!

  • January 07, 2009
  • Like
  • 0
I have set up validation rules for our Case objects so that in certain scenario (i.e. when certain fields in the Case is a specific value), then only specific Users can Close out the case. The validation rule will essentially check that if Status is Closed, and if the $User.Department is not a specific value, then the validation rule will force an error and let the User trying to close out the case know he is not authorized to do this.

However, based on user request, I know have designed triggers that if certain action occurs, it will then try to close out certain Cases. And what's happening is that in many situation, the User that is initiating the action does not have the proper $User.Department value. And so when the trigger fires off, it will get stopped by the validation rule.

But the logic we want is that if the action that is causing the Case to be closed is coming from a trigger, then the validation rule can be ignored.  Is there some global variable I can use in my validation rule so that instead of something like:

AND(
ISPICKVAL(Status,"Closed"),
$User.Department != "FIX Account Manager",
)

I can add something like:
AND(
ISPICKVAL(Status,"Closed"),
$GlobalVariableIndicatingItscomingFromTrigger=false,
$User.Department != "FIX Account Manager",
)


I know in SQL code, we can have @@NESTLEVEL and other variables to provide information on transaction level. So was wondering if there is something in salesforce apex environment that would contain similar info that I can use to bypass validation rules when the action that is triggering the validation rule is coming from a trigger?
  • January 06, 2009
  • Like
  • 0
Hi all

I have a conundrum here in that I am trying to deploy a trigger to production where when an User entry is created or updated, it will check to see if the Alias field is a duplicate. My trigger/class code works fine for when I am updating, but if I try to add in my test code (for deployment) a logic to insert a User entry, it will fail with message:
System.TypeExecption: DML not allowed on User.

So how exactly can I deploy the code then since if I don't test the insert logic, my code coverage total % would be only like 41%.

Just some clarification, I get the 41% code coverage when running it as a test in our sandbox apex class section.
But when I try to deploy it using the "ant deploy" method, I actually would get an error message:

Failures:
Code coverage issue, class: UserAliasDuplicatePreventerUpdate --- Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required.

The strange thing is that I had done this last year and I think when I deployed it along with the other existing triggers/classes, I was able to deploy it fine. But since then I think I have a newer ant version, as well as our sandbox and production instance have been upgraded. So instead of apiVersion 10.0, I think it is now 11.0. Not sure if that makes a difference or not.

In any case, here is my trigger code followed by my class code.
Any help would be greatly appreciated!

trigger UserAliasDuplicatePreventerUpdate on User (before insert, before update) {

// Trigger will only fire when the Alias has changed
for (Integer i = 0; i < Trigger.new.size(); i++) {

if(trigger.isInsert)
{
EnsureUniqueUserData.checkUniqueUserAlias(Trigger.new);
}
if (trigger.isUpdate)
{
if (Trigger.old[i].Alias != Trigger.new[i].Alias)
{
EnsureUniqueUserData.checkUniqueUserAlias(Trigger.new);
}
}
}
}

My class code is:

public class EnsureUniqueUserData
{

public static void checkUniqueUserAlias (User[] users)
{
for (User u:users)
{
Integer i = [ select count() from User where Alias = :u.Alias];
if (i > 0)
{
u.addError('An User with this Alias already exists!');
}
}
}


static testmethod void testUniqueUserAlias()
{
.
.
.
}



  • January 06, 2009
  • Like
  • 0
Hi

I am using salesforce standard Case object which has quite a few fields. And what I want to be able to do is the following:

1. User creates a new Case entry (or edit an existing entry), and they checked a specific field in the Case page layout (which would be based off standard salesforce page layout and profile permission setting).
2. When user clicks on the Save button , if they had checked a specific field, then a Visualforce page would show up that would  contain additional information for them to fill out.  And once they fill out the additional info, they would click Save (or Cancel) and this will complete the case creation/editing process.

I've seen the examples in visualforce where you use custom controller to create wizards where you 1st create an Account and then Contact and then Opportunity. But I really want to leverage the various page layout and profile permissions that came with a standard controller. So am wondering if there's a way to use a standard controller but somehow modified the behavior so that when the user click on the Save button, it would render an additional pageblock section if certain criteria is met.

Is this do-able?
I have the visualforce code for part 2 ready and right now I can sort of simulate this behavior by creating a custom button that when the user clicks on, it will check the specific field in the Case and depending on the value, will render a page block that require user to enter additional inputs, or just return a message saying "criteria not met to be able to do this".  But it would be more elegant to have this function be done when the user clicked on the Save button.
  • December 04, 2008
  • Like
  • 0

Hi

 

We have a formula field (text) in our Opportunity called Account Manager which essentially is just a formula field that is referencing the same-named field in the Account entry: Opportunity.Account_Manager__c=Account.Account_Manager__c

This allows us to show our users who is the Account Manager associated with this Opportunity.
This works great for when the opportunity is still Open since we want to know who is the Account Manager associated with this Opportunity while it's still being worked on.

 

But once the opportunity is closed, we don't want the value in the Opportunity.Account_Manager__c to be updated any more with subsequent changes to the Account.Account_Manger__c since when we run reports later, we want to make sure we show who was in fact the Account Manager associated with this opportunity during its life cycle and not have a situation where after the opportunity has closed, the Account went through an ownership change and so the Account.Account_Manager__c now has a new value and this then gets automatically pushed into our closed opportunity's Opportunity.Account_Manager__c field (even though this person is not at all involved with the opportunity)

 

I tried to do something in the formula like this where if the Opportunity is closed, then the formula field won't get changed:

Opportunity.Account_Manager__c=If (IsClosed, Account.Account_Manager__c, Account_Manager__c)

but i get the error message "Formula cannot use another formula field that directly or indirectly refers to itself"

 

Is there a way to selectively disable a formula field from being updated?

Or can someone think of a way to do this elegantly?

 

I thought of using workflow rules and instead of Opportunity.Account_Manager__c being a formula field, just a text field. And then the workflow will automatically update Opportunities each time it is being updated (i.e. field update to always get the Account.Account_Manager__c value for as long as Opportunity is Open), but this won't work if someone just updated the Account entry and the opportunity itself doesn't get updated.

 

I thought of having a custom button from account page labeled "New Opportunity" so that when someone clicks on that, it will create a new opportunity with the Account Manager field pre-populated in Opportunity. But again, this doesn't allow changes in Account.Account_Manager__c to be automatically reflected in the Opportunity.Account_Manager__c field.

I think I can do this using apex code/trigger but I want to avoid doing that if there is another way to do this.

 

  • April 05, 2013
  • Like
  • 0

I have a simple requirement and I am hoping it's straight forward to do.  I am still a beginner in Visualforce and apex code so am looking for someone to help out.

 

The requirement is pretty simple - when someone edits an entry in the custom object (but it can be standard object as well like Case),  and if one of the field in the object has a certain value, then when the entry has been saved, I want to have a pop up window with a message reminding someone to do something.

 

So for simplicity, let's say the custom object is called Conn__c, and the field is a picklist field called Status__c.

So whenever Status__c="Closed" (or other value), I want to have a message window pop up reminding the user to do xyz.

There should be an ok button in the popup window that the user could then click to get rid of the pop-up window and return control back to the main window (i.e. the Conn__c entry that was just saved)

 

Can someone please provide me with some guidance on this. It doesn't have to be a complete code, but something specific (and combined with pseudocode) would be helpful so I can at least figure out what direction to take.

 

I guess I need to have an apex class/trigger that will check whenever the Conn__c object is saved/edited and if the condition is met, then it will generate a popup message. 

Or maybe it can just be a custom button that override the "Save" button when someone is in edit.

I had some sample code before from someone that was using s-control but that isn't supported anymore in salesforce and it looks like the way to go now is with apex code and visualforce page.


Thanks in advance.

 

  • March 12, 2013
  • Like
  • 0

New to VF and we have a requirement where for specific picklist field  values, we want to be able to display additional fields.  So I have seen some sample VF examples (i.e. the DynamicEditPage (http://wiki.developerforce.com/page/Visualforce_DynamicEditPage) which shows how this can be done.

 

But what I need though is to still have different page layouts for the various opportunities record types and so wanted to know if there is a way to still use the settings (i.e. fields and sections created for those oppty page layout) and just somehow add on to the page layout with a VF section that will display additional fields depending on specific picklist field value (in our case, it is also the Opportunity stage picklist).

 

The example provided only show how we can call on the VF page to edit some basic oppty info and the VF page actually had to define the fields to be displayed and the section name where the fields are being created.  This is not really practical for us since we have 6 opportunity page layouts for each of our oppty record type and then each page layout can easily have over 50 fields and 4/5 sections.  And I don't want to be maintaining the VF page whenever we are just adding a new field or removing a field from a specific opportunity record type.

 

Can someone let me know if we can in fact use VF page so that it will just call on the default oppty page layout and then have a section where depending on the picklist values, it wll pop up/display additional fields?

And if this is do-able, please point me to the right link/discussion or provide some sample code?

 

I tried to search through the board but wasn't sure how exactly to find the right discussions on this (assuming someone else had asked this before - and I would think someone else surely must have)

 

Thanks in advance for your help.

  • September 20, 2012
  • Like
  • 0

Hi


We currently are using Workspace/Content to store our executed contracts (i.e. MSA, Amendments, NDA, etc) and we have created Content type which contain custom fields like a lookup to Account as well as Contract type picklist.  So from this we can see from our Account page the various Content (i.e. legal documents) associated with the customer.

 

Now we would also like to leverage our Content library so that in a new custom object "Order Request",  we want our users to be filling out a Order Request for a customer (so a lookup field to Account) and also a lookup field to Content where it essentially would return the MSA associated with that account that authorizes the order.

However, it looks like when we are creating a new lookup field, there is no option to select Content as the object to be looked up.  

 

Does someone have a way around this or have some best practice/alternative options on how this can be done?

 

I know salesforce have a standard object Contract but we haven't really been using that. And I don't really want to revamp the way the company is currently using salesforce (i.e. we require sales to upload any signed contract to Content and associate it with an account) and now tell them they need to not only do that, but also now create a Contract entry and then associate somehow that Contract entry with a Content entry (i.e. signed legal doc that was uploaded to salesforce content).

 

Any advice/suggestion?

 

 

 

I'm having a hard time getting my brain around a new trigger I'm trying to write:

 

Business Case: Users add Weekly Notes (a custom child object to Opportunities) records to Opportunities every week ahead of a weekly meeting on Tuesdays.  The users should not be able to revise their notes after the meeting, but should have to log a new record.  Note: I have a custom formula date field that identifies the next Tuesday's date from the Created Date.

 

Issue: I want to lock a record from editing after a specific date and time: local midnight before Tuesday's meeting.  This also needs to happen with no action on a user's part to trigger the update.

 

Ideas on how to handle this?  I already have one formula field to calculate the date of the next Tuesday meeting, and I have located a simple trigger to identify a user's local midnight here.

 

Thanks!

Hi all,

 

I want to create a rollup summary field which sums up the amount from its child records.

This summing of amounts should take place only if flag is checked on the child record. Otherwise, the rollup field should ignore this amount field on the child records.

 

Really appreciate any help or idea on how to implement this.

 

Thanks,

VK86

  • June 15, 2010
  • Like
  • 0

Hi


I am new to visualforce so am probably doing things by trial and error and looking at examples (and so not getting the whole picture).

 

But I have controller extension for a custom object (call it FSL) and part of what the controller extension is trying to do is to generate a case off the save of this FSL custom object (PageReference save() function) and then have in the Case Description field the value of the full url of this custom object's entry.

 

Specifically, if this custom object entryhas id of xxxyyz and I am in my sandbox instance, then I want to be able to have in Case Description something like 'For more detail on this object, please refer to '+CustomObject_Link;  and the CustomerObject_Link would return say https://tapp0.salesforce.com/xxxyyz.

 

Right now, I  have the following code:

 

public PageReference Save() {

PageReference CustomObject_Link = new PageReference('/' + FSL.id);

.

.

cases.Description='You can see more detail for the FSL entry related to this request by clicking on this link: '+CustomObject_Link;

 

 

And when the case is generated, the Case Description would just contain:

 

 You can see more detail for the FSL entry related to this request by clicking on this link:/xxxyyz.

 

 

I can hardcode the CustomObject_link in sandbox so that it has:

public PageReference Save() {

PageReference CustomObject_Link = 'https://tapp0.salesforce.com'+new PageReference('/' + FSL.id);

 

And this will allow Case Description to contain:

 You can see more detail for the FSL entry related to this request by clicking on this link:https://tapp0.salesforce.com/xxxyyz.

 

Problem is when I bring this to production, we have a different instance (i.e. it would be https://na2.salesforce.com).

 

So how does one extract the instance information (i.e. that it's na2 instead of tapp0) in visualforce so I can do something like:

 

  PageReference CustomObject_Link = 'https://'+CurrentInstance+'.salesforce.com'+new PageReference('/' + FSL.id);

 

Or how do I just issue a PageReference properly so that it would return the full url (https://<salesforce instance url>/xxyyz) and not just /xxxyyz?

 

 

 

 

 

  • February 02, 2010
  • Like
  • 0

Hey Folks, I'm new to SF, so I apologize if this is an obvious problem, but I've been unable to find a solution through searching.

 

I have a simple customer object with a few custom fields, the data for which is entered by a basic user. I am the SysAdmin, and have read/write access to everything. In views of this custom object, I can see all of the records, but in creating based on the data in this custom object, only those records that I own appear in the report. I've tried everything I can think of, removing any filtering options from the report, making sure that my user account is SysAdmin and that my access rights are universal, but I can't seem to find the solution.

 

Thanks in advance for any help you can provide!

--Jim 

This is similar to my last request, but the required field is a picklist.  I used the last formula for a text field needs to be completed before an opportunity is saved:

 

AND(


ISPICKVAL(Reseller_Involved__c,"Yes"),
LEN(Reseller_Name__c)=0


)

 

 

Now, I need a picklist field to be required:  If Picklist field 'Type' (standard field) is selected 'Vendor', then Picklist field 'Vendor Group' (custom) is required.  I have:

 

 AND(


ISPICKVAL(TYPE,"Vendor"),
ISPICKVAL(Vendor_Vendor__c)  (I know I'm missing something here)

 

)

 

 

What is missing or do I have the wrong function in the second line?  Thx.

  • September 17, 2009
  • Like
  • 0

The main goal is to notify Account Owner and additional email of a Case. So I set up a new Workflow Rules with criteria "Case Comment: Body not equal to null". The workflow is working fine. Then I also set up a new Email Alert.

 

I did these steps:
http://blogs.salesforce.com/support/2009/06/new-in-summer-09-workflow-email-alerts-for-case-comments.html

 

Here is my current obstacle, I cannot send the email alert to the Case Account Owner and Email Field I created. There is options for both, but Account Owner from the list is basically My Account (logged in account), not the Case Account Owner. And the email field I created does not show up on the list.

 

Any idea? Thanks in advance

Message Edited by madimulia on 09-16-2009 01:44 PM

Currently it's set up to set the close date to the last day in the quarter, but I would prefer it just be 120 days from the date of entry.  I need some help deciding if this is a worklfow or validiation solution.  thanks!

  • September 14, 2009
  • Like
  • 0

Hi Friends,

 

I have a requirement for doing the calculation in formula field,

 

when I save the calculation of a formula field,

 

it is showing the,

 

Compiled formula is too big to execute (6,395 characters). Maximum size is 5,000 characters.

 

formula is looking like this,

[CV* ( 1+IPV/100)**( NM/12)] +[ Sum from Y= 1to Y=NY of { AC* [( 1+ INCC/100)**( NY-Y+1)] *[ (1+IPV/100)**Y]},

as our requirement i did this formula is like this,

Financial_Detail__r.Plan_current_value__c * ( ( Financial_Detail__r.Rate_of_Increase_in_Plan_Value__c ) ^ ( CEILING( Complete_month_bwn_maturity_year_today__c / 12) ) )

+

( Complete_years_bwn_Maturity_yr_today__c )
*
(( Plan_Annual_Contribution__c )
*
(( ((1+ Rate_of_incr_in_contributions_this_plan__c ) ^CEILING ( Complete_years_bwn_Maturity_yr_today__c-( YEAR( TODAY() ) - YEAR( Financial_Detail__r.Plan_beginning_year__c ) )+1 ))

*

((1+ Financial_Detail__r.Rate_of_Increase_in_Plan_Value__c )^CEILING(YEAR( TODAY() ) - YEAR( Financial_Detail__r.Plan_beginning_year__c ))))))

 

 

Can any one please tell me,how to resolve this problem?

 

Thanks in Advance,

 

Thanks and Regards,

Srinivas Chittela

Message Edited by csrsak on 09-10-2009 02:40 AM
  • September 10, 2009
  • Like
  • 0

I would like SF to create a new case automatically when another one with certain conditions has been closed.

- Create a new case with custom case type and assign it to a queue.

- Closed case has to fill certain criterias: case type, some field values must match criteria, and so on..

 

How can this be done? I'm not able to do very complicated programming. Do you have any pointers on how to proceed with this task?

  • September 09, 2009
  • Like
  • 0

Hello

 

I'm a very new in all the salesforce business

i'm trying to make a new button in the account that will open me a new task with some data in the fields

 

 

Someone can help me ?

 

Thanks

Elad

 

 

  • September 08, 2009
  • Like
  • 0

Hi Does anyone know how to edit the following code to add 365 days to the close date of the new opp.

 

The Code i have so far:

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.Description, 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 = "Renewal - {!Opportunity.Name}";

// ** EDIT THESE FIELDS TO SET DEFAULT ANY VALUES **
newOpp[0].StageName = "Prospecting";
newOpp[0].CloseDate = new DATE((TODAY()-CloseDate)+365)
newOpp[0].Type = "Renewal"

var saveResult = sforce.connection.create(newOpp);

if (saveResult[0].getBoolean("success")) {
newOpp[0].id = saveResult[0].id;
alert("Renewal Opportunity Has Been Created.");
}
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 );
}

 

But i am getting Undefined message.

 

Thanks if someone can help im sure its somthing simple i must be missing ?

 

 

Kind Regards,

 

Jake


Hi folks

Not sure if this is visualforce question or apex question in general. But I wanted to render a section of the page only when certain criteria are met. In this case, the criteria is when two fields in my object have specific value.

In my situation, I am using Case object and also using the case standard controller. And in my visualforce page, I want certain sections to be rendered if say:
field 1 contains any value - field 1 is a multi-picklist field
field 2 to contains a specific text value - field 2 is a text field.

I can get the render logic working when I am basing it off just one of the field:

for example:

<apex:form rendered="{!case.field1__c != null}">
this would work and the section would be rendered depending on if field1 (a multi-picklist field) contained any value.

Also,
<apex:form rendered="{!case.field2__c == 'specific text value'}">
this also work and the section would be rendered when field2 (a text field) contains the specific value.

However, I can't seem to get it working so that the section would be rendered only when both conditions are met.
I tried the following variations below but not seem to be working, can someone shed some light on this please?

<apex:form rendered="{ IF (AND(!case.field1__c != null,!case.field2__c=='specific text value'),true,false}">

<apex:form rendered="{ (!case.field1__c != null) && (!case.field2__c =='specific text value') }">


  • December 03, 2008
  • Like
  • 0