• Lightning User
  • NEWBIE
  • 10 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 22
    Replies

Hi,

   Is there a way to not render a component if there is something in the apex:messages? Thanks.

Hi,

   I'm getting this error with this VF page :

ErrorError: Could not resolve the entity from <apex:outputField> value binding '{!Task[f]}'. outputField can only be used with SObject fields.

 

Can anyone help please? Thanks

 

<apex:page standardController="Task" showHeader="false">
    <apex:form >
      <apex:pageBlock title="New Task" mode="edit">
          <apex:pageBlockButtons location="top">
             <!-- <apex:commandButton onClick="{javascript&colon;window.close()}" value="Close this window"/> -->
             <apex:commandButton value="Save" action="{!save}"/>
          </apex:pageBlockButtons>
          <apex:pageBlockSection columns="2">
           <apex:repeat value="{!$ObjectType.Task.FieldSets.TaskNote_CTask}" var="f">
                <apex:outputField value="{!Task[f]}"/>      
           </apex:repeat>
          </apex:pageBlockSection>
      </apex:pageBlock>

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

Hi, I'm making a test Apex class that checks against the current user profile. The problem is that there won't be enough code coverage if the user running the test is a system administrator. Is it possible to write apex code in the test class that logs in as a different user for the test, and it's still possible to run the test as a system administrator? Please help, thanks.

Hi,

   I'm trying to get a field from a parent record named SSOEnabled. if it's true I want to show the password field to be edited. The parent record does have the field SSOEnabled as true. The problem is it's not showing it when I try it out? But if i do a test on a field from the current record it'll work.  Anyone know why? Thanks. :smileyhappy:

 

<apex:page standardController="EAST_SSOCredential__c" title="SSO Credential Edit: New SSO Credential">
<apex:sectionHeader title="SSO Credential Edit" subtitle="New SSO Credential"/>
<apex:form >
<apex:pageBlock title="SSO Credential Edit" id="thePageBlock" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:actionRegion >
<apex:pageBlockSection title="Information" columns="1">
<apex:inputField value="{!EAST_SSOCredential__c.Name}" required="true"/>
<apex:inputField value="{!EAST_SSOCredential__c.Website__c}">
<apex:actionSupport event="onchange" rerender="thePageBlock"/>
</apex:inputField>
<apex:inputField value="{!EAST_SSOCredential__c.Contact__c}"/>
<apex:inputField value="{!EAST_SSOCredential__c.UserID__c}"/>
<apex:inputField value="{!EAST_SSOCredential__c.Password__c}"
rendered="{!EAST_SSOCredential__c.website__r.SSOEnabled__c}"/>
</apex:pageBlockSection>
</apex:actionRegion>

</apex:pageBlock>
</apex:form>

</apex:page>
<apex:page standardController="EAST_SSOCredential__c" title="SSO Credential Edit: New SSO Credential">
<apex:sectionHeader title="SSO Credential Edit" subtitle="New SSO Credential"/>
<apex:form >
<apex:pageBlock title="SSO Credential Edit" id="thePageBlock" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:actionRegion >
<apex:pageBlockSection title="Information" columns="1">
<apex:inputField value="{!EAST_SSOCredential__c.Name}" required="true"/>
<apex:inputField value="{!EAST_SSOCredential__c.Website__c}">
<apex:actionSupport event="onchange" rerender="thePageBlock"/>
</apex:inputField>
<apex:inputField value="{!EAST_SSOCredential__c.Contact__c}"/>
<apex:inputField value="{!EAST_SSOCredential__c.UserID__c}"/>
<apex:inputField value="{!EAST_SSOCredential__c.Password__c}"
rendered="{!EAST_SSOCredential__c.website__r.SSOEnabled__c}"/>
</apex:pageBlockSection>
</apex:actionRegion>

</apex:pageBlock>
</apex:form>

</apex:page>

Hi all,

   This one puzzles me..plain and simple, the code works but I'm getting null for UserInfo.getSessionId(). Someone tell me why?! :robotmad: Thanks. 

