• AltiumForce
  • NEWBIE
  • 75 Points
  • Member since 2007

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 28
    Replies

Hello

 

My requirement is to  displayed a table with two chexbox columns and allow the user to select only one checkbox in each column.

 

The below code is working fine for only one column. first when i select first checkbox in mastercolumn and then select 2nd checkbox in the same mastercolumn then it is automatically deselecting the first and selecting the 2nd using the below code.

 

But when i select any checkbox in the duplicatecolumn then the checkbox selected in the mastercolumn is getting deselected.

 

Does anyone have any idea on how to resolve this issue?..please advise.....Thanks in advance

 

 

   Master

    Duplicate

         Name

          Owner

              

                 

         Acme1

           john

              

                 

         Acme2

           jim

              

                 

          Acme

           john

 

<apex:page tabStyle="Account" controller="Account_controller" action="{!init}">
<script>
var selectedChkbox;
function deSelectOthers(chkBox)
{
if (chkBox.checked)
{
if ((chkBox != selectedChkbox) && (selectedChkbox != null))
{
selectedChkbox.checked = false;
}
selectedChkbox = chkBox;
}
}
</script>
<apex:form >

<apex:pageBlock>
<apex:panelGrid id="AccountDetail" columns="1" width="150%">
<apex:pageBlock id="page1">
<apex:pageBlockButtons location="Bottom">
<apex:commandButton action="{!continue1}" value="Continue"/>
</apex:pageBlockButtons>

<apex:pageBlockSection title="Select Master and Dupe records">
<apex:pageBlockTable value="{!AccountResults}" var="acc" rules="all" width="150%">
<apex:column headerValue="Master">
<apex:outputPanel id="op1">
<apex:inputCheckBox value="{!Mstchk}" id="master_Checkbox" disabled="{!Mstchk}" onclick="deSelectOthers(this)">
</apex:inputCheckBox>
</apex:outputPanel>
<script>
if ("{!Mstchk}" == "true")
{
var idForSelectedBox = "$component.master_Checkbox";
selectedChkbox = document.getElementById(idForSelectedBox);
}

</script>
</apex:column>

<apex:column headerValue="Duplicate">
<apex:outputPanel id="op2">
<apex:inputCheckBox value="{!Dupchk}" id="duplicate_Checkbox" disabled="{!Dupchk}" onclick="deSelectOthers(this)">
</apex:inputCheckBox>
</apex:outputPanel>
<script>
if ("{!Dupchk}" == "true")
{
var idForSelectedBox = "$component.duplicate_Checkbox";
selectedChkbox = document.getElementById(idForSelectedBox);
}
</script>

</apex:column>

<apex:column headerValue="Name" value="{!acc.Name}">
</apex:column>
<apex:column headerValue="Owner" value="{!acc.Owner.Name}">
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>

</apex:pageBlock>
</apex:panelGrid>
</apex:form>
</apex:page>

 

 

public class Account_controller

{
private String searchText;
private Boolean Dupchk;
private Boolean Mstchk;
public string AName;
Id AcctId =ApexPages.currentPage().getparameters().get('id');
public Account acctName;
List<Account> AccountResults=null;

public List<Account> getAccountResults()
{
return AccountResults;
}

public Boolean getDupChk()
{
return Dupchk;
}
public void setDupChk (Boolean Dupchk)
{
this.Dupchk = Dupchk;

}

public Boolean getMstChk()
{
return Mstchk;
}
public void setMstChk (Boolean Mstchk)
{
this.Mstchk = Mstchk;

}


public string getSearchText()
{
return AName;
}
public void setSearchText (String searchText)
{
this.searchText = searchText;
}

public PageReference continue1()
{
return null;
}

public PageReference init()
{
acctName=[Select Name from Account where id=:AcctId];
AName=acctName.Name;
return null;
}

public void search()
{
try
{
AccountResults= (List<Account>)[select Id, Name, Type, BillingStreet,Billingcity,BillingState,BillingPostalCode,Owner.Name from Account where Name like: searchText+'%'];

}
catch (Exception e)
{
AccountResults = (List<Account>)null;
System.Debug('Error in search criteria.');
}
}

public Class AccountResults
{
public Account Acc
{
get;
set;
}
public Boolean selected
{
get;
set;
}
public AccountResults(Account a)
{
Acc=a;
selected=false;
}
}
}

 


 

Message Edited by renuami on 07-17-2009 11:32 AM

I am trying to perform an Apex callout to our .Net webserivce. I would like to use the WSDL2APEX however, the button is not available when I go to Setup | Develop | Apex Classes. Is this only available on certain licenses (our license is currently Platform)? I did not see any documentation stating this. Am I missing something?

 

Worst case, I guess I will use HTTP services.

