• NK@BIT
  • NEWBIE
  • 115 Points
  • Member since 2014
  • Bit Order Technologies

  • Chatter
    Feed
  • 3
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 37
    Replies
Hi,

I want to collect all the values for a particular field from a multiple lookup records and add it to a field in parent record. Individual values should be comma separated. How should I acieve this through trigger? Thanks in advance!
Hi all, I want to preface this by saying I have absolutley zero knowledge of coding and how to write an apex trigger. However, I do know the result i'm trying to achieve so I'm hoping my description will be enough for someone to provide some help.

My situation is the following: I have 2 custom objects Volunteer and Subject. What I want to happen is that when a certain field (Volunteer_Status__c), a picklist value, is updated to the selection "Screening Completed" a new record is created under the Subject object that replicates the information stored under the volunteer record.

If someone could provide some instruction it would be much appreciated!
trigger createSplitCommissionOnOpportunityX on Opportunity (after insert, after update) {
   
    List<Split_Commissions__c> SCToInsert = new List<Split_Commissions__c>  ();
  
    for (Opportunity o : Trigger.new) {
       
      
    if ( ((Trigger.isInsert) ||
          (Trigger.isUpdate) && (Trigger.oldMap.get(o.id).StageName !=  'Closed Won')) &&
         (o.StageName == 'Closed Won') )
    {
        Split_Commissions__c SC = new Split_Commissions__c ();        
       
        sc.Opportunity_Name__c = o.id;
       
        SCToInsert.add(sc);
       
       
        }//end if
       
    }//end for o
   
    //once loop is done, you need to insert new records in SF
    // dml operations might cause an error, so you need to catch it with try/catch block.
    try {
        insert SCToInsert;
    } catch (system.Dmlexception e) {
        system.debug (e);
    }
}

PLease help us to create the test class for the above code.


Thanks,
While installing a managed package in one of my customer org in which Advanced Currency Management enabled I am getting thid error. Can any one tell me why this error is coming?
  • October 08, 2014
  • Like
  • 0
I am getting this error when trying to open one of my email template for preview. Can any one tell me why this error is coming and how I can debug this error?
  • September 23, 2014
  • Like
  • 0
I have a visualforce page in which I reterieve record after search in a pageblock table. I have a button which exports a CSV file for those records. For those CSV records I have written a visualforce page whose content type I have set to CSV. After export CSV file I want to reload the page.
Please help me in writing test class for this controller..

public with sharing class TimeCardController{

    public Timecard__c timecard1{get; set;}
    public List<Resource__c> resource{get; set;}
    public String passcode{get; set;}
    public Boolean Match{get; set;}
    public Boolean NoMatch{get; set;}
    public Boolean readValue1{get;set;} 
    public String resourceName{get;set;} 
  
    Public TimeCardController(){
        timecard1 = new Timecard__c();
        readValue1 =true;
    }
  
   Public void timecardsignin(){
       resource=new List<Resource__c>();
       Match=false;
       NoMatch=false;
       readValue1 =false;
      
       resource=[select Id, Name, Passcode__c from Resource__c where Id=:timecard1.Resource__c AND Passcode__c=:passcode];
      
       if(resource.size()>0)
       {
           Match=true;
       }
       else
       {
           NoMatch=true;
       }
   }
  
    public PageReference timeCard(){
        Timecard__c tc=new Timecard__c();
        tc.Resource__c=timecard1.Resource__c;
        tc.Project__c=timecard1.Project__c;
        tc.Activity_Date__c=timecard1.Activity_Date__c;
        tc.Project_Task__c=timecard1.Project_Task__c;
        tc.Activity_Description__c=timecard1.Activity_Description__c;
        tc.Hours__c=timecard1.Hours__c;
      
        insert tc;
        resourceName=resource[0].name;
        readValue1 = true;
        Match=false;
       
        apexpages.Message msg = new Apexpages.Message(ApexPages.Severity.Info,'Time Card Successfully Updated for '+ resourceName);
        apexpages.addmessage(msg);
        timecard1.clear();
        return null;
       
    }  
    public PageReference doCancel()
    {
        PageReference pageRef = new PageReference('http://crmdev-bitorder.cs6.force.com/timecard');
        pageRef.setRedirect(true);
        return pageRef;
    }

  }
  • January 27, 2014
  • Like
  • 0