public class AccountUpdater {

//Future annotation to mark the method as async.
@Future(callout=true)
public static void updateAccount(String id, String name) {

//construct an HTTP request
HttpRequest req = new HttpRequest();
User currentUser = [select ServerURL__c from User where id = :UserInfo.getUserId()];
req.setEndpoint('https://example.com/dbaccess/connect.php?sessionid=' + UserInfo.getSessionId() +
'&serverurl=' + currentUser.ServerURL__c + '&module=test&id=' + id);
req.setMethod('GET');

//send the request
Http http = new Http();
HttpResponse res = http.send(req);

//check the response
if (res.getStatusCode() == 200) {
//update account
Account acc = new Account(Id=id);
acc.Description = res.getBody();
update acc;
} else {
System.debug('Callout failed: ' + res);
}
}
}

 

 

Is there an equivalent of  $Api.Enterprise_Server_URL_111 in an Apex Class? To get the session Id, I need UserInfo.getsessionid(), but is the only way to get the URL by setting it as a formula field somewhere and retrieve it? I can't see any other way...
Hi, I was waiting for the API 13.0 support from the PHP toolkit, but I still can't query from ApexPage. I can understand it not working in 11.0 because ApexPage is not an object for that API, but it should work with API 13 support. What's going on?
Hi, is there a way to not have a slice named other for the pie chart, and instead list all possible values? Thanks.
Hi, I'd like to know what object in the database a VF page is associated with, so I can programmatically add new VF pages and inject the code for them. Thanks.
Pretty self explanatory...I want to make a button that closes the visualforce page...and no, window.close() doesn't work :robotmad:
    Ok so I made this checkStatus function:

Code:
private static void checkStatus(MetadataBindingStub metaBinding,
   AsyncResult[] ars) throws RemoteException {
  ArrayList<String> idList = new ArrayList<String>();
  for (int i = 0; i < ars.length; i++) {
   idList.add(ars[i].getId());
  }
  String [] Ids = (String[])idList.toArray(new String[idList.size()]);
  for (int i = 0; i < ars.length; i++) {
   while (!ars[i].isDone()) {
        ars = metaBinding.checkStatus(Ids);
        System.out.println("Status: " + ars[i].getId() + ": "+ ars[i].getState().toString());
        if (ars[i].getState().toString().equals("Error")) {
         System.out.println(ars[i].getMessage());
         break;
        }
       }
  }
 }

 
What I'd like to do is instead of printing the Id, print the fullname of the Field or Object with that Id. Is it possible? What part of the api would I use? Also, I notice it doesn't show the status of every component I use in the Metadata array. Would it be possible to show the status of every component?


Message Edited by Gillberg on 05-27-2008 01:27 PM
Hi, I'm getting this error (Cannot create child objects through metadata create / update. The CustomField must named 'MyObject__c.MyField1__c' be created separately) when creating an object in salesforce. Anyone have an idea what the problem is?

Code:
<—php
header('P3P: CP=IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT');  
require_once ('soapclient/SforcePartnerClient.php');
require_once ('soapclient/SforceHeaderOptions.php');
require_once ('soapclient/SforceMetadataClient.php'); 
echo "Begin Test Setup\r\n";
try {
  // Create the fixtures.
  
  $mySforceConnection = new SforcePartnerClient();
  $mySoapClient = $mySforceConnection->createConnection('soapclient/partner.wsdl.xml');
  $loginResult = $mySforceConnection->login('username', 'password');
  
  $myMetadataConnection = new SforceMetadataClient('soapclient/metadata.wsdl.xml', $loginResult, $mySforceConnection);
  
  $customObject = new SforceCustomObject();
  $customObject->fullName = 'MyObject__c';
  $customObject->deploymentStatus = DEPLOYMENT_STATUS_DEPLOYED;
  $customObject->setDescription("A description");
  $customObject->setEnableActivities(true);
  $customObject->setEnableDivisions(false);
  $customObject->setEnableHistory(true);
  $customObject->setEnableReports(true);
  $customObject->setHousehold(false);
  $customObject->setLabel("My Custom Obj from PHP");
  
  $customField1 = new SforceCustomField();
  $customField1->setFullName('MyCustomField__c');
  $customField1->setDescription('Description of New Field');
  $customField1->setLabel('My Custom Field Label');
  $customField1->setType('Text');
  
  $customField = new SforceCustomField();
  $customField->setFullName('MyObject__c.MyField1__c');
  $customField->setDescription('Test Picklist');
  $customField->setLabel('Pij');
  $customField->setLength(15);
  $customField->setType('Text');
  $customField2 = new SforceCustomField();
  $customField2->setFullName('MyObject__c.MyField2__c');
  $customField2->setDescription('Test Picklist');
  $customField2->setLength(15);
  $customField2->setLabel('Pif');
  $customField2->setType('Text');
                       
  $customObject->nameField = $customField1;
  
  $customObject->pluralLabel = 'My Custom Objs from PHP';
  $customObject->sharingModel = SHARING_MODEL_READWRITE;
  $array = array ($customField, $customField2);
  
  $customObject->setFields($array);

  print_r($myMetadataConnection->create($customObject));
  
} catch (Exception $e) {
  echo $myMetadataConnection->getLastRequest();
  echo $e->faultstring;
}
–>