I would like to query the possible values for a picklist to put up a mutli-select field on my page.  Is there a way to query for the possible values for a simple picklist?

 

Also, I'd like to do the same for a multi-select picklist.  I know this was asked before and it wasn't possible in the past.  Is there any way to do it now?

 

Hi all,

 

I created a .NET app which does a simple SOQL call to Salesforce, works fine in standard .NET 3.5. When I ported it to WM 6.0 smart device app, running on top of compact framework 3.5, it throws a NotImplementedException error.

 

Does anyone have a working C# example for compact framework?

 

Cheers,

Ian

Hi all,

 

 

I am being asked to create a customized SelfService portal using Visualforce page.

 

Visualforce page is not supported in SelfService portal according to this post:

http://salesforce.lithium.com/sforce/board/message?board.id=general_development&message.id=25305  

 

Can anyone give me some ideas?

 

Thanks very much

Ian

Hi,

I am working on an Visualforce page for opportunity object, I need to ask user to select a pricebook for the opportunity.

 

It is straight forward for standard users - just show all active pricebooks, but parter users can only access the pricebooks defined in pricebook sharing.

 

How do I find out what pricebooks the current user can use in Apex code?

 

Thanks,

Ian

   

Has anyone deployed Apex code with Unicode characters successfully in Eclipse?

It seems it's the area no one has touched?

I am writing a small C# app for Apex code deployment, this is because Eclipse with Apex addon seems has problem upload & download unicode characters. 
 
Here is part of my code:
 
Code:
ApexService sfdc = new ApexService();
sfdc.SessionHeaderValue = new SessionHeader();
sfdc.SessionHeaderValue.sessionId = CreateSession(txtUsername.Text, txtPassword.Text).SessionHeaderValue.sessionId;

sfdc.Timeout = 60 * 1000;
sfdc.RequestEncoding = Encoding.UTF8;

CompileClassResult testResult = sfdc.compileClasses(new string[] { txtSourceCode.Lines.ToString() })[0];
if (!testResult.success)
    txtResult.Text += testResult.problem;

When I passed in a simple empty class:  public class TestClass { }, I was getting an error says: unexpected token: System.String
 
Has anyone done this successfully in .NET?
Thanks!

 
 
 
One of my Apex class contains some Unicode characters, it works fine in Eclipse editor.
But when I save/Deploy to Salesforce, all Unicode charaters turned into junks.
I copy & paste these corrupted charaters to a text editor, change encoding toto UTF-8, then they display correctly again.
 
As you know, you can't make changes directly to Apex code on production Salesforce. 
 
Does anyone have a solution for this?
 
Thanks in advance
Now the AJAX Toolkit handles all session management once you log in.

Just curious if I do not call a s-control directly but use it in an URL  (/servlet/servlet.Integration?lid=xxxxx),
how do I set the session id then?

I am getting the error below when calling salefsforce.connection.query:

faultcode:'soapenv:Client', faultstring:'Attribute "xmlns" bound to namespaces "http://www.w3.org/2000/xmlns/" was already specified for element "query"'

Code is simple:Code:
try
{
   var oppRes = sforce.connection.query("SELECT id,Name, Pricebook2Id FROM opportunity WHERE id =     '{!SFDC_520_Quote_Opportunity_ID}'");
}
catch(error)
{
    alert('Error: ' = error) ;
}

 


It seems the same namespace prefix was added twice, and it is done inside connection.js.
This does not happen to all s-controls, I tried but couldn't find the pattern. 

Anyone has a clue? Thanks!


Hi all,

 

 

I am being asked to create a customized SelfService portal using Visualforce page.

 

Visualforce page is not supported in SelfService portal according to this post:

http://salesforce.lithium.com/sforce/board/message?board.id=general_development&message.id=25305  

 

Can anyone give me some ideas?

 

Thanks very much

Ian

Hello

 

My requirement is to  displayed a table with two chexbox columns and allow the user to select only one checkbox in each column.

 

The below code is working fine for only one column. first when i select first checkbox in mastercolumn and then select 2nd checkbox in the same mastercolumn then it is automatically deselecting the first and selecting the 2nd using the below code.

 

But when i select any checkbox in the duplicatecolumn then the checkbox selected in the mastercolumn is getting deselected.

 

Does anyone have any idea on how to resolve this issue?..please advise.....Thanks in advance

 

 

   Master

    Duplicate

         Name

          Owner

              

                 

         Acme1

           john

              

                 

         Acme2

           jim

              

                 

          Acme

           john

 

<apex:page tabStyle="Account" controller="Account_controller" action="{!init}">
<script>
var selectedChkbox;
function deSelectOthers(chkBox)
{
if (chkBox.checked)
{
if ((chkBox != selectedChkbox) && (selectedChkbox != null))
{
selectedChkbox.checked = false;
}
selectedChkbox = chkBox;
}
}
</script>
<apex:form >

