• Rohit2006
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 5
    Replies
Hi I have developed a following VF page
<apex:page sidebar="false"  controller="BES_exportCasesToCSVController" contentType="application/vnd.ms-excel#Cases.xls">
<apex:PageBlock >
<apex:PageBlockTable value="{!cases}" var="case" rowClasses="odd,even" styleClass="tableClass" >
<apex:column >
<apex:facet name="header">Practice Name</apex:facet>
<apex:outputText value="{!case.Practice_Name__r.Name}"/>
</apex:column>
</apex:PageBlockTable>
</apex:PageBlock>
</apex:page>

This gives me excel file for the pageBlockTable contents when I execute this in Firefox
or Google Chrome browser,but when I run this in IE 7 an error box pops up displaying following
message
---------------------------
Windows Internet Explorer
---------------------------
Internet Explorer cannot download exportCasesToCSV from c.cs2.visual.force.com.



Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
---------------------------
OK
---------------------------

I need this working in IE because client uses IE7. Pls tell me any workarounf for this. I am ready to go for SControl
also if there is no way in VisualForce



Hi
I am using Eclipse IDE for salesforce trigger development. I have written a before insert trigger for Task object and inside that I want to find out the task is being created via SF ui or via API. I tried to use Trigger.isUi and Trigger.isApi methods but they won't compile.Is there and way to achieve this?
Hi,
I am trying to write a code inside an APEX trigger to add new record in RecordType object(Default table provided by SalesForce) but this is giving me comple tile error as following

"DML operation is not allowed on RecordType"

Is there any way to insert a new row(entry) in RecordType table from trigger..
Thanks is advance
I want to create n number of series dynamically when i run my application.
where n can be any value it depends on the data which i retrieve from database. below i pasted the example
( in this example i have taken n = 4 i.e., CountMax=4 if i change the CountMax=6 then it should generate 6series dynamically after calculating the values. ). just copy the below code and paste it in Flex builder and run the application.

in this example i am facing problem, chart series are not showing. i dont know the reason why its not showing, if anyone got the solutions for the problem please let me know. my actual requirement is to retrieve data from Salesforce account and want to populate the arraylist then display the chart.

<?xml version="1.0"?>
<!-- Example showing using mx:ChartSeries vs using AS to create chart series programmatically -->
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml" creationComplete="drawChart()" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.charts.series.ColumnSeries;
import mx.charts.series.LineSeries;
import mx.collections.ArrayCollection;

[Bindable]
public var categoryArray:ArrayCollection = new ArrayCollection();
[Bindable]
public var sArray:ArrayCollection = new ArrayCollection();
public function drawChart():void
{
var histMax:int = 25;
var histMin:int = 5;
var countMax:int = 4;
var tmpArr:Array = new Array();
categoryArray.removeAll();
for(var n:int = 0; n < 10; n++)
{
tmpArr[n] = histMin + Math.round((2 * n) / 20 * (histMax - histMin));
categoryArray.addItem({data:tmpArr[n]});
}

var tmpseries:Array = new Array(10);

var cs:ColumnSeries = new ColumnSeries();
columnchart1.series = [cs];

// Add a series to the chart with the x-values and y-values
// from the arrays and set the series type to a column chart
for(var chartSeries:int = 0; chartSeries < countMax; chartSeries++)
{
for(var i:int = 1; i < 10; i++)
{
tmpseries = 3 * Math.random();

}

sArray.addItem({data:tmpseries});
//columnchart1.dataProvider = sArray;
cs = new ColumnSeries();
cs.dataProvider= sArray;
cs.displayName = 'Series';
cs.yField = 'data';
columnchart1.series[chartSeries] = cs;
}
}
]]>
</mx:Script>
<mx:Panel title="Dynamic Series Adding Sample" width="195%" height="90%" layout="absolute">
<mx:ColumnChart id="columnchart1" height="338" width="396" showDataTips="true" type="clustered" x="10" y="0">
<mx:horizontalAxis>
<mx:CategoryAxis dataProvider="{categoryArray}" categoryField="data"/>
</mx:horizontalAxis>
<mx:series>
<mx:ColumnSeries dataProvider="{sArray}" yField="data" displayName="Series"/>
</mx:series>
</mx:ColumnChart>
</mx:Panel>
</mx:Application>

Thanks in advance
I am using create method of the salesforce toolkit for flex to enter the new record in the table and I want the ID of the inserted record to proceed further the callback function gives me the result object which when alerted using following syntax gives me a string that contains id.
Is there any method by which I can get the id of the inserted record in the code below?
 
Code:
private function CloneOpportunityType():void
 {
  try{
    var EMASOpportunityTypes:SObject = new SObject('EMAS_Opportunity_Types__c');
   EMASOpportunityTypes.Name = txtNewOpportunityTypeName.text.toString();
   EMASOpportunityTypes.Description__c = txtAreaOpportunityTypeDescription.text.toString();
   ta.text = EMASOpportunityTypes.toDebugString();
   
   apex.create([EMASOpportunityTypes], new AsyncResponder(
      function (result:Object):void {
       
       Alert.show(ObjectUtil.toString(result));
     }, genericFault
    ) );
  }
  catch (err:Object)
  {
   //Alert.show("");
  }
 }

 

