• Raymond Zhu
  • 0 Points
  • Member since 2012

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 1

Hi All, I am thinking is it possible to use portal user credentials to authenticate to SF SOAP API? If yes, how?


Basically, I have done a bit of research and coding for that, and it seems the answer to this question is no. As to use SOAP API, I need to provide user name and password+security token for the authentication. But the situation for portal users is that there is no such a way to retrieve their security token.


Woule be very appreciated if anyone can confirm my answer or point me to a right way if I am wrong.





I don't know it is possible , but here we goes:

I want to build a form to edit a Standard Object, into a custom visualforce page.

To do that , i get the description of every field (with the getDescribe() and things like this), and i put it on a list.

The apex code:

The class:

 public class AccountEditableField {
  public String label { get; set;}
  public Schema.SObjectField value { get; set; }

The Parser:

 public void accountDescribe(){
  Set <String> fieldKeys = new Set<String>();
  fieldKeys = AccountFieldsDescribe.keySet();
  List <String> editableFieldKeys =  new List<String>();
  String queryFields = '';
  for(String elem:fieldKeys){
   // Get the fields
   Schema.DescribeFieldResult field = (AccountFieldsDescribe.get(elem)).getDescribe();
   //Schema.DescribeFieldResult f = Schema.sObjectType.Account.fields.elem;
   if(field.isAccessible() && field.isUpdateable()){
    queryFields += field.getSObjectField()+', ';    
   System.Debug(' ** \n'+AccountFieldsDescribe.get(elem)+'\n ** \n The field is visible (accesible)—:'+field.isAccessible()+' \n **  \n The field is Updateable–:'+field.isUpdateable());   
  queryFields = queryFields.substring(0,queryFields.length() - 2);
  for(String f:editableFieldKeys){
   AccountEditableField fieldEditable = new AccountEditableField();
   Schema.DescribeFieldResult fieldDescribed = (AccountFieldsDescribe.get(f)).getDescribe();
   fieldEditable.label = fieldDescribed.getLabel();
   fieldEditable.value = fieldDescribed.getSObjectField();


And try to generate the form at at the visualforce page:

 <apex:form id="accountEdition">
   <apex:repeat value="{!listOfFields}" var="field">
    <apex:outputText value="{!field.label}" />
    <apex:inputField value="{!field.value}" />

 When i try to save the page, the error are:

Save error: Could not resolve the entity from <apex:inputField> value binding '{!field.value}'.  inputField can only be used with SObject fields

I know that the code at the apex controller can be simplified but i keep it in that way to make it easy to understand.

Anybody knows a workaround for that problem ?
Another way to build a dynamic form ?

Thanks in advance ;)

Message Edited by Br1 on 11-05-2008 12:15 PM
  • November 05, 2008
  • Like
  • 0