<apex:pageBlock>
<apex:panelGrid id="AccountDetail" columns="1" width="150%">
<apex:pageBlock id="page1">
<apex:pageBlockButtons location="Bottom">
<apex:commandButton action="{!continue1}" value="Continue"/>
</apex:pageBlockButtons>

<apex:pageBlockSection title="Select Master and Dupe records">
<apex:pageBlockTable value="{!AccountResults}" var="acc" rules="all" width="150%">
<apex:column headerValue="Master">
<apex:outputPanel id="op1">
<apex:inputCheckBox value="{!Mstchk}" id="master_Checkbox" disabled="{!Mstchk}" onclick="deSelectOthers(this)">
</apex:inputCheckBox>
</apex:outputPanel>
<script>
if ("{!Mstchk}" == "true")
{
var idForSelectedBox = "$component.master_Checkbox";
selectedChkbox = document.getElementById(idForSelectedBox);
}

</script>
</apex:column>

<apex:column headerValue="Duplicate">
<apex:outputPanel id="op2">
<apex:inputCheckBox value="{!Dupchk}" id="duplicate_Checkbox" disabled="{!Dupchk}" onclick="deSelectOthers(this)">
</apex:inputCheckBox>
</apex:outputPanel>
<script>
if ("{!Dupchk}" == "true")
{
var idForSelectedBox = "$component.duplicate_Checkbox";
selectedChkbox = document.getElementById(idForSelectedBox);
}
</script>

</apex:column>

<apex:column headerValue="Name" value="{!acc.Name}">
</apex:column>
<apex:column headerValue="Owner" value="{!acc.Owner.Name}">
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>

</apex:pageBlock>
</apex:panelGrid>
</apex:form>
</apex:page>

 

 

public class Account_controller

{
private String searchText;
private Boolean Dupchk;
private Boolean Mstchk;
public string AName;
Id AcctId =ApexPages.currentPage().getparameters().get('id');
public Account acctName;
List<Account> AccountResults=null;

public List<Account> getAccountResults()
{
return AccountResults;
}

public Boolean getDupChk()
{
return Dupchk;
}
public void setDupChk (Boolean Dupchk)
{
this.Dupchk = Dupchk;

}

public Boolean getMstChk()
{
return Mstchk;
}
public void setMstChk (Boolean Mstchk)
{
this.Mstchk = Mstchk;

}


public string getSearchText()
{
return AName;
}
public void setSearchText (String searchText)
{
this.searchText = searchText;
}

public PageReference continue1()
{
return null;
}

public PageReference init()
{
acctName=[Select Name from Account where id=:AcctId];
AName=acctName.Name;
return null;
}

public void search()
{
try
{
AccountResults= (List<Account>)[select Id, Name, Type, BillingStreet,Billingcity,BillingState,BillingPostalCode,Owner.Name from Account where Name like: searchText+'%'];

}
catch (Exception e)
{
AccountResults = (List<Account>)null;
System.Debug('Error in search criteria.');
}
}

public Class AccountResults
{
public Account Acc
{
get;
set;
}
public Boolean selected
{
get;
set;
}
public AccountResults(Account a)
{
Acc=a;
selected=false;
}
}
}

 


 

Message Edited by renuami on 07-17-2009 11:32 AM

Hello all.

 

I'm rather new to posting on the Discussion Boards, but I have found them extremely useful in cutting my teeth on force.com development.  Big thanks to everyone who has helped me out so far...

 

I have a general question about future methods (ie Callouts):

 

I have a trigger in my sandbox that calls a method which calls out to a webservice I'm hosting.  This was working great yesterday.  The calls were almost instantaneous.  This morning I start testing again, and I get the following error:

 

 

Failed to invoke future method 'public static void makeCallout(String)' Debug Log: System.CalloutException: Read timed out

 

 

Afterwards, everytime I called the method from my trigger, nothing would happen.  No error messages, no activity on my web service, nothing.  I even put some System.Debug lines in my method, and they never show up in the System Log.  Also, I have in no way reached the 200 per licence per 24 hours limit.  In addition, my web service is working great.  I can call it using a SOAPUI client.

 

I did notice in the Montoring section under Apex jobs, that there is a record for every single attempt I made today, showing Job type as Future, Status Completed and Errors 0.  So it appears that the method is getting called, but not being processed.  Is it possible that the sandbox is queuing these up for some reason today?  Can anyone point me in the right direction?

 

Thanks in advance!!!

 

Arnold

I am trying to perform an Apex callout to our .Net webserivce. I would like to use the WSDL2APEX however, the button is not available when I go to Setup | Develop | Apex Classes. Is this only available on certain licenses (our license is currently Platform)? I did not see any documentation stating this. Am I missing something?

 