Hi,

   Is there a way to not render a component if there is something in the apex:messages? Thanks.

Hi,

   I'm getting this error with this VF page :

ErrorError: Could not resolve the entity from <apex:outputField> value binding '{!Task[f]}'. outputField can only be used with SObject fields.

 

Can anyone help please? Thanks

 

<apex:page standardController="Task" showHeader="false">
    <apex:form >
      <apex:pageBlock title="New Task" mode="edit">
          <apex:pageBlockButtons location="top">
             <!-- <apex:commandButton onClick="{javascript&colon;window.close()}" value="Close this window"/> -->
             <apex:commandButton value="Save" action="{!save}"/>
          </apex:pageBlockButtons>
          <apex:pageBlockSection columns="2">
           <apex:repeat value="{!$ObjectType.Task.FieldSets.TaskNote_CTask}" var="f">
                <apex:outputField value="{!Task[f]}"/>      
           </apex:repeat>
          </apex:pageBlockSection>
      </apex:pageBlock>

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

Hi, I'm making a test Apex class that checks against the current user profile. The problem is that there won't be enough code coverage if the user running the test is a system administrator. Is it possible to write apex code in the test class that logs in as a different user for the test, and it's still possible to run the test as a system administrator? Please help, thanks.

Hi,

   I'm trying to get a field from a parent record named SSOEnabled. if it's true I want to show the password field to be edited. The parent record does have the field SSOEnabled as true. The problem is it's not showing it when I try it out? But if i do a test on a field from the current record it'll work.  Anyone know why? Thanks. :smileyhappy:

 

<apex:page standardController="EAST_SSOCredential__c" title="SSO Credential Edit: New SSO Credential">
<apex:sectionHeader title="SSO Credential Edit" subtitle="New SSO Credential"/>
<apex:form >
<apex:pageBlock title="SSO Credential Edit" id="thePageBlock" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:actionRegion >
<apex:pageBlockSection title="Information" columns="1">
<apex:inputField value="{!EAST_SSOCredential__c.Name}" required="true"/>
<apex:inputField value="{!EAST_SSOCredential__c.Website__c}">
<apex:actionSupport event="onchange" rerender="thePageBlock"/>
</apex:inputField>
<apex:inputField value="{!EAST_SSOCredential__c.Contact__c}"/>
<apex:inputField value="{!EAST_SSOCredential__c.UserID__c}"/>
<apex:inputField value="{!EAST_SSOCredential__c.Password__c}"
rendered="{!EAST_SSOCredential__c.website__r.SSOEnabled__c}"/>
</apex:pageBlockSection>
</apex:actionRegion>

</apex:pageBlock>
</apex:form>

</apex:page>
<apex:page standardController="EAST_SSOCredential__c" title="SSO Credential Edit: New SSO Credential">
<apex:sectionHeader title="SSO Credential Edit" subtitle="New SSO Credential"/>
<apex:form >
<apex:pageBlock title="SSO Credential Edit" id="thePageBlock" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:actionRegion >
<apex:pageBlockSection title="Information" columns="1">
<apex:inputField value="{!EAST_SSOCredential__c.Name}" required="true"/>
<apex:inputField value="{!EAST_SSOCredential__c.Website__c}">
<apex:actionSupport event="onchange" rerender="thePageBlock"/>
</apex:inputField>
<apex:inputField value="{!EAST_SSOCredential__c.Contact__c}"/>
<apex:inputField value="{!EAST_SSOCredential__c.UserID__c}"/>
<apex:inputField value="{!EAST_SSOCredential__c.Password__c}"
rendered="{!EAST_SSOCredential__c.website__r.SSOEnabled__c}"/>
</apex:pageBlockSection>
</apex:actionRegion>

</apex:pageBlock>
</apex:form>

</apex:page>

We have a Batch Apex job class defined in our certified managed package.

 

