• VHanson1
  • NEWBIE
  • 10 Points
  • Member since 2013

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

I have a webservice setup in my salesforce instance that is called CheckUserPermissions(String param1, String param2).  I am able to use the PHP code below to successfully login and execute the command.  HOWEVER, I am only able to pass the first parameter to the method -- the second parameter doesn't seem to come through.

 

I've verified that the param1 value comes through successfully, but param2 is always NULL.

 

PHP CODE:

  $sessionID = $mySforceConnection->getSessionId();
 
                $value1 = 'value1';
                $value2 = "value2";
 
 
 
                $wsdl="soapclient/ContractMgtUtils.wsdl.xml";
                $NAMESPACE = "http://soap.sforce.com/schemas/class/ContractMgtUtils";
 
    $sforce_header = new SoapHeader($NAMESPACE, "SessionHeader",
                        array("sessionId" => $sessionID, "param1" => $value1, "param2" => $value2));
    $client = new soapclient($wsdl);
    $client->__setSoapHeaders(array($sforce_header));
 
  //           $client->
                
 
    try {
                   $response =  $client->CheckUserPermissions();
                  
                echo $response->result;
//        print_r($response);   
    }
    catch(Exception $e) {
        print "<pre>";
        print_r($e);
        exit;
    }

 

Hey everyone,
I am having trouble with a select-box. This problem only occurs on iPhones, not on Android. I am using bootstrap-sf1.
So I have a select-box:
<apex:actionFunction name="filtertime" status="statusfilter" reRender="inadvance" action="{!queryHolidays}">
    <apex:param value="" name="timefilter" assignTo="{!InAdvanceTo}" />
    <apex:param value="true" name="queryinadvance" assignTo="{!QueryDataInAdvance}" />
</apex:actionFunction>

<select id="selectfiltertime" class="form-control" onchange="filtertime(this.options[this.selectedIndex].value);">
    <apex:repeat value="{!InAdvanceToValues}" var="fil">
	<option value="{!fil.Value}">{!fil.Label}</option>
    </apex:repeat>
</select>

Depending where I put this select-box, when I press it on my iPhone, the screen jumps to the top of my page and closes the select-box dialog to pick the values.
If the select-box is below this:
<div class="panel panel-info">
    <div class="panel-heading">Today</div>
    <div class="panel-body">
        "Some content"
    </div>
</div>
then the problem occurs. If I put my select-box above this, there is no problem.
The "Some content" is an outputpanel and within three repeats.

So this works:
.......

<select id="selectfiltertime" class="form-control" onchange="filtertime(this.options[this.selectedIndex].value);">
    <apex:repeat value="{!InAdvanceToValues}" var="fil">
        <option value="{!fil.Value}">{!fil.Label}</option>
    </apex:repeat>
</select>

<div class="panel panel-info">
    <div class="panel-heading">Today</div>
    <div class="panel-body">
        <apex:outputpanel id="now">
            <apex:outputpanel id="ooo1" rendered="{!HasDataNow}">
                <h3>Out Of Office</h3>
            </apex:outputpanel>
            <apex:repeat value="{!DataNow}" var="item">
                <div class="well well-sm">
                    <div class="media">
                        <img width="48px" height="48px" src="{!item.PhotoURL}" class="pull-left" />
                        <div class="media-body">
                            <apex:outpupanel>

                            .......

                            </apex:outputpanel>

                            .......

                        </div>

                        .......

                    </div>
                </div>
            </apex:repeat>

            .......

        </apex:outputpanel>
    </div>
</div>

.......
And this doesn't:
.......

<div class="panel panel-info">
    <div class="panel-heading">Today</div>
    <div class="panel-body">
        <apex:outputpanel id="now">
            <apex:outputpanel id="ooo1" rendered="{!HasDataNow}">
                <h3>Out Of Office</h3>
            </apex:outputpanel>
            <apex:repeat value="{!DataNow}" var="item">
                <div class="well well-sm">
                    <div class="media">
                        <img width="48px" height="48px" src="{!item.PhotoURL}" class="pull-left" />
                        <div class="media-body">
                            <apex:outpupanel>

                            .......

                            </apex:outputpanel>

                            .......

                        </div>

                        .......

                    </div>
                </div>
            </apex:repeat>

            .......

        </apex:outputpanel>
    </div>
