• Saaspert
  • NEWBIE
  • 105 Points
  • Member since 2008

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

Can we pass parameter from vf page to controller?

 

I have 6 buttons on my VF page which does the same work except on one field. I wanted to use the same page reference to all this 6 buttons.Based on which button is clicked, i want to pass parameter to controller and update one field.

 

for example,

My buttons are Update Phone,Update Address, Update State,Update City

 

<apex:commandButton action="{!update}" value="Update Phone" Here how to pass parameter val='Update Phone' to controller/> <apex:commandButton action="{!update}" value="Update Address" Here how to pass parameter val='Update Address' to controller/> <apex:commandButton action="{!update}" value="Update State" Here how to pass parameter val='Update State' to controller/> <apex:commandButton action="{!update}" value="Update City" Here how to pass parameter val='Update City' to controller/>

 

 

And the controller

 

 

public class MyController { Public PageReference Update(string val) { if(val=='Update Phone') { then do this.... } else if(val=='Update Address) { then do this... } } }

 

 

 

Message Edited by mavs on 04-23-2009 11:30 AM
  • April 23, 2009
  • Like
  • 0

I have a custom controller for a visualforce (VF) page, and I want to be able to run a method on that controller multiple times from the VF page with different parameters (method takes multiple parameters), displaying the results of each method call on the VF page (method output is a string).  Sounds simple, but I cannot figure out how to execute an apex method with parameters from VF.  If someone has a solution for this, or perhaps an alternative, please post an outline of how the VF and apex controller code should look.

 

Hi:

I am getting this error, build.xml:20: Request timed out, check max poll and poll wait millis attributes

I looked through the ant-salesforce.jar file and never found an xml file with these attributes.

Where can I set these?

Thank you.
  • June 09, 2008
  • Like
  • 0

System.AssertException: Assertion Failed: Expected: 9, Actual: 10

 

I have assert statement system.assertequals(mapCntr.cmapSegments.size(),10);

the cmapsegments is returning 9 elemetns and I put 10 to fail the assertion , it does but with wrong expected and actual numbers.

 

org type: sandbox

Here is the scenario :
there are two orgs Org#1 and Org#2

Org#1. Self Service Org (used by customers to browse knowledge , open cases , view cases etc)

Org#2. Internal Support Org (used by support reps)

When a customer creates a case in Org#1 that case is copied over to Org#2 via S2S,
all case fields are copied over to Org#2 except the Case Number,  
In both orgs the Case number is an "auto number" field hence two different case numbers are generated in both orgs.

is there anyway I can get case number generated in Org#2 copied over in Org#1 ?

attempted solution: I created a custom field on Case Object in Org#1 to store Case number from Org#2 and updated S2S mapping to publish case number from Org#2 to Org#1, but the issue is unless the case record is modified in Org#2 , custom field in Org#1 is not updated with Org#2 case number.

is it possible to get the case number from Org#2 to Org#1 w/o modifying case in Org#2 ?

Please let me know if there are any other approaches like getting Case number from Org#2 via Web Service or something else.

Thanks!

I would like to set default record type to cases created coming in via S2S to Support but it is getting set to a different record type (IT support).

 

I can forcefully set the recordtype to support in "before insert" trigger but how I can differentiate between cases created locally in the org vs. cases coming from S2S.

 

any ideas ? 

I am establishing S2S between two orgs . Org A (source Org) and Org B (Target Org)

 

Org A has an object (Object1) with look up on the two other objects (Object2 and Object3)

 

Object2 and Object3 are already externally shared with Org B.

 

while sharing Object1 , I am setting parentrecordid to Object2 so Object1 shows up correctly linked to Object2

 

but I am not able link Object1 with both Object2 and Object3 at the same time.

 

here is the code from the after insert trigger on Object1 in Org A.

 

stripped down code...

 

 

            PartnerNetworkRecordConnection newConnection = new PartnerNetworkRecordConnection (
            ConnectionId = networkId,
            LocalRecordId = obj1.Id, 
            ParentRecordId = obj1.obj2);

 

            insert  newConnection;

 

Thanks for your help.

It would be very helpful if S2S connection publish subscribe metadata is available via eclipse and or ant for automated deployment. 

It is quite error prone (i.e. not consistently repeatable process) to setup connection and related publish and subscribe data in various environments (QA, Dev and production) manually.

 

Please let me know if there is any existing automated way to do the deployment of S2S config.

 

Please promote this idea:


http://ideas.salesforce.com/article/show/10097875/Make_S2S_connections_publish_subscribe_metadata_available_via_eclipse__ant_for_automated_deployment


 

I am trying to deploy a profile called "my customer user profile" of license type "Customer Portal Manager" using ant metadata library, I downloaded the profile using eclipse on my local file system from dev org1 and deployed to dev org2

 

when I checked dev org2 "my customer user profile" was imported correctly (FLS, Apex classes, VF pages etc) except that the license type i.e. User License was "Salesforce" instead of "Customer Portal Manager"

 

please let me know if this is a bug or I am doing something incorrectly.

 

Thanks 

 

 

has anyone successfully integrated a flex upload control with force.com or salesforce.com, I am trying to implement a flex control for file upload (case attachment), please let me know 

 

thanks for your help

 

url to swfupload: http://swfupload.org/ 

Hi All,

 

Can you tell me how to migrate user data to another salesforce instance and also how to migrate role hierarchy from one instance to another. Please help.

 

Thanks,

Sandeep

  • September 21, 2010
  • Like
  • 0

System.AssertException: Assertion Failed: Expected: 9, Actual: 10

 

I have assert statement system.assertequals(mapCntr.cmapSegments.size(),10);

the cmapsegments is returning 9 elemetns and I put 10 to fail the assertion , it does but with wrong expected and actual numbers.

 

org type: sandbox

We are looking to enable SSO within our Salesforce.com org.  We understand there are 2 ways to utilize SSO.

 

  • SAML via the Browser
  • Delegated Authentication [APIs] - via custom development or we could utilize Ping Federate Connector [company currenty supports this]

Our requirements state that the User ID for all entry points into Salesforce.com [Browser, Mobile, Outlook, and Offline] utilize the numerical SSO ID we use internally within the company.  We understand the defualt configuration utilizes email addresses [standard user name of Salesforce.com] even with SSO enablement.

 

We would like there to be SAML based authentication for all entry points into Salesforce.com [Browser, Mobile, Outlook, and Offline].  Is this on the roadmap?  If not, any concerns as to why it is not?

 

Thanks.

Here is the scenario :
there are two orgs Org#1 and Org#2

Org#1. Self Service Org (used by customers to browse knowledge , open cases , view cases etc)

Org#2. Internal Support Org (used by support reps)

When a customer creates a case in Org#1 that case is copied over to Org#2 via S2S,
all case fields are copied over to Org#2 except the Case Number,  
In both orgs the Case number is an "auto number" field hence two different case numbers are generated in both orgs.

is there anyway I can get case number generated in Org#2 copied over in Org#1 ?

attempted solution: I created a custom field on Case Object in Org#1 to store Case number from Org#2 and updated S2S mapping to publish case number from Org#2 to Org#1, but the issue is unless the case record is modified in Org#2 , custom field in Org#1 is not updated with Org#2 case number.

is it possible to get the case number from Org#2 to Org#1 w/o modifying case in Org#2 ?

Please let me know if there are any other approaches like getting Case number from Org#2 via Web Service or something else.

Thanks!

I am establishing S2S between two orgs . Org A (source Org) and Org B (Target Org)

 

Org A has an object (Object1) with look up on the two other objects (Object2 and Object3)

 

Object2 and Object3 are already externally shared with Org B.

 

while sharing Object1 , I am setting parentrecordid to Object2 so Object1 shows up correctly linked to Object2

 

but I am not able link Object1 with both Object2 and Object3 at the same time.

 

here is the code from the after insert trigger on Object1 in Org A.

 

stripped down code...

 

 

            PartnerNetworkRecordConnection newConnection = new PartnerNetworkRecordConnection (
            ConnectionId = networkId,
            LocalRecordId = obj1.Id, 
            ParentRecordId = obj1.obj2);

 

            insert  newConnection;

 

Thanks for your help.

OK, I've searched the help files and the boards for a few hours and spent another few talking to support with no resolution to this question yet.  Account type: Professional

 

We have a connection established with one of our client companies.  Initially they set up a Publish relationship and we subscribed.  All of the selected records (Accounts, Contacts, Leads, Tasks, Opportunities) populated into our account as expected and updates we apply to the records are reflected back to our client (publisher).

 

Now the question.  What is the setup and process that enables us (subscriber) to create additional child records (Contacts, Opportunities, Tasks, etc.) and have them populate back to the client's account?

 

Thanks!

It would be very helpful if S2S connection publish subscribe metadata is available via eclipse and or ant for automated deployment. 

It is quite error prone (i.e. not consistently repeatable process) to setup connection and related publish and subscribe data in various environments (QA, Dev and production) manually.

 

Please let me know if there is any existing automated way to do the deployment of S2S config.

 

Please promote this idea:


http://ideas.salesforce.com/article/show/10097875/Make_S2S_connections_publish_subscribe_metadata_available_via_eclipse__ant_for_automated_deployment


 

I am trying to deploy a profile called "my customer user profile" of license type "Customer Portal Manager" using ant metadata library, I downloaded the profile using eclipse on my local file system from dev org1 and deployed to dev org2

 

when I checked dev org2 "my customer user profile" was imported correctly (FLS, Apex classes, VF pages etc) except that the license type i.e. User License was "Salesforce" instead of "Customer Portal Manager"

 

please let me know if this is a bug or I am doing something incorrectly.

 

Thanks 

 

 

i am trying to display list valus from an object using an listbox option am getting the following error here it the code .I missed some thing?I missed some thing in the code.

 

VF page

 

 

<apex:page controller="ABC">

<apex:selectList id="topq" value="{!top}" required="true" multiselect="false" title="Select " size="4"> <apex:selectOption value="{!pop}" />

</apex:selectList>

</apex:page>

 

 

 

 

 

controller:

 

 

 

 

 

 

value="{!top}" have it own get and seter.

 

 

 

 

List<CustomObject__c> pop;

public List<CustomObject__c> getpop() { if(pop== null) pop= [select customfield__c from CustomObject__c limit 100]; return pop; }

 

 

Message Edited by gv007 on 05-08-2009 09:32 AM
Message Edited by gv007 on 05-08-2009 09:33 AM
  • May 08, 2009
  • Like
  • 0

Can we pass parameter from vf page to controller?

 

I have 6 buttons on my VF page which does the same work except on one field. I wanted to use the same page reference to all this 6 buttons.Based on which button is clicked, i want to pass parameter to controller and update one field.

 

for example,

My buttons are Update Phone,Update Address, Update State,Update City

 

<apex:commandButton action="{!update}" value="Update Phone" Here how to pass parameter val='Update Phone' to controller/> <apex:commandButton action="{!update}" value="Update Address" Here how to pass parameter val='Update Address' to controller/> <apex:commandButton action="{!update}" value="Update State" Here how to pass parameter val='Update State' to controller/> <apex:commandButton action="{!update}" value="Update City" Here how to pass parameter val='Update City' to controller/>

 

 

And the controller

 

 

public class MyController { Public PageReference Update(string val) { if(val=='Update Phone') { then do this.... } else if(val=='Update Address) { then do this... } } }

 

 

 

Message Edited by mavs on 04-23-2009 11:30 AM
  • April 23, 2009
  • Like
  • 0

I have a custom controller for a visualforce (VF) page, and I want to be able to run a method on that controller multiple times from the VF page with different parameters (method takes multiple parameters), displaying the results of each method call on the VF page (method output is a string).  Sounds simple, but I cannot figure out how to execute an apex method with parameters from VF.  If someone has a solution for this, or perhaps an alternative, please post an outline of how the VF and apex controller code should look.

 

Hi All,

 

I have a requirement that i have to run a report from a visual force page.

I am presently hard coding the report id in the URL.

Can anyone suggest me how to avoid the hard coding and query for the report id.

 

Regards,

Anil

I have created custom case page overriding standard functionality through controller extension

 

and I want to fire assignment rule conditionally

 

my code is here

 **************************************************

public class caseextension
{
private  Case case1;
public boolean assrulevalue;
public caseextension(ApexPages.StandardController stdController)
{
this.case1= (Case)stdController.getRecord();


}
public PageReference save()
{

AssignmentRule assgn=[Select Name, Id From AssignmentRule  where name='Testassign'];
string id=assgn.id;
if(assrulevalue==true)
{
database.DMLOptions dmo = new database.DMLOptions();
dmo.AssignmentRuleHeader.assignmentRuleId=id;
 dmo.AssignmentRuleHeader.useDefaultRule= false;
case1.setOptions(dmo);
   //mailerror('testing');
}
//mailerror('testing'+id);

 insert case1;
//database.insert(case1, dmo);
PageReference pageRef = new PageReference('/' + case1.id);
pageRef.setRedirect(true);
return pageRef;

}

public boolean getassrule()
{
    return assrulevalue;
}
public void setassrule(boolean value)
{
    assrulevalue=value;
}

**********************************************************

 

So what wrong with this code.

I've got two fields side by side, both picklists.  One is a regular Salesforce picklist field, the second is a picklist I'm explicitly tagging so that I can restrict further the values that will eventually be placed in the underlying field on this particular page.

 

I want them to behave exactly the same:  both have a title, both be required, both default to "-None-" option (which errors when left on -None-).  All of this happens with the first field, and none of it with the second: no title, no red mark for required, no enforcement of the required propertly.

 

I've put this:

 

<apex: pageBlockSection id="Section1" columns="2">

 

  <apex:inputField value="{!PSCase.Route_To__c}" required="true"/>

 

 

  <apex:selectList size="1" title="Setup Type" value="{!PSCase.Reason}" required="true"

     <apex:selectOption itemLabel="-None-"/>

     <apex:selectOption itemValue="Trial Setup" itemLabel="Trial"/>

     <apex:selectOption itemValue="Subscription Setup" itemLabel="Subscription"/>

  </apex:selectList>

 

</apex: pageBlockSection>

Message Edited by RDN_LHR on 02-26-2009 05:05 AM

Hi,

I was wondering whether there was any attribute for creating inline editable fields.

I am particulalry looking for the same experience as the standard inline editing option in Salesforce = Doubleclicking on the field allows you to edit it.

 

Nothing found in the documentation.

The StandardSetController (or Database.QueryLocator) ignores the SOQL 'where' clause.

Because QueryLocator can only be used with StandardSetController or in managed sharing recalc, I can't test the it separately to see exactly where the bug lies.

This (simplified) example shows the bug in the StandardSetController context.

I have a custom visualforce page that lists users:

Code:
<apex:page controller="CtlBugPgr" title="Bug">
<apex:form>

<apex:pageBlock title="Users" id="UserList">

<apex:pageBlockTable value="{!data}" var="each">
  <apex:column headerValue="Active?">{!each.IsActive}</apex:column>
  <apex:column headerValue="User">{!each.Name}</apex:column>
  <apex:column headerValue="UserType">{!each.UserType}</apex:column>
</apex:pageBlockTable>

</apex:pageBlock>

</apex:form>
</apex:page>

 The controller for this page uses StandardSetController:

Code:
public class CtlBugPgr {

  //-------------------------------------------------------------------------------
  // User List
  //-------------------------------------------------------------------------------
  public User[] data { get { return (List<User>)pgr.getRecords(); } set; }

  public ApexPages.StandardSetController pgr {
    get {
      if (pgr == null) pgr = initPager();
      return pgr;
      }
    set;
    }
  
  //-------------------------------------------------------------------------------
  // privates
  //-------------------------------------------------------------------------------
  private ApexPages.StandardSetController initPager() {
    ApexPages.StandardSetController ret = new ApexPages.StandardSetController(Database.getQueryLocator(
[select Name, UserType, IsActive from User where IsActive = true and UserType = 'Standard']
));
ret.setPageSize(10); // UPDATED: necessary to reproduce bug!
return ret;
} }

 
Note the two conditions in the where clause of the SOQL.

If I run the query directly via "executeAnonymous" I get what I expect:

Code:
> System.debug([select Name, IsActive, UserType from User where IsActive = true and UserType = 'Standard']);

20081125225927.981:AnonymousBlock.i: line 1, column 1: ( User:{UserType=Standard, IsActive=true, Name=John Hart, Id=...})

 
However, in the visualforce page, all Users are returned:






Message Edited by jhart on 11-26-2008 03:25 PM
  • November 25, 2008
  • Like
  • 0
If i want to deploy Apex classes in a particular order, do i need to write several targets and deploy each one in order?  I ask because when i had all classes in the same deployment target it seemed to try and deploy them in alphabetical order even though i had them listed in a particular order...
  • July 14, 2008
  • Like
  • 0

I want to remind task owner (through e-mail) 2 days before a task is due.
I want to send them another e-mail when the task becomes due (on due date).
Finally I want to send them yet another e-mail if task is overdue by more than 2 days.

Workflow rules on tasks do NOT allow creation of e-mail alerts.

How do I do this?

Salesforce has "Reminder popups" - but this works only if the user logs into the app!






Hi:

I am getting this error, build.xml:20: Request timed out, check max poll and poll wait millis attributes

I looked through the ant-salesforce.jar file and never found an xml file with these attributes.

Where can I set these?

Thank you.
  • June 09, 2008
  • Like
  • 0