I want to write test class for this Email Service apex class

global class ResourceToLeave implements Messaging.InboundEmailHandler {

  global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email,
                                                       Messaging.InboundEnvelope env){

    // Create an InboundEmailResult object for returning the result of the
    // Apex Email Service
    Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();
   
    String[] emailBody = email.plainTextBody.split('\n', 0);
   
    String startdate = emailBody[0].substring(10);
    String[] tempStr = startdate.split('/');
    Integer d = Integer.valueOf(tempStr[0]);
    Integer m = Integer.valueOf(tempStr[1]);
    Integer y = Integer.valueOf(tempStr[2]);
    Date sdt = Date.newInstance(y,m,d);
   
    String enddate = emailBody[1].substring(8);
    String[] tempStr1 = enddate.split('/');
    Integer dd = Integer.valueOf(tempStr1[0]);
    Integer mm = Integer.valueOf(tempStr1[1]);
    Integer yy = Integer.valueOf(tempStr1[2]);
    Date edt = Date.newInstance(yy,mm,dd);
      
    // New Leave object to be created
    Leave__c[] leave = new Leave__c[0];
  
    // Try to look up any contacts based on the email from address
    // If there is more than one contact with the same email address,
    // an exception will be thrown and the catch statement will be called.
    try {
      Resource__c[] resource = [SELECT Id, Name FROM Resource__c WHERE Name = :email.subject LIMIT 1];
     
      Resource__c res;
      if(resource.size()>0)
      {
          res=resource[0];
      }
      // Add a new Task to the contact record we just found above.
      leave.add(new Leave__c(Resource__c=res.Id,
                             Start_Date__c=sdt,
                             End_Date__c=edt
                             ));
    
     // Insert the new Leave
     insert leave;   
    
     System.debug('New Leave Object: ' + leave );  
    }
    // If an exception occurs when the query accesses
    // the contact record, a QueryException is called.
    // The exception is written to the Apex debug log.
   catch (System.QueryException e) {
       System.debug('Query Issue: ' + e);
   }
  
   // Set the result to true. No need to send an email back to the user
   // with an error message
   result.success = true;
  
   // Return the result for the Apex Email Service
   return result;
  }
}
  • January 08, 2014
  • Like
  • 0
I have an object "Leave"

I want that if i send a mail using "Email Service Address" and in Email body i sends StartDate and EndDate Value,

Than StartDate and EndDate Values insert into the Start_Date__c and End_Date__c field of "Leave" Object.

So please tell me how to do this.
  • January 08, 2014
  • Like
  • 0
I have an obejct "Leave".

I want that if i sends a mail by putting "Email to Salesforce address" in BCC than it should go in task of "Leave" record without going in "Unresolved items".

So please tell me is this possible or not?
  • January 07, 2014
  • Like
  • 0
I have a visualforce page in which I reterieve record after search in a pageblock table. I have a button which exports a CSV file for those records. For those CSV records I have written a visualforce page whose content type I have set to CSV. After export CSV file I want to reload the page.
I am getting (403) Forbidden error  in outbound message. My endpoint url is RequestB.in. 


Outbound Message



WF Action

As a result I am not getting a y reponse at my endpoint url:

User-added image
Hi All,

Can anyone please help me with a code that freezes my header row when I export an excel file from the Visualforce page?. I am able to add autofilters though but I have not found a way to freeze headers. 

Thank you all in advance.
I have 2 outbound messages set as a system user with full admin rights to send as.  When I perform a test in the full sandbox the outbound message is sent.  When any user that is not a full admin creates and closes the case it doesn't fire the outbound message, but it does the other action that is part of the workflow which is a field update.  

Any ideas why it's not queuing and firing off the outbound message for non-admins, but successully performs the other actions in the same workflow?

Thank you.  

 
Q)Consider we have overall 90% code coverage however there is one class which have 0% code coverage. Can we still able to deploy that class on production?
A)Some one giving answer that, Yes. Minimum 1% required for every trigger and there is no such restriction for Apex class.

I have found the above question & Answer in one Blog.My doubt is
------>
Is this answer Correct? If yes, In SFDC Documentation they provided that : "
1.At least 75% of your Apex code must be covered by unit tests, and all of those tests must complete successfully.
2.All classes and triggers must compile successfully.
"
What's exactly does it mean...............................................................?