Worst case, I guess I will use HTTP services.

Hi,

I am working on an Visualforce page for opportunity object, I need to ask user to select a pricebook for the opportunity.

 

It is straight forward for standard users - just show all active pricebooks, but parter users can only access the pricebooks defined in pricebook sharing.

 

How do I find out what pricebooks the current user can use in Apex code?

 

Thanks,

Ian

   

I would like to query the possible values for a picklist to put up a mutli-select field on my page.  Is there a way to query for the possible values for a simple picklist?

 

Also, I'd like to do the same for a multi-select picklist.  I know this was asked before and it wasn't possible in the past.  Is there any way to do it now?

 

Hi,

 

i want to make a two dimesional array in apex.  Lists or Maps are not suitable for my purpose. How can I do that?

 

Thanks

  • March 23, 2009
  • Like
  • 0

When rendering a page as a PDF the filename of the PDF is the name of the page which is not a good thing. The problem with this is that the name is not unique and can cause confusion with the user.

 

I'm working on a quoting app that renders a quote as a PDF. Some broswers open the PDF embed, others automatically launch your PDF reader, and some prompt you to save or open. The problem is that if opened or saved theses files are all saved as qoute.pdf, qoute[1].pdf, quote[2].pdf, quote[3].pdf. The problem should be obvious.

 

Ideally you should be able to define the name of the generated PDF but I haven't figured out how to do this.

 

Thanks,

Jason

  • February 25, 2009
  • Like
  • 1
Am sure this is something silly...
 
I delete a contact & run the following SOQL but get no results - I have read access on that Contact.
 
Code:
SELECT Id, isDeleted FROM Contact WHERE isDeleted = true

Any clues?
Hello,

I have a VF page associated with a controller extension with the "cancel" method, using PageReference. When I call the cancel method in the VF page, it works well.

However, I get an error message "you must enter a value" when I click on the Cancel button, because some fields on the page are required. If I fill in those fields, I can then cancel without problems.

Does anybody have any idea how to work around that?

Thanks a lot

Has anyone deployed Apex code with Unicode characters successfully in Eclipse?

It seems it's the area no one has touched?

I am writing a small C# app for Apex code deployment, this is because Eclipse with Apex addon seems has problem upload & download unicode characters. 
 
Here is part of my code:
 
Code:
ApexService sfdc = new ApexService();
sfdc.SessionHeaderValue = new SessionHeader();
sfdc.SessionHeaderValue.sessionId = CreateSession(txtUsername.Text, txtPassword.Text).SessionHeaderValue.sessionId;

sfdc.Timeout = 60 * 1000;
sfdc.RequestEncoding = Encoding.UTF8;

CompileClassResult testResult = sfdc.compileClasses(new string[] { txtSourceCode.Lines.ToString() })[0];
if (!testResult.success)
    txtResult.Text += testResult.problem;

When I passed in a simple empty class:  public class TestClass { }, I was getting an error says: unexpected token: System.String
 
Has anyone done this successfully in .NET?
Thanks!

 
 
 
Not sure if this is a bug or my error, I of course assume the latter until proven guilty.

I've got an apex class I'm building in eclipse.  Not much going on yet, here's what it looks like so far:

Code:
Public Class CampaignMemberStat{

 Public Static string GetRespondedStatus (Id campId) {
 
 // for a given campaign, look up the 'default' status to use for Responded
 
  CampaignMemberStatus[] cStatus = [Select c.Label, c.IsDefault From CampaignMemberStatus c WHERE c.CampaignId = :campId ORDER BY c.HasResponded desc, c.IsDefault desc]; 

 }

}
When I attempt to compile this, i get an error "Illegal assignment from LIST:SOBJECT:CampaignMemberStatus to LIST:CampaignMemberStatus" on the line w/ the SOQL.  I've checked and don't see anything wrong w/ my syntax.  It's also true that:
 

* the SOQL query works in testing if I replace the variable w/ an Id
* the line as written seems to compile if pasted into a trigger (not a class)
* the class as written compiles if I chg the line into a query on another object (like Contact) instead of CampaignMemberStatus

Is there some restriction to using CampaignMemberStatus in a class?  Or did I just screw up somewhere?

Thanks!
  • October 01, 2007
  • Like
  • 0
Hi,

I tried one standard query from Apex Web Services API Developer's Guide topic Relationship Queries
======
SELECT Contact.FirstName, Contact.Account.Name from Contact
======
and I received an error: "SOQL statements  can't query related data"

When I try to create querues using just only one object/table it works fine, but when there are more than one - it fails.

As I understand sample queries (from RTFM) with predefined objects/tables should work fine.

What the problem is?

Thanks a lot in advance.
  • September 18, 2007
  • Like
  • 0