It works in our dev org (no namespace), but when we deploy the code to the dev org WITH namespace or

install the package in a customer org, it does not. We have "Apex Notification Recipient" set and get all other error emails, but not this one.

 

Is there anything that must be set before we can execute a batch job in our package? User permissions, package permission or enable this in the org ?

 

Thanks.

Hi all,

   This one puzzles me..plain and simple, the code works but I'm getting null for UserInfo.getSessionId(). Someone tell me why?! :robotmad: Thanks. 

public class AccountUpdater {

//Future annotation to mark the method as async.
@Future(callout=true)
public static void updateAccount(String id, String name) {

//construct an HTTP request
HttpRequest req = new HttpRequest();
User currentUser = [select ServerURL__c from User where id = :UserInfo.getUserId()];
req.setEndpoint('https://example.com/dbaccess/connect.php?sessionid=' + UserInfo.getSessionId() +
'&serverurl=' + currentUser.ServerURL__c + '&module=test&id=' + id);
req.setMethod('GET');

//send the request
Http http = new Http();
HttpResponse res = http.send(req);

//check the response
if (res.getStatusCode() == 200) {
//update account
Account acc = new Account(Id=id);
acc.Description = res.getBody();
update acc;
} else {
System.debug('Callout failed: ' + res);
}
}
}

 

 

Hi, I was waiting for the API 13.0 support from the PHP toolkit, but I still can't query from ApexPage. I can understand it not working in 11.0 because ApexPage is not an object for that API, but it should work with API 13 support. What's going on?
Hi, I'd like to know what object in the database a VF page is associated with, so I can programmatically add new VF pages and inject the code for them. Thanks.
Pretty self explanatory...I want to make a button that closes the visualforce page...and no, window.close() doesn't work :robotmad:
Hi, I'm getting this error (Cannot create child objects through metadata create / update. The CustomField must named 'MyObject__c.MyField1__c' be created separately) when creating an object in salesforce. Anyone have an idea what the problem is?

Code:
<—php
header('P3P: CP=IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT');  
require_once ('soapclient/SforcePartnerClient.php');
require_once ('soapclient/SforceHeaderOptions.php');
require_once ('soapclient/SforceMetadataClient.php'); 
echo "Begin Test Setup\r\n";
try {
  // Create the fixtures.
  
  $mySforceConnection = new SforcePartnerClient();
  $mySoapClient = $mySforceConnection->createConnection('soapclient/partner.wsdl.xml');
  $loginResult = $mySforceConnection->login('username', 'password');
  
  $myMetadataConnection = new SforceMetadataClient('soapclient/metadata.wsdl.xml', $loginResult, $mySforceConnection);
  
  $customObject = new SforceCustomObject();
  $customObject->fullName = 'MyObject__c';
  $customObject->deploymentStatus = DEPLOYMENT_STATUS_DEPLOYED;
  $customObject->setDescription("A description");
  $customObject->setEnableActivities(true);
  $customObject->setEnableDivisions(false);
  $customObject->setEnableHistory(true);
  $customObject->setEnableReports(true);
  $customObject->setHousehold(false);
  $customObject->setLabel("My Custom Obj from PHP");
  
  $customField1 = new SforceCustomField();
  $customField1->setFullName('MyCustomField__c');
  $customField1->setDescription('Description of New Field');
  $customField1->setLabel('My Custom Field Label');
  $customField1->setType('Text');
  
  $customField = new SforceCustomField();
  $customField->setFullName('MyObject__c.MyField1__c');
  $customField->setDescription('Test Picklist');
  $customField->setLabel('Pij');
  $customField->setLength(15);
  $customField->setType('Text');
  $customField2 = new SforceCustomField();
  $customField2->setFullName('MyObject__c.MyField2__c');
  $customField2->setDescription('Test Picklist');
  $customField2->setLength(15);
  $customField2->setLabel('Pif');
  $customField2->setType('Text');
                       
  $customObject->nameField = $customField1;
  
  $customObject->pluralLabel = 'My Custom Objs from PHP';
  $customObject->sharingModel = SHARING_MODEL_READWRITE;
  $array = array ($customField, $customField2);
  
  $customObject->setFields($array);

  print_r($myMetadataConnection->create($customObject));
  
} catch (Exception $e) {
  echo $myMetadataConnection->getLastRequest();
  echo $e->faultstring;
}
–>