</div>

<select id="selectfiltertime" class="form-control" onchange="filtertime(this.options[this.selectedIndex].value);">
    <apex:repeat value="{!InAdvanceToValues}" var="fil">
        <option value="{!fil.Value}">{!fil.Label}</option>
    </apex:repeat>
</select>

.......

I don't know how else to describe this problem.
Do you need more code?

Best regards,
Florian

I am getting an error an just want to render the current choose task comments. Here is my code

 

public class TaskController{
   
    public Task tsk{get;set;}
    public TaskController(){     
        tsk=[select Id, Description from Task where Id = :ApexPages.currentPage().getParameters().get('id') limit 1];
        tsk.Description=tsk.Description.replace('\n','<br/>');      
    }  
}

 

<apex:page controller="TaskController" showHeader="false" renderAs="PDF">
    <div align="center" width="550px">
        <h1>Current Email</h1>
    </div>   
    <div align="left" width="550px">
         <apex:outputtext escape="false" value="{!tsk.Description}"></apex:outputtext>       
           </div>         
</apex:page>

 

When I selected just the description it gave me the first item in the list.

  • September 17, 2013
  • Like
  • 0

A vendor created the APEX class, and also a monitor option for errors...great in theory, except i am not sure what the error means or what i need to do to fix it.

 

Here is the ERROR:

Visualforce Page: /apex/CTIScreenPop

 

 

 

caused by: System.NullPointerException: Attempt to de-reference a null object

 

Class.CTIScreenPopCtlr.initConfirmContactInformation: line 25, column 1

 

 

Here is the APEX Class:

public with sharing class CTIScreenPopCtlr {   
      public PHSSModel.ConstituentDetail constituentDetail {get; set;}
    public Contact confirmContactProxy {get; set;}
    public String phone { get; set; }
    public String formattedPhone {get; set;}
    public PHSSModel.ConstituentSearchCriteria constituentSearchForm {get; set;}
    public PHSSModel.ConstituentSearchResultWrapper constituentSearchResultsWrapper {get; set;}   
    public List<PHSSModel.ConstituentSearchResult> constituentSearchResults {get; set;}
    public PHSSIntegrationService phssIntegrationService {get; set;}
      public Contact qcContactProxy {get; set;}
    public String pageTitle {get; set;}
    public String selectedConstituentId {get; set;}
    public String selectedContactId {get; set;}
    public String selectedManagedLearningFlag {get; set;}
    public Boolean showPhoneIcon {get; set;}
    
      public void initConfirmContactInformation() {
            confirmContactProxy = new Contact();
            try{
            constituentDetail = phssIntegrationService.doConstituentDetails( selectedConstituentId );   
            }catch(Exception e){
                  ExLog.log(e);  // catch Exception Vinayak
            }
                   
        confirmContactProxy.firstName = constituentDetail.FirstName;    
        confirmContactProxy.lastName = constituentDetail.LastName;    
        confirmContactProxy.mailingStreet = constituentDetail.ARCBestAddressLine1;    
        confirmContactProxy.mailingCity = constituentDetail.ARCBestCity;    
        confirmContactProxy.mailingState = constituentDetail.ARCBestState ;    
        confirmContactProxy.mailingPostalCode = constituentDetail.ARCBestZip ;    
        confirmContactProxy.email = constituentDetail.ARCBestEmailAddress;
        confirmContactProxy.phone = constituentDetail.ARCBestPhone;       
      }
     
      public PageReference Confirm() {
            Account newAccount = new Account();
            Contact newContact = new Contact();
            newAccount.name = confirmContactProxy.LastName;
      newAccount.billingStreet = confirmContactProxy.MailingStreet;
      newAccount.billingCity = confirmContactProxy.MailingCity;
      newAccount.billingState = confirmContactProxy.MailingState;
      newAccount.billingPostalCode = confirmContactProxy.MailingPostalCode;
            Savepoint sp = Database.setSavePoint();
      try {
            Insert newAccount;
      } catch (Exception ex) {
            ApexPages.addMessages(ex);
            ExLog.log(ex); //  catch Exception Vinayak
             return null;
            }
     
       // get the auto generated account number
        Account accountJustCreated = [SELECT id,
                                                      Name,
                                                            Account_Auto_Number__c
                                                      FROM Account
                                                      WHERE id = :newAccount.id
                                                      LIMIT 1];
        accountJustCreated.name = AccountService.constructAccountName( confirmContactProxy.lastName, accountJustCreated.Account_Auto_Number__c );
        update accountJustCreated;
            newContact.Master_Constituent_ID__c = constituentDetail.ConstituentId;
      newContact.firstName = confirmContactProxy.FirstName;
      newContact.lastName = confirmContactProxy.LastName;
      newContact.email = confirmContactProxy.email;
      newContact.phone = confirmContactProxy.Phone;
      newContact.mailingStreet = confirmContactProxy.mailingStreet;
      newContact.mailingCity = confirmContactProxy.mailingCity;
      newContact.mailingState = confirmContactProxy.mailingState;
      newContact.mailingPostalCode = confirmContactProxy.mailingPostalCode;
            newContact.email = confirmContactProxy.email;
            newContact.title = constituentDetail.Title ;   
            newContact.Saba_Person_Id__c = constituentDetail.SabaPersonId.left(20) ;
            if (constituentDetail.InstructorFlag == 'Yes') {
                  newContact.Contact_Type__c = 'Instructor';
            }    
      newContact.AccountId = newAccount.id;
      try {
            Insert newContact;
      } catch(Exception ex) {
                  ApexPages.addMessages(ex);  
                  ExLog.log(ex); //  catch Exception Vinayak
                  return null; 
            }
        PageReference pageRef = new PageReference('/' + newContact.id);
        return pageRef;
      }
     
      public pageReference cancelConfirmContactInformation() {
            PageReference pageRef = Page.CTIScreenPop;           
            return pageRef;  
      }
     
    public PageReference searchForPhone() {    
     
      try{
               if (phone != '' && phone != null ) {     
                  constituentSearchResultsWrapper = phssIntegrationService.doPhoneSearch( formattedPhone );
                  if (constituentSearchResultsWrapper != null) {
                      constituentSearchResults = constituentSearchResultsWrapper.constituentSearchResults;              
                  } else {
                        ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'No matching customers were found...');
                        ApexPages.addMessage(msg);
                  }
              }
      }catch(Exception e){
            ExLog.log(e); //  catch Exception Vinayak
      }
        return null;
    }
   
    public PageReference searchForConstituent() {      
            // clear out old results
      constituentSearchResults.clear();
      if (constituentSearchForm.Phone != '') {
            constituentSearchForm.Phone = formatPhone(constituentSearchForm.phone);
      }
      // trim leading and trailing spaces from all search fields
      constituentSearchForm.City = constituentSearchForm.City.trim();
      constituentSearchForm.EmailAddress = constituentSearchForm.EmailAddress.trim();
      constituentSearchForm.FirstName = constituentSearchForm.FirstName.trim();
      constituentSearchForm.LastName = constituentSearchForm.LastName.trim();
      constituentSearchForm.State = constituentSearchForm.State.trim();
      constituentSearchForm.Zip = constituentSearchForm.Zip.trim();
      try{
            constituentSearchResultsWrapper = phssIntegrationService.doGeneralSearch( constituentSearchForm );     
           
              if (constituentSearchResultsWrapper != null) {
                    constituentSearchResults = constituentSearchResultsWrapper.constituentSearchResults;
              } else {
                  ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'No matching customers were found...');
                  ApexPages.addMessage(msg);
              }
      }catch(Exception e){
          ExLog.log(e); //  catch Exception Vinayak  
      }  
        return null;
    }

    public PageReference selectConstituent() {      
        PageReference redirectTo;    
        //try to find a match is SFDC
        Contact existingContact;
        Boolean isFound = false;
        // find contact in SFDC by Master Constituent Id
        if (selectedConstituentId != null) {
            try {
                  existingContact = [Select id, name FROM contact WHERE master_constituent_id__c = :selectedConstituentId LIMIT 1];               
                  if (existingContact != null) {
                        isFound = true;
                  }
            } catch (Exception ex) {ExLog.log(ex); }  //  catch Exception Vinayak
        }
        // find by managed learning flag and contact id
        if ( !isFound ) {
            if ( selectedManagedLearningFlag == 'Yes' && selectedContactId != null ) {
                  try {
                        existingContact = [Select id, name FROM contact  WHERE id = :selectedContactId LIMIT 1];               
                        if (existingContact != null) {
                              isFound = true;
                        }
                  } catch(Exception ex) {ExLog.log(ex); }   //  catch Exception Vinayak 
            }
        }
        if (isFound) {
            redirectTo = new PageReference('/'+ existingContact.id);
        } else {
            redirectTo = Page.ConfirmContactInformation;   
        }
        return redirectTo; 
    }



    public PageReference QuickCreateConstituent() {
        Account newAccount = new Account();
        newAccount.Name = qcContactProxy.lastName;
        newAccount.billingStreet = qcContactProxy.mailingStreet;
        newAccount.billingCity = qcContactProxy.mailingCity;
        newAccount.billingState = qcContactProxy.mailingState; // required by validation rule
        newAccount.billingPostalCode = qcContactProxy.mailingPostalCode;
            Savepoint sp = Database.setSavePoint();
        try {
            insert newAccount;
        } catch (Exception ex) { ApexPages.addMessages(ex); ExLog.log(ex); return null; } //  catch Exception Vinayak
        // get the auto generated account number
        Account accountJustCreated = [SELECT id, Name, Account_Auto_Number__c FROM Account WHERE id = :newAccount.id LIMIT 1];
        accountJustCreated.name = AccountService.constructAccountName( qcContactProxy.lastName, accountJustCreated.Account_Auto_Number__c );
        update accountJustCreated;
        Contact newContact = new Contact();
        newContact.firstName = qcContactProxy.firstName;
        newContact.lastName = qcContactProxy.lastName;
        newContact.email = qcContactProxy.email;
        newContact.phone = qcContactProxy.phone;
        newContact.mailingStreet = qcContactProxy.mailingStreet;
        newContact.mailingPostalCode = qcContactProxy.mailingPostalCode;
        newContact.mailingCity = qcContactProxy.mailingCity;
        newContact.mailingState = qcContactProxy.mailingState;
        newContact.AccountId = newAccount.id;
        try {
            insert newContact;
        } catch (Exception ex) {
            ApexPages.addMessages(ex);
            Database.rollback(sp);
            return null;
        }     
        PageReference contactPageRef = new PageReference('/' + newContact.id);
        contactPageRef.setRedirect(true);
        return contactPageRef; 
    }
 
    public CTIScreenPopCtlr() {
        phone  = ApexPages.currentPage().getParameters().get('ANI');   
        phssIntegrationService = new PHSSIntegrationService();
            constituentSearchResults = new List<PHSSModel.ConstituentSearchResult>();      
        qcContactProxy = new Contact();
        constituentSearchForm = new PHSSModel.ConstituentSearchCriteria();
        if (phone != '' && phone != null ) { 
            formattedPhone = formatPhone(phone);
            pageTitle = 'Caller\'s Phone Number';     
            showPhoneIcon = true;       
        } else {
            pageTitle = 'Search For A Customer';
            showPhoneIcon = false;
        } 
    }
   
    private String formatPhone(String phone) {
        // phone is passed in as numbers only and is pre-pended with '1'
        String formattedPhone;
        // remove all non numbers
        phone = phone.replaceAll('\\D','');
        phone = phone.right(10);
        formattedPhone = '(' + phone.left(3) + ') ' + phone.mid(3, 3) + '-' + phone.right(4);
        return formattedPhone;
    }       
}

 

Line 25 is bolded.

 

Any help would be GREATLY appreciated!!

  • September 17, 2013
  • Like
  • 0

Hi, 

 

I want to get the last modified date of a custom object definition in Apex or via WS.  Schema.DescribeSObjectResult doesn't have a method like getLastModifiedDate.  But this info is clearly available in the custom object definition detail page.  Is there anyway to get this in the Apex code?  Similarly I want to know the last modified date of a custom field definition, and I'm facing the same issue.

 

I also check the meta data API reference and cannot find anyway to get the last modified date of custom object definition.

 

Please point me to the right direction.

 

Thanks,

 

-Qin zhang

  • January 21, 2011
  • Like
  • 0