• SampathNamburi
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 6
    Replies


Hi,
I would like to create a VF page where Case (Case number, Subject, Version ..etc) and CaseComment (comment body) details will be displayed for mass edit purpose. This is something like mass edit of multiple objects.

I could able to achieve the mass edit of single object which is for Case but i am not sure how i can display an empty text box for each case to enter case comments and up on clicking save button the system should update the case and insert a new case comment.

 

Below is the code where I am upto.

 

<apex:page standardController="Case" 
           recordSetVar="cases"
           tabStyle="Case" sidebar="false">
  <apex:form >
    <apex:pageBlock >
      <apex:pageMessages />
      <apex:pageBlockButtons >
        <apex:commandButton value="Quick Save" 
                            action="{!quicksave}"/>
        <apex:commandButton value="Save" 
                            action="{!save}"/>
        <apex:commandButton value="Cancel" 
                            action="{!cancel}"/>
                            
      </apex:pageBlockButtons>
      <apex:panelGrid columns="4">
    <apex:commandLink action="{!first}"><b>First</b></apex:commandlink> 
    <apex:commandLink action="{!previous}"><b>Previous</b></apex:commandlink> 
    <apex:commandLink action="{!next}"><b>Next</b></apex:commandlink> 
    <apex:commandLink action="{!last}"><b>Last</b></apex:commandlink> 
   </apex:panelGrid>      
      <apex:pageBlockTable value="{!cases}" var="c">
        <apex:column value="{!c.casenumber}"/>
        <apex:column value="{!c.subject}"/>
        <apex:column headerValue="Upgrade Status">
         <apex:inputField value="{!c.Upgrade_Status__c}"/>
         </apex:column>
       <apex:column headerValue="SP Installed">
         <apex:inputField value="{!c.SP_Installed__c}"/>
         </apex:column>
        <apex:column value="{!c.SP_To_Install__c}"/>
        <apex:column headerValue="Status">
          <apex:inputField value="{!c.status}"/>
        </apex:column>
        <apex:column headerValue="Change Status to">
          <apex:inputField value="{!c.Next_Status__c}"/>
       </apex:column>
      </apex:pageBlockTable>
      <apex:panelGrid columns="4">
    <apex:commandLink action="{!first}"><b>First</b></apex:commandlink> 
    <apex:commandLink action="{!previous}"><b>Previous</b></apex:commandlink> 
    <apex:commandLink action="{!next}"><b>Next</b></apex:commandlink> 
    <apex:commandLink action="{!last}"><b>Last</b></apex:commandlink> 
   </apex:panelGrid>      
    </apex:pageBlock>
  </apex:form>
</apex:page>

 

Hi,

 

  I have completed my coding part using sobjects where i have to create sobject connection for several times to the same custom object. I am interested to know if there is a way to reuse the same sobject connection as well as closing the sobject connection.

 

 I am using sobjects in my ajax coding and below is the some part of my code.

 

 

 var Tracking_Main = new sforce.SObject("CSP_Tracking_Main__c"); // creating sobject
 // if it is a fresh login then get cookie should return NULL
  Tracking_Main.Session_ID__c = __sfdcSessionId;
  Tracking_Main.User_ID__c = '{!$User.Id}';
 var result_Tracking_Main = sforce.connection.create([Tracking_Main], {
  onSuccess : success_Tracking_Main,
  onFailure : failure
  }
 );

 

 

 

 ------------------- after this i have to update the newly created record, for which i wrote as below---------------------------

 

  Tracking_Main = new sforce.SObject("CSP_Tracking_Main__c"); // recreae sobject 

  Tracking_Main.id = Get_Cookie("visitID");

Tracking_Main.Home__c = 1;

sforce.connection.update([Tracking_Main]); // update object

 ---------------------------------------------------------------------------------------------------------------------------------------------------------

 

 1. I would like to know on how to resue the same sobject that is created at the top

  2. How to close the sobject connection after my job is done.


 Any help in this regard is highly appreciated.

 

Thanks,

Sampath

Hi,

 

I am reciving the below error while inserting a record into a custom object using sControl and Ajax. Any help in resolving this is highly appreciate.

 

 

{faultcode:'sf:INVALID_TYPE', faultstring:'INVALID_TYPE: sObject type 'CSP_Tracking__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.', detail:{InvalidSObjectFault:{exceptionCode:'INVALID_TYPE', exceptionMessage:'sObject type 'CSP_Tracking__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.', row:'-1', column:'-1', }, }, }

 

-------------------------------Code---------------------

 

<apex:page sidebar="false" showHeader="false">

<!--  Begin Default Content REMOVE THIS -->

 

<script type="text/javascript">

     var __sfdcSessionId = '{!GETSESSIONID()}';

</script>

 

<script src="../../soap/ajax/21.0/connection.js" type="text/javascript"></script>

     <script type="text/javascript">