Will Any One Suggest that could take me out with clarity in this issue..
Thanks in Advance..

 
Hi Everyone,

i have a requirement.
i have a page, which displays list of records.each record contains check box and inputbox.
when i select a check box,we have to populate 1 as defualt number in input box after that user can edit with different number.(default should be 1 for selected check box i.e record).
i have a button below the button.when i click on this button i need add them into  object.

i hope i'm clear with question.

Thanks in Advance
Lakshman

 
Hello,
I am trying to export excel file from VF page which contains report chart. But I am not able to do that. Please help me. my code is given below:
<apex:page id="page" showHeader="false" Sidebar="false" contentType="application/vnd.ms-excel#SalesForceExport.xls" cache="true">
    <apex:pageBlock id="results" >
         <analytics:reportChart reportId="00O90000007RacK"/>
    </apex:pageblock>
</apex:page>
trigger updatepicklistlist on Orderc__c (after insert,after  Update,after delete) {
  Map<id,Account> mapAcc=new Map<id,Account>();
  set<id> accids=new set<id>();
list<Orderc__c> lstorder=new list<Orderc__c>();
      for(Orderc__c ord:trigger.new){
       accids.add(ord.Party_Name__c);
   }
     for(Orderc__c ord:trigger.old){
       accids.add(ord.Party_Name__c);
   }
for(account acc:[select id,Status__c,Discount__c from  account where id =: accids]) 
      {
     mapAcc.put(acc.id,acc);
         
     System.debug('List of Acccounts@@@@@@@@@@@@@@@@@@'+mapAcc);
      }
  if(accids.Size()>0)
  {
      for(Orderc__c o:Trigger.New)
      {
          if(mapAcc.get(o.Party_Name__c) .Discount__c==Null)
          {
             o.addError('Please Enter Discount in Account'); 
          }
          else
          {
             mapAcc.get(o.Party_Name__c) .Status__C='Existing';  
          }
       
        
      }
   
  }
Update mapAcc.values();
}
Hi All,

I am getting the below error's when i am trying to invoke 3rd party system via outbound message call.
Please help.

(403)Forbidden
java.io.IOException:Stream closed.

Thanks...
Hi,

How can we parse any WSDL in APEX and extract the methods, parameters, complex types then based on that build the UI on the fly? I wanted to call any external service WSDL based on URL which is in Admin configuration. Please suggest.
public String monthDayNumber{get;set;}
public String monthDay{get; set;}

   public List<selectOption> getMonthDayOptions() {

   List<selectOption> option=new List<selectOption>();
      
    option.add(new selectOption('Sunday','Sunday'));
    option.add(new selectOption('Monday','Monday'));
    option.add(new selectOption('Tuesday','Tuesday'));
    option.add(new selectOption('Wednesday','Wednesday'));
    option.add(new selectOption('Thursday','Thursday'));
    option.add(new selectOption('Friday','Friday'));
    option.add(new SelectOption('Saturday','Saturday'));
 
        return option;
    }
public List<selectOption> getMonthDayNumberOptions() {
  
    List<selectOption> option=new List<selectOption>();
     option.add(new selectOption('1st','1st'));
     option.add(new selectOption('2nd','2nd'));
     option.add(new selectOption('3rd','3rd'));
     option.add(new selectOption('4th','4th'));
     option.add(new selectOption('Last','Last'));
 
        return option;
    }

how to add above selectoptions  values as CRON Expression Dynamically?
0 0 12 ? 1/1 MON#1 *
  • August 23, 2014
  • Like
  • 0
I have a visualforce page in that i have created two button
1) Export Excel
2)Export Pdf

I have written code for for bothexport page in excel and PDF using rerender and contettype.
Also i have added custom button on my visulforce page.
<apex:commandButton action="{!URLFOR($Action.Five_c.Generate, Id)}" id="pdf" value="pdf"/>
<apex:commandButton action="{!URLFOR($Action.Five_c.excel, Id)}" id="excel" value="excel"/>
Now the problem is once I click on pdf button it redirect to the pdf page .What my requirnment is that pdf should open in new window i.e child page and parent page should also visible to us.

Similary for Excel it should happen
Visualforce page : Export Results to Excel or CSV

