function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
OrynThornwallOrynThornwall 

URLFOR Documentation

Hi guys, I am a new developer for SalesForce and am having some trouble finding documentation on some of the core functions.  I have found very basic documentation on the URLFOR function, but I can't find anything on the valid actions you can call from that function.  For instance, I have made a command button to close a case using the following button:

 

<apex:commandButton value="Close Case" action="{!URLFOR($Action.Case.CloseCase, Case.id, [retURL=URLFOR($Action.account.View, Case.account.Id)])}"/>

 

It works great and performs as expected, but where can I find a list of all the other possible actions? 

 

The main thing I am looking for in particular is the action for changing the owner of a case.  I tried to use the following command button:

 

<apex:commandButton value="Transfer Case" action="{!URLFOR($Action.Case.ChangeOwner, Case.Id, [retURL=URLFOR($Action.Case.View, Case.Id)])}"/>

 

But based on the error I am getting when I click it, this seems to be something for mass changing of owners.  Is there a different action to just change the owner of the case currently in context? 

 

Any help for this newbie would be greatly appreciated :)

Sandip458Sandip458

Please Refer Sam Arjmandi's Blog he has explain URlFOR function wid  very nice examples..

 

http://salesforcesource.blogspot.com/2009/01/allow-mass-update-of-your-object.html

OrynThornwallOrynThornwall

Though I didn't see anything in that particular example where he used the URLFOR function, I have read another post of his where he did use it.  In fact, that is where I learned of the functionality that I did get to work.  The problem is, I need to find a list of valid "$Action" calls that are available (e.g. $Action.Case.New or $Action.Case.Edit, etc.)

 

I would settle for now on just having the one for changing the case owner.  I have tried $Action.Case.ChangeOwner, but it doesn't work.  It just gave me an error which lead me to think that this call is a valid one, but for changing many cases at once rather than the case in context. 

 

I would also settle for any other method of making the button work in my original post, though as I understand it, the URLFOR function is the preferred method.

SteveAnderson41SteveAnderson41

The available items for the $Action global variable are different depending on what is enabled for your organization.  The best way I've found to see a full list is to use the custom button dialog.

  1. In Setup, click on Customize, then an object (for example, Cases).
  2. Click Buttons and Links.
  3.  In the Custom Buttons and Links list, click New. 
  4. From the Select Field Type dropdown, select $Action. 
  5. Look at the options available to you in the Insert Field dropdown.

It doesn't sound like that will solve your problem, but I wanted to make this info available to you.

 

If you want a page that allows you to change the owner of the case, expand on the following:

 

 

<apex:page standardController="case"> <apex:form> <apex:inputField value="{!case.OwnerID}"/> <apex:commandButton action="{!save}" value="Save"/> </apex:form> </apex:page>

 

 Does that help?

 

 

OrynThornwallOrynThornwall

Wow...that is extrememly useful!  I had no idea that was there! :)

 

Unfortunately, it's looking like the function is just broken though.  According to the button builder, the syntax is correct.  The function just doesn't work.  I built the link using their builder, and the syntax test showed that it was valid.  Tried the code in my page and in the button I created and both still raise the same error.  The error I get when I click the button is:

 

Unable to Access Page

Invalid parameter value "null" for parameter "ids".

Error: The value of the parameter specified above contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and re-submit. If the error still persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information.

 

Are there any Moderators around that can verify whether this is a bug?  Or maybe I am still doing something wrong? 

 

Other than that, does anyone know of another way to change the case owner on a custom visualforce page?  I am pretty much stuck until I can get this to work because I can't deploy it until that functionality is back.

 

Thanks a lot for all the help! :)

SteveAnderson41SteveAnderson41
Can you post your page?
OrynThornwallOrynThornwall

Here is the complete page.  I created my own so that the different case types would show only the relevant fields using professional edition which doesn't support multiple page layouts.

 