Message Edited by Ron Hess on 08-12-2007 04:42 PM

Hi all,
 Is there any way by which I can set an s-control to run periodically?
This has become quite significant for me.
Thanks very much.
Hello Everybody;
SForce has added trigger feature in new API; but I am not able to find any help on that.Can anybody give me example on creatingthe triggers
Lets say I want to write beforeUpdate trigger for Opportunity object
                          
Hello Everybody;
               
Hi all;
         I am using C# for development.I want to make a database query for the table ans show all the velues to use from that table using query command.Table name will be provided by user at runtime.and I have to show all colums with all valus fro that table.Pls give me the sample code.
         Please keep in mind it is in C# and table name will be provided by user at runtime.
Hi all;
                  I want to replicate the particular table(object like task,contact) into a sql table on my local machine.Can salesforce API provide any way to get the equivalent sql commands(create table) so that by executing that command I can replicate the particular salesforce table on my local sql server(MS SQL 2000).Right now I am getting metadata of a prticular table and writting loops to replicate the table.But it is very complex process.Is there any other alternative?
 
Rohit
Dear All;
                     I have created one SControl using AJAX toolkit to fetch the data from salesforce database and to display it in tabular format.As soon as I select filters and click the show report button the query starts fetching data from the database.During the query run the page gets freezed.
                    Actually I want to show the progress bar when query is busy.I tried this using javascript timer,usuing table in marquee, and some ready made progressbars available on net; but each time whenquery starts running every progressbar stops its animation(Movement) as the whole page, freezes.
                    I even tried with using callback function.It oks well when I show progrss in a form of text(percentage).But for progressbar it fails as timer stops working.
                    Can anyone give me the solution with example because I tried all the options in my mind.
Small example with explaination will help me lot.
 
Thanks in advance
Dear All;
                     I have created one SControl using AJAX toolkit to fetch the data from salesforce database and to display it in tabular format.As soon as I select filters and click the show report button the query starts fetching data from the database.During the query run the page gets freezed.
                    Actually I want to show the progress bar when query is busy.I tried this using javascript timer,usuing table in marquee, and some ready made progressbars available on net; but each time whenquery starts running every progressbar stops its animation(Movement) as the whole page, freezes.
                    I even tried with using callback function.It oks well when I show progrss in a form of text(percentage).But for progressbar it fails as timer stops working.
                    Can anyone give me the solution with example because I tried all the options in my mind.
Small example with explaination will help me lot.
 
Thanks in advance
  
    Hi ,

I want to display the UI as following with help of EXT JS library and visual force page.



Header-1

Header-2

Header-3

Header-4

Col-1

Col-2

Col-1

Col-2

Col-3

Col-1

Col-1

data

data

data

data

data

data

Data

data

data

data

data

data

data

Data



Please give me some reference to get this.
 
 
Thanks & Regards
Yash

  • August 06, 2008
  • Like
  • 0
Hi,
   I am using connection.js in visualforce page, to insert data into SObject. The functionality is working fine.The problem is I have to provide user name and password in the  following statement.sforce.connection.login("username","password") . Is there a way to avoid this statement in the javascript. please find the code below.
Code:
<apex:page controller="ReplenishableLocations2">
<script src="/soap/ajax/13.0/connection.js"></script> 
<script>
/* This method is used to select 
       or deselect all checkboxes*/
function selectordeselect(field,box){
        if(box.checked){
          for(i=0;i<field.length;i++){
            field[i].checked = true;
          }
        }else if(!box.checked){

            for(i=0;i<field.length;i++)
               field[i].checked = false;
         }
}


/* this method reads the values and
       stores them in the SObject*/
   function store(){
        items = document.getElementsByName("itemsname");
        itemArray = new Array();
        j=0;
        for(i=0;i<items.length;i++){
          if(items[i].checked){
            itemArray[j] = items[i].value;
            j = j+1;
          }        
        }        
        locations = document.getElementsByName("locationsname");
        locationArray = new Array();
        k =0;
        for(l=0;l<locations.length;l++){
          if(locations[l].checked){
            locationArray[k] = locations[l].value;
            //alert(locationArray[k]);
            k = k+1;
          }        
        } 
        var itemlocations = new Array();
        var count = 0;
        var twoD = 0;
         itemlocations[0] = new Array();
         for(m=0;m<itemArray.length;m++){
           for(n=0;n<locationArray.length;n++){                  
                  var itemloc = new sforce.SObject("Item_location__c");
                  itemloc.Item_Name__c = itemArray[m];
                  itemloc.Location_Name__c = locationArray[n];
                  itemloc.ItemLoc_ExId__c = itemArray[m]+"at"+locationArray[n];
                  itemlocations[twoD].push(itemloc);
                 // alert(itemloc);
                  count = count + 1;
                  if(count==200){
                    twoD = twoD + 1; 
                      itemlocations[twoD] = new Array();
                    count = 0;                
                  }                  
            }
        } 
        
       var callCompleted = false;
    try {//the login statement needs to be avoided?
         sforce.connection.login("admin@applabde364.com", "mypasswordxxxxx");
           for(var iter=0;iter<itemlocations.length;iter++){
          // alert(iter+ "====" + itemlocations.length);
           var itemloc = new Array();
            itemloc  =  itemlocations[iter];
           // alert(itemloc);
           //alert("Item locations"+itemlocations[iter]);      
             var result = sforce.connection.create(itemlocations[iter]);
             callCompleted = true;
              for (var i=0; i<result.length; i++) {
                 if (result[i].getBoolean("success")) {
                    log("new Item_Location__c created with id " + result[i].id);
                 } else {
                   log("failed to create Item_Location__c " + result[i]);
                 }
              }
           }
   } catch(error) {
     alert("Failed to insert Item Location with error: " + error);
   }

} 
function log(message) {
    alert(message);
}   
</script>