I have created a VF page which fetch the records from object based on the critirea selected by user. Based the critirea I have created a results section in VF page which shows all the relevant information. I have added a custom button " export to excel". Whenever users click this button , it should export all the RESULTS to excel. In order to achieve this , I have created a 2nd VF page same as my original page but with "contentype " attribute. When i click the button , It is exporting the results but It is also exporting the some irrelevant data .
VF Page:
<apex:page controller="Fetchsiteplacement12" tabStyle="Site_Placements__c" sidebar="True" contentType="application/vnd.ms-excel#filename.xls"   language="en-US" cache="True">



    <apex:form >
      
        <apex:pageBlock >
        <apex:messages />
            <apex:pageBlockButtons location="Both">
        
            <apex:commandButton value="Fetch" action="{!FetchSPRec}"/>
            <apex:commandButton value="Cancel" action="{!CancelSPRec}"/>
          
            </apex:pageBlockButtons>
          
          
              <apex:pageBlockSection title="Results">
            <apex:pageBlockSectionItem >
                <apex:pageBlockTable value="{!spRec}" var="site" columnsWidth="500px, 500px" >
                    <apex:column value="{!se.Name}"/>
                    <apex:column value="{!se.Placement__c}"/>
                    <apex:column value="{!se.Level_Max__c}"/>
                  
                 </apex:pageBlockTable>
                 </apex:pageBlockSectionItem>
               
           </apex:pageBlockSection>
        </apex:pageblock>
                </apex:form>
</apex:page>


APex class:

And, in the apex class , I am using this :

public PageReference FetchExcelReport() {
        PageReference nextpage = new PageReference('/apex/ExcelReportPage');
return nextpage;
    }


Below is irrelevent info:

if(!window.sfdcPage){window.sfdcPage = new ApexDetailPage();} UserContext.initialize({"networkId":"","locale":"en_US","labelLastModified":"1393912808000","isDefaultNetwork":true,"today":"3/5/2014 4:23 PM","timeFormat":"h:mm a","userPreferences":[{"index":112,"name":"HideInlineEditSplash","value":false},{"index":114,"name":"OverrideTaskSendNotification","value":false},{"index":115,"name":"DefaultTaskSendNotification","value":false},{"index":119,"name":"HideUserLayoutStdFieldInfo","value":false},{"index":116,"name":"HideRPPWarning","value":false},{"index":87,"name":"HideInlineSchedulingSplash","value":false},{"index":88,"name":"HideCRUCNotification","value":false},{"index":89,"name":"HideNewPLESplash","value":false},{"index":90,"name":"HideNewPLEWarnIE6","value":false},{"index":122,"name":"HideOverrideSharingMessage","value":false},{"index":91,"name":"HideProfileILEWarn","value":false},{"index":93,"name":"HideProfileElvVideo","value":false},{"index":97,"name":"ShowPicklistEditSplash","value":false},{"index":92,"name":"HideDataCategorySplash","value":false},{"index":128,"name":"ShowDealView","value":false},{"index":129,"name":"HideDealViewGuidedTour","value":false},{"index":132,"name":"HideKnowledgeFirstTimeSetupMsg","value":false},{"index":104,"name":"DefaultOffEntityPermsMsg","value":false},{"index":135,"name":"HideNewCsnSplash","value":false},{"index":101,"name":"HideBrowserWarning","value":false},{"index":139,"name":"HideDashboardBuilderGuidedTour","value":false},{"index":140,"name":"HideSchedulingGuidedTour","value":false},{"index":180,"name":"HideReportBuilderGuidedTour","value":true},{"index":183,"name":"HideAssociationQueueCallout","value":false},{"index":194,"name":"HideQTEBanner","value":false},{"index":193,"name":"HideChatterOnboardingSplash","value":true},{"index":195,"name":"HideSecondChatterOnboardingSplash","value":true},{"index":270,"name":"HideIDEGuidedTour","value":true},{"index":282,"name":"HideQueryToolGuidedTour","value":false},{"index":196,"name":"HideCSIGuidedTour","value":true},{"index":271,"name":"HideFewmetGuidedTour","value":false},{"index":272,"name":"HideEditorGuidedTour","value":true},{"index":205,"name":"HideApexTestGuidedTour","value":false},{"index":206,"name":"HideSetupProfileHeaderTour","value":true},{"index":207,"name":"HideSetupProfileObjectsAndTabsTour","value":true},{"index":213,"name":"DefaultOffArticleTypeEntityPermMsg","value":false},{"index":214,"name":"HideSelfInfluenceGetStarted","value":false},{"index":215,"name":"HideOtherInfluenceGetStarted","value":false},{"index":216,"name":"HideFeedToggleGuidedTour","value":false},{"index":268,"name":"ShowChatterTab178GuidedTour","value":false},{"index":275,"name":"HidePeopleTabDeprecationMsg","value":false},{"index":276,"name":"HideGroupTabDeprecationMsg","value":false},{"index":222,"name":"TouchExternalLinkReminderSuppression","value":false},{"index":224,"name":"HideUnifiedSearchGuidedTour","value":true},{"index":226,"name":"ShowDevContextMenu","value":true},{"index":227,"name":"HideWhatRecommenderForActivityQueues","value":false},{"index":228,"name":"HideLiveAgentFirstTimeSetupMsg","value":false},{"index":232,"name":"HideGroupAllowsGuestsMsgOnMemberWidget","value":false},{"index":233,"name":"HideGroupAllowsGuestsMsg","value":false},{"index":234,"name":"HideWhatAreGuestsMsg","value":false},{"index":235,"name":"HideNowAllowGuestsMsg","value":false},{"index":236,"name":"HideSocialAccountsAndContactsGuidedTour","value":false},{"index":237,"name":"HideAnalyticsHomeGuidedTour","value":true},{"index":238,"name":"ShowQuickCreateGuidedTour","value":false},{"index":245,"name":"HideFilePageGuidedTour","value":false},{"index":250,"name":"HideForecastingGuidedTour","value":false},{"index":242,"name":"TouchHideOptoutHover","value":false},{"index":251,"name":"HideBucketFieldGuide","value":false},{"index":263,"name":"HideSmartSearchCallOut","value":true},{"index":265,"name":"HideSocialProfilesKloutSplashScreen","value":false},{"index":273,"name":"ShowForecastingQuotaAttainment","value":false},{"index":280,"name":"HideForecastingQuotaColumn","value":false},{"index":301,"name":"HideManyWhoGuidedTour","value":false},{"index":284,"name":"HideExternalSharingModelGuidedTour","value":false},{"index":298,"name":"HideFileSyncBannerMsg","value":false},{"index":299,"name":"HideTestConsoleGuidedTour","value":true},{"index":300,"name":"HideNetworkSetupOverlayGettingStarted","value":false},{"index":302,"name":"HideManyWhoInlineEditTip","value":false},{"index":303,"name":"HideSetupV2WelcomeMessage","value":false},{"index":312,"name":"ForecastingShowQuantity","value":false},{"index":313,"name":"HideDataImporterIntroMsg","value":false},{"index":314,"name":"HideEnvironmentHubLightbox","value":false},{"index":316,"name":"HideSetupV2GuidedTour","value":false},{"index":317,"name":"HideFileSyncMobileDownloadDialog","value":false},{"index":318,"name":"HideHelpBannerQuickActionList","value":false},{"index":321,"name":"HideCustomEntityQuickActionCallout","value":true},{"index":322,"name":"HideEnhancedProfileHelpBubble","value":false},{"index":328,"name":"ForecastingHideZeroRows","value":false},{"index":330,"name":"HideEmbeddedComponentsFeatureCallout","value":true},{"index":340,"name":"HideS1BrowserUI","value":false}],"orgPreferences":[{"index":257,"name":"TabOrganizer","value":true}],"startOfWeek":"1","isAccessibleMode":false,"ampm":["AM","PM"],"renderMode":"RETRO","userId":"00570000002Nayk","dateTimeFormat":"M/d/yyyy h:mm a","dateFormat":"M/d/yyyy","uiSkin":"Theme3","language":"en_US","siteUrlPrefix":""});