window.onload = setupPage;

     function setupPage() {

       //function contains all code to execute after page is rendered 

 

var Tracking = new sforce.SObject("CSP_Tracking__c");

Tracking.Session_ID__c = __sfdcSessionId;

Tracking.CSP_Page_URL__c = parent.location.href;

Tracking.User_ID__c = "{!$User.Id}";

       var result = sforce.connection.create([Tracking], {

       onSuccess : success,

     onFailure : failure

     }

);

 

   function success(result) {

     if (result[0].getBoolean("success")) {

 alert("new account created with id " + result[0].id);

} else {

 alert("failed to create account " + result[0]);

}

}

 

function failure(error) {

//document.getElementById("output").innerHTML = error;

document.write(error);

//alert(error);

  }

   }

 

  

  

   //alert(parent.location.href);

   </script>

 

</apex:page>

 

 

Thank you very much,

Sampath

Error

Hi,

May i know how i can access the full page URL into a variable in a component? I am writing a custom apex page which call a custom component. My custom apex page will be called in a framed environment. (Header, left side menu and my Apex page will be in the right side wide frame). On the first load of the page i would like to grab the main url. I have tried the below but they are not addressing my issue. Any help on this is highly appreciated.

 

Page_URL__c= ApexPages.currentPage().getUrl() - This is giving me the custom apex code path (apex/CSP_Tracking) not the main page url which should be https://cs3.salesforce.com/home/home.jsp

 

Page_URL__c = ApexPages.currentPage().getHeaders().get('Host') - This is giving me cs3.salesforce.com but i am interested to get the rest of the URL which is "/home/home.jsp"

 

Thank you,

Sampath

Hi,

 

 May i know how i can add event handler to the menu tabs (Home, Knowledge, Incidents...)  in salesforce standard header which is used in customer portal?

 

Salesforce CRM Call Center
Logout
LOGGED IN AS TONY STARK Force.com Sandbox: support
Home
Knowledge
Incidents
Reports
Metrics
Content

 

Thank you,

Sampath

I am in the process of developing a controller in which I have to use global variables. While doing so I am receiving the below error. 

 

                My code :             

 

 public class PurchasedProducts {
    List<Contact> c; 
   
      
   public List<Contact> getPurchasedProducts() {
       if(c == null) c = [select id, name from contact WHERE FirstName =:User.FirstName];
       return c;
   }
   }

 

                Error      :   Invalid bind expression type of Schema.SObjectField for column of type String

 

I am trying to get the Account details of a logged in portal user using an apex class.

 

I might be wrongly referring the global variable ..Any help on this one is highly appreciated.

 

Thank you,

Sampath

Hi,

 

I am reciving the below error while inserting a record into a custom object using sControl and Ajax. Any help in resolving this is highly appreciate.

 

 

{faultcode:'sf:INVALID_TYPE', faultstring:'INVALID_TYPE: sObject type 'CSP_Tracking__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.', detail:{InvalidSObjectFault:{exceptionCode:'INVALID_TYPE', exceptionMessage:'sObject type 'CSP_Tracking__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.', row:'-1', column:'-1', }, }, }

 

-------------------------------Code---------------------

 

<apex:page sidebar="false" showHeader="false">

<!--  Begin Default Content REMOVE THIS -->

 

<script type="text/javascript">

     var __sfdcSessionId = '{!GETSESSIONID()}';

</script>

 

<script src="../../soap/ajax/21.0/connection.js" type="text/javascript"></script>

     <script type="text/javascript">

window.onload = setupPage;

     function setupPage() {

       //function contains all code to execute after page is rendered 

 

var Tracking = new sforce.SObject("CSP_Tracking__c");

Tracking.Session_ID__c = __sfdcSessionId;

Tracking.CSP_Page_URL__c = parent.location.href;

Tracking.User_ID__c = "{!$User.Id}";

       var result = sforce.connection.create([Tracking], {

       onSuccess : success,

     onFailure : failure

     }

);

 

   function success(result) {

     if (result[0].getBoolean("success")) {

 alert("new account created with id " + result[0].id);

} else {

 alert("failed to create account " + result[0]);

}

}

 

function failure(error) {

//document.getElementById("output").innerHTML = error;

document.write(error);

//alert(error);

  }

   }

 

  

  

   //alert(parent.location.href);

   </script>

 

</apex:page>

 

 

Thank you very much,

Sampath

Error

I am in the process of developing a controller in which I have to use global variables. While doing so I am receiving the below error. 

 

                My code :             

 

 public class PurchasedProducts {
    List<Contact> c; 
   
      
   public List<Contact> getPurchasedProducts() {
       if(c == null) c = [select id, name from contact WHERE FirstName =:User.FirstName];
       return c;
   }
   }

 

                Error      :   Invalid bind expression type of Schema.SObjectField for column of type String

 

I am trying to get the Account details of a logged in portal user using an apex class.

 

I might be wrongly referring the global variable ..Any help on this one is highly appreciated.

 

Thank you,

Sampath