<apex:page standardController="case" showHeader="true"
      tabStyle="account" >
   <style>
      .activeTab {background-color: #236FBD; color:white;
         background-image:none}
      .inactiveTab { background-color: lightgrey; color:black;
         background-image:none}
   </style>
   <apex:tabPanel switchType="client" selectedTab="tabdetails"
                  id="AccountTabPanel" tabClass="activeTab"
                  inactiveTabClass="inactiveTab">  
      <apex:tab label="Case Detail" name="casedetail" id="tabCase">
           <apex:pageBlock title="Case Summary - {!Case.Case_Reason__c}">
               <apex:pageBlockButtons location="top">
                   <apex:form >
                       <apex:commandButton value="Edit" action="{!Edit}"/>
                       <apex:commandButton value="Delete" action="{!URLFOR($Action.Case.Delete, Case.id, [retURL=URLFOR($Action.account.View, Case.account.Id)])}"/>
                       <apex:commandButton value="Close Case" action="{!URLFOR($Action.Case.CloseCase, Case.id, [retURL=URLFOR($Action.account.View, Case.account.Id)])}"/>
                       <apex:commandButton value="Transfer Case" action="{!URLFOR( $Action.Case.ChangeOwner ,  Case.Id , [retURL=URLFOR($Action.Case.View, Case.Id)])}"/>
                   </apex:form>
                   </apex:pageBlockButtons>
                   <apex:outputPanel >
               <apex:pageBlockSection Columns="2">
                   <apex:outputField value="{!Case.CaseNumber}"/>
                   <apex:outputField value="{!Case.status}"/>
                   <apex:outputField value="{!Case.contact.name}"/>
                   <apex:outputField value="{!Case.priority}"/>
                   <apex:outputField value="{!Case.account.name}"/>
                   <apex:outputField value="{!Case.contact.phone}"/>
                   <apex:outputField value="{!Case.type}"/>
                   <apex:outputField value="{!Case.contact.email}"/>
                   <apex:outputField value="{!Case.Case_Reason__c}"/>
                   <apex:outputField value="{!Case.origin}"/>
                   <apex:outputField value="{!Case.description}"/>
                   <apex:outputField value="{!Case.OwnerID}"/>
               </apex:pageBlockSection>
               </apex:outputPanel>
           </apex:pageBlock>
           <apex:pageBlock title="Company Information" rendered="{!case.Case_Reason__c == 'Distributor Inquiry'}">
               <apex:pageBlockSection columns="1">
                    <apex:outputField value="{!case.Countries_of_Distribution__c}"/>
                    <apex:outputField value="{!case.Customer_Types__c}" />
                </apex:pageBlockSection>
           </apex:pageBlock>
           <apex:pageBlock title="Kit Information" rendered="{!case.Case_Reason__c == 'Diagram/Video Request'}">
               <apex:pageBlockSection columns="1">
                    <apex:outputField value="{!case.Kit_Part_Number__c}"/>
                    <apex:outputField value="{!case.Coverage__c}" />
                </apex:pageBlockSection>
           </apex:pageBlock>
           <apex:pageBlock title="Training Information" rendered="{!case.Case_Reason__c == 'Schedule Training'}">
               <apex:pageBlockSection columns="1">
                    <apex:outputField value="{!case.Training_Start_Date__c}"/>
                    <apex:outputField value="{!case.Training_End_Date__c}" />
                    <apex:outputField value="{!case.Training_Type__c}"/>
                </apex:pageBlockSection>
           </apex:pageBlock>
           <apex:pageBlock title="Kit Information" rendered="{!case.Case_Reason__c == 'Design Complaint'}">
               <apex:pageBlockSection columns="1">
                    <apex:outputField value="{!case.Kit_Part_Number__c}"/>
                    <apex:outputField value="{!case.Coverage__c}" />
                    <apex:outputField value="{!case.Designer__c}"/>
               </apex:pageBlockSection>
           </apex:pageBlock>
           <apex:pageBlock title="Kit Information" rendered="{!case.Case_Reason__c == 'Design Modification Request'}">
               <apex:pageBlockSection columns="1">
                    <apex:outputField value="{!case.Kit_Part_Number__c}"/>
                    <apex:outputField value="{!case.Coverage__c}" />
                    <apex:outputField value="{!case.Designer__c}"/>
               </apex:pageBlockSection>
           </apex:pageBlock>
           <apex:pageBlock title="Design Request Information" rendered="{!case.Case_Reason__c == 'New Design Request'}">
               <apex:pageBlockSection columns="1">
                    <apex:outputField value="{!case.Design_Request__c}"/>
                    <apex:outputField value="{!case.design_request__r.Year__c}"/>
                    <apex:outputField value="{!case.design_request__r.Make__c}"/>
                    <apex:outputField value="{!case.design_request__r.Model__c}"/>
                    <apex:outputField value="{!case.design_request__r.Sub_Model__c}"/>
                    <apex:outputField value="{!case.design_request__r.Coverage__c}"/>
                    <apex:outputField value="{!case.design_request__r.Additional_Info__c}"/>
                    <apex:outputField value="{!case.design_request__r.Design_Status__c}"/>
               </apex:pageBlockSection>
           </apex:pageBlock>
           <apex:pageBlock title="Activation Information" rendered="{!case.Case_Reason__c == 'New Activation'}">
               <apex:pageBlockSection title="Activation Information" columns="1">
                    <apex:outputField value="{!case.Deposit_Amount__c}"/>
                    <apex:outputField value="{!case.Minimum__c}" />
                    <apex:outputField value="{!case.Monthly_Fee__c}" />
                    <apex:outputField value="{!case.Paint_Access_Fee__c}" />
                    <apex:outputField value="{!case.Headlight_Access_Fee__c}" />
                    <apex:outputField value="{!case.Headlight_Allowed__c}"/>
                    <apex:outputField value="{!case.Paint_Allowed__c}"/>
                    <apex:outputField value="{!case.Tint_Allowed__c}"/>
                    <apex:outputField value="{!case.Makes_Allowed__c}" />
                    <apex:outputField value="{!case.Regions_Allowed__c}" />
                </apex:pageBlockSection>
            </apex:pageBlock>
      </apex:tab>
      <apex:tab label="Attachments" name="attachments" id="tabAttachment">
           <apex:relatedList subject="{!case}" list="attachments"/>
      </apex:tab>
      <apex:tab label="Open Activities" name="OpenActivities" id="tabOpenAct">
         <apex:relatedList subject="{!case}" list="OpenActivities" />
      </apex:tab>
      <apex:tab label="RAs" name="RAs" id="tabRA" rendered="{!case.Case_Reason__c == 'Product Return'}">
         <apex:relatedList subject="{!case}" list="RAs1__r" />
      </apex:tab>
   </apex:tabPanel>
</apex:page>

OrynThornwallOrynThornwall

Well, I fixed it for now by just replacing the URLFOR function with:

 

<apex:commandButton value="Transfer Case" action="/{!Case.id}/a?retURL=/{!case.id}"/>

 

It works, so I guess I won't worry about it.  Still a mystery though...not sure why the URLFOR function doesn't work for this.

SaiLavuMBLSaiLavuMBL

I had the exact same problem. The following line causes URLFOR to fail

 

 

<apex:tabPanel switchType="client" selectedTab="tabdetails" id="AccountTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab">

 and the following doesn't

<apex:tabPanel switchType="client" id="AccountTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab">

 

I think specifying selectedTab or value attribute causes the URLFOR to fail when used as part of CommandButton/CommandLink in a tabPanel.

 

Would be great if a moderator clears this up for us.

 

2009-04-15

 

Further investigation shows that the issue may be with the action attribute of CommandButton/CommandLink and not with URLFOR.

 

Message Edited by SaiLavuMBL on 04-14-2009 04:34 PM