function twistSection(twisty, sectionId) { var parentDiv = twisty; while (parentDiv.tagName != 'DIV') { parentDiv = parentDiv.parentNode; } var div = parentDiv.nextSibling; var elemWasOn = false; if (div.style.display != 'none') { div.style.display = 'none'; twisty.className ='showListButton'; twisty.alt = twisty.title = 'Show Section - '+twisty.name; elemWasOn = true; } else { div.style.display = 'block'; twisty.className = 'hideListButton'; twisty.alt = twisty.title = 'Hide Section - '+twisty.name; } return !elemWasOn; } var registeredSections = new Array(); function registerTwistableSection(headerId, mainTableId) { var obj = new Object(); obj.headerId = headerId; obj.mainTableId = mainTableId; registeredSections[registeredSections.length] = obj; } function twistAllSections(on) { for (var i = 0; i < registeredSections.length; i++) { var obj = registeredSections[i]; var img; img = document.getElementById('img_' + obj.headerId); if (on && 'showListButton' == img.className) { twistSection(img, obj.headerId, obj.mainTableId); } else if (!on && 'hideListButton' == img.className) { twistSection(img, obj.headerId, obj.mainTableId); } } } function toggleSection(headerId, on){ var sectionHead = document.getElementById('head_'+headerId+'_j_id0_j_id1_j_id2'); var body = sectionHead.nextSibling; var disp = on ? 'block' : 'none'; sectionHead.style.display = disp; body.style.display = disp; } function registerTwistableSections_j_id0_j_id1_j_id2() { registerTwistableSection('j_id0_j_id1_j_id2_j_id7', 'j_id0_j_id1_j_id2'); registerTwistableSection('j_id0_j_id1_j_id2_j_id22', 'j_id0_j_id1_j_id2'); registerTwistableSection('j_id0_j_id1_j_id2_j_id27', 'j_id0_j_id1_j_id2'); } registerTwistableSections_j_id0_j_id1_j_id2();


Kindly help me.
I have a Developer Edition account as I am trying to do a POC on integration of SFDC using Tibco BW.
I have created a Workflow Rule which triggers an Outbound Message. The message will be recieved by a Tibco BW Web Service on tibco's end over HTTP.

Even though the URL in the outbound Message matches the Webservice URL, the outbound message get's stuck on the SFDC side with a Delivery Failure Reason '(403) Forbidden'.

Please tell me what is the reason for the error as there is no information that i could find on this. Also, how can i fix this.
  • January 04, 2014
  • Like
  • 0

Hi,

I want to implement the standard export and Printable view functionality of reports in a visualforce page.

Can anyone let me know if this is possible.

 

Thanks in advance.

I want to display data in a JQGrid on visualforce page. I am not getting any error but i can't also see any data.

Below is my visualforce page code & Controller code

 

Visualforce Page:

 

<apex:page standardController="Contact" showHeader="true" standardStylesheets="false" extensions="GridController" id="page1" >

<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/themes/redmond/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="http://www.trirand.net/aspnetmvc/Content/themes/ui.jqgrid.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/JavaScript"></script>
<script src="http://www.trirand.net/aspnetmvc/Scripts/trirand/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="http://www.trirand.net/aspnetmvc/Scripts/trirand/jquery.jqGrid.min.js" type="text/javascript"></script>
    
<script type="text/JavaScript">
     var gridData;
     var obj;  
     
    function search(jsonString) {        
        $("#pdata").jqGrid("GridUnload");
                
        gridData = JSON.stringify(jsonString);    
        obj = JSON.parse(gridData);      

        jQuery("#pdata").jqGrid({
        data&colon; jsonString,
        datatype: 'local',
        colNames:['Id','Name'],
        colModel:[
            {name:'Id',index:'Id', width:40},
            {name:'Name',index:'Name', width:40}],
        rowNum:10,
        rowList:[5,10,20,30,50,100, 1000],
        pager: '#ppdata',
        sortname: 'name',
        viewrecords: true,
        sortorder: "desc",
        caption:"Contact Data",
        width: 800,
        height: 180,   
    });   
   $("#pdata").trigger("reloadGrid");
 }

function showDataInJqGrid(){
    var accName = document.getElementById("query").value;    
    contactSearch(accName);
}

function contactSearch(name) {
    var jsonString;      
    myp1.GridController.showContacts(name,handleContacts);
}

function handleContacts(result, event) {
    if(event.type == 'exception'){
        alert(event.message);
    } else{        
        jsonString = result;        
        search(jsonString);
        gridData = JSON.stringify(jsonString);
    }
}
</script>