<apex:form >
<apex:pageBlock id="pageblock">
<input type="checkbox" name="masteritem" id="masterItem" onclick="selectordeselect(document.getElementsByName('itemsname'),document.getElementById('masterItem'));">SelectAllItems<br/>
<apex:pageblockSection title="Items" id="pageblocksec1">
<apex:datatable value="{!items}" var="iter">
<apex:column >
<input type="checkbox" value="{!iter.Item_Name__c}" name="itemsname">{!iter.Item_Name__c}
</apex:column>
</apex:datatable>
</apex:pageblockSection>
<input type="checkbox" name="masterLocation" id="masterLocation" onclick="selectordeselect(document.getElementsByName('locationsname'),document.getElementById('masterLocation'));">SelectAllLocations<br/>

<apex:pageblockSection title="Locations" id="pageblocksec2">
<apex:datatable value="{!locations}" var="iterations">
<apex:column >
<input type="checkbox" value="{!iterations.Location_Name__c}" name="locationsname">{!iterations.Location_Name__c}
</apex:column>
</apex:datatable>
</apex:pageblockSection>
<apex:commandButton onclick="store();" value="Submit" rerender="outblock"></apex:commandButton>
</apex:pageBlock>
</apex:form> 
</apex:page>

 The controller:
Code:
public class ReplenishableLocations2 {

String message =  null;

Public List<Item__c> getItems(){
List<Item__c> items = new List<Item__c>();
items = [select Item_Name__c from Item__c order by Item_Name__c];
if(items == null){
  this.setmessage('Currently there are no Items to Display, Please add items');
}
return items;

}
public List<Location__c> getLocations(){
List<Location__C> locations = new List<Location__c>();
locations = [select Location_Name__c from Location__c order by Location_Name__c];
if(locations==null){
  this.setMessage('There are no Locations added to display, Please add Locations');
}
return locations;
}


public void setmessage(String s){
  this.message = s;
}
public String getMessage(){
  return this.message;
}



}

 
Here I am invoking the javascript on "onclick" event. The username and password are hardcoded in the javascript. I am not supposed to do the hardcoding, neither the user will enter the user id and password as he will be already logged in.
Hello,
 
I am having difficulties attempting to run the Microsoft Excel ContentType example on page 43 of the Visualforce Developers Guide.  Is there anything incorrect in the example as shown in the guide? 
 
I am able to get satisfactory results using a few other contenttypes, such as (1) text/html, (2) text/plain, and (3) text/richtext, but Internet Explorer 7 cannot open or save the resulting file.
 
Has anyone any ideas to share about this?  Oh, yeah, I'm a newbie...
 
Thanks in advance.
  • March 20, 2008
  • Like
  • 0
I am using create method of the salesforce toolkit for flex to enter the new record in the table and I want the ID of the inserted record to proceed further the callback function gives me the result object which when alerted using following syntax gives me a string that contains id.
Is there any method by which I can get the id of the inserted record in the code below?
 
Code:
private function CloneOpportunityType():void
 {
  try{
    var EMASOpportunityTypes:SObject = new SObject('EMAS_Opportunity_Types__c');
   EMASOpportunityTypes.Name = txtNewOpportunityTypeName.text.toString();
   EMASOpportunityTypes.Description__c = txtAreaOpportunityTypeDescription.text.toString();
   ta.text = EMASOpportunityTypes.toDebugString();
   
   apex.create([EMASOpportunityTypes], new AsyncResponder(
      function (result:Object):void {
       
       Alert.show(ObjectUtil.toString(result));
     }, genericFault
    ) );
  }
  catch (err:Object)
  {
   //Alert.show("");
  }
 }

 

Message Edited by Ron Hess on 08-12-2007 04:42 PM

I need to attach a file to a custom object through an scontrol.  I would like to be able to use code similar to the following but the code displayed here does not work.  Does anyone have any ideas?
 
if (frmFile != "") {
     var _refAttach = new Sforce.Dynabean("Attachment");
     _refAttach.set("Body", frmFile);
     var saveAttachment = sforceClient.Create([_refAttach]);
     alert("Created ID: " + saveAttachment[0].id);
} else {
     alert("Please browse for a file!");
}