<apex:sectionHeader title="Contact Search using AccountID" subtitle="Search Contact" />
  <apex:pageBlock mode="maindetail">
    <apex:form id="qform" >
            <apex:pageBlockSection title="Search Contact for the Account" collapsible="false" columns="1" >
                <table width="100%">
                    <tr>
                        <td><h3>Enter Account Name </h3>&nbsp;&nbsp;<input type="text" id="query" />&nbsp;&nbsp;&nbsp;
                            <input type="button" value="Show Contacts " class="btn" onclick="showDataInJqGrid();" />&nbsp;&nbsp;&nbsp;
                        </td>
                    </tr>
                </table>
            </apex:pageBlocksection>
    </apex:form>

    <apex:pageBlockSection title="Contacts in Response" collapsible="false" rendered="true">               
        <div id="response" style="font-size: 16px;width: 300px;font-family: monospace; font-stretch: expanded" />               
        <table id="pdata"></table>
        <div id="ppdata"></div>
    </apex:pageBlocksection>
  </apex:pageblock>
</apex:page>

 

 

 

Controller:

 

 

global class GridController {
    public GridController(ApexPages.StandardController controller) {

    }
    
    @RemoteAction
    global static List<Contact> showContacts(String accName){
        accName = '%'+ accName+'%';
        List<Contact> lst_contacts = new List<Contact>([select id, name from contact where Account.Name LIKE : accName]);
        return lst_contacts;
    }
}

 

 

can someone help me?

Thanks,

Akash

Hi guys ,

I'm facing a big issue with MAC when I am exporting .xls file through visualforce page. There is some javascript code at the top along with the data on the generated .xls file. This issue is only with Mac and not with Windows. Through some other blog posts, it seems that this issue arises only in case if we are using pageBlockTable instead of dataTable. I just replaced pageBlockTable with simple datatable and problem still persists. I would really appreciate any help on this. Thanks

Hi All,

 

Is there any endpoint URL available to test Workflow outbound message?

I want to know what information is going through outbound message, so i need an endpoint URL to test?

Kindly tell me, is there any website(end point url) to test.

 

I already used one endurl for testing, but unfortunately i forgot that url.

I got that url from the salesforce discussion board only.

HI!

i know about dataloader or report but i have to create the csv with a specific lines and data.

So.. my ideia is to have a button that on clicking export a csv file.

Anyone has an example of that?

many tks

Hi Folks.....


I used the following Javascript to export my table of data to excel.

 

   <script type="text/javascript">

   function exportToExcel(){

       var oExcel = new ActiveXObject("Excel.Application");

       var oBook = oExcel.Workbooks.Add;

       var oSheet = oBook.Worksheets(1);

       for (var y=0;y<ExportTable.rows.length;y++){

           for (var x=0;x<ExportTable.rows(y).cells.length;x++){

               oSheet.Cells(y+1,x+1) =ExportTable.rows(y).cells(x).innerText;

           }

       }

       oExcel.Visible = true;

       oExcel.UserControl = true;

   }

   </script>


Through this code my requirement is almost reached except one issue.I developed a table using Visualforce in Salesforce.I've added the above javascript in the visualforce code.I was successful in exporting the data to Excel having the tags <apex:inputText> but not <apex:outputText>.

My sample code for
table is provided below for more information:

<table id="ExportTable">
<tr>
  <td width="10%" BGCOLOR="#99CCFF"><center><b>April</b></center> </td>

  <td> <apex:inputText value="{!April1}" disabled="{!Apr1a}"/> </td>
  <td> <apex:inputText value="{!April2}" disabled="{!Apr2a}"/></td>
  <td> <apex:inputText value="{!April3}" disabled="{!Apr3a}"/> </td>
  <td> <apex:outputText value="{0,number,0.00}" id="AprilTotal">  
      <apex:param value="{!AprilTotal}"/>
     </apex:outputText>     
   </td>     
  </tr>   
</table>

I was able to export the "AprilTotal" value in to Excel with the above javascript code but not the values in "April1","April2","April3".

Kindly suggest a solution on how to export the values in <apex:outputText> tags.

Thanks & Regards,
Jagadeesh K.

I have found multiple posts on how to edit the apex:page line so that when the VF page is activated, it saves itself to an excel file:

 

<apex:page cache="true" contentType="application/vnd.ms-excel#test.xls" controller="StoreController" language="english">

 

But what I need to do is display the VF page with the panelGrid.  Then the user can click a button or link that will export the grid to excel.

 

I was thinking of just creating a second visualforce page that contains the above apex:page line, but I don't know how to add that logic to a button/link.

 

Thanks

 

Todd