• nask
  • NEWBIE
  • 130 Points
  • Member since 2010

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 39
    Replies
Hi I need to draw a VF Bar chart, i need to group by 2 fields. Say Example I have 1 Field is Sales regiona and Another is Status. I want to show in bar show in bar chart and how many differnet status are present in each Slaesregion. 

Screen Shot

Can any one tell me if this is achieveble in salesforce charting, and if yes then can any point me to an example where there have grouped by 2 fields.
  • January 24, 2014
  • Like
  • 0

Hi Everyone.

 

We have a requirement in salesforce where i need to communicate with other system using API -- which is not a problem .

 

But the problem is the other ther system is very old and it can handle only one requests in every 3 seconds. So i cant sent multiple requests in one go.

 

So did any body has done anything like those before? 

 

I know following options, but none of them meet our requirements:

 

1) Using VF page and Actionpoller. But this need VF page to be open all the time & doesnt meet our requirements. we want more dynamic and reliable.

 

2) Introduce delay in apex code by usign dummy for loop to run for random times - This is not good way & we are more likely to hit the script statments limit . 

 

4) I can use the apex schduler but salesforce gives flexibility to run every hour not every min. :(  So i need to send atleast 60 requests in every hour, even this fails to meet our requirment.

 

3) Use Cronkit  app - As we are already use it for other functioanlity. I am not sure how best it can be used.   Can any one please answer my following basic fuction:

 

a) As of now we use cornkit to implement one class to execute every 15 mins . So can i create one more cron batch in the same org to execute one more class??  

 

b) What minimum frequency can i set up a cron batch, Can it be as low as 1 min. ?

 

c) present bacth with is supposed to run every 15 min runs some wherre around 25 min , so adding one more cron bacth would have any impact on the exisiting ones or the new ones?

 

 

If any one has implemented any thing of this sort of requirement, please share your thoughts.

 

 

Thanks

Ashok

  • October 09, 2013
  • Like
  • 0

HI i was just wondering can you call a REST API service from a batch class?

 

 

And also the API resonpose can only take one request in 3 secs. So can is there can we make a API call with a time delay in it?

 

Any help will be much appreciated.

 

 

  • September 27, 2013
  • Like
  • 0

Hi I am trying to override New button using S control.

What i am trying to achieve here is open normal salesforce stabdard new page but prepopulate one of the picklist field with profile name.

 

I using this s-control.

 

<html>
<head>
<script src="/soap/ajax/13.0/connection.js">
</script>
<script>
function init()
{
var idVal = ( (window.parent.location).toString() );

idVal = idVal.split('retURL=%2F')[1].substring(0,15);

//alert(idVal.length);
var profile="{!$Profile.Name}";
var hstring = "/a0V/e?retURL=%2Fnooverride=1&a0V&00NW0000000iiaV="+profile;
if(idVal.length ==7)
{
alert(idVal.length);
this.parent.location.href =hstring;
}

}
</script>
</head>
<body onload="init()">
<p>&nbsp;</p>
</body>
</html>

 

But the problem is this is ending up with blank white page. but the same URL which i am trying to create works fine with a custom button. if i try using scontrol & then overeride New button its ends up in blank screen.

 

 

 

Thanks

Ashok

  • September 23, 2013
  • Like
  • 0

Hello Everyone,

 

I have a VF page where i use a Java script to invoke a apex:actionfunction which works perfectly fine wher we dont declare doctype on the page. But the same Javascript doesnt invoke the actionfunction when the page has doctype declared? Can any one help.

 

I am using HTML-5.0 in order to use the new apex:input & type attribute on vf page. which i have not shown in the page to keep it simple.

 

Thanks

 

Ashok

 

This code works:

 

<apex:page controller="cocController"  id="page" >
<apex:form >

 

<script type="text/javascript">

    function exportImage(){
                    saveFormUnique();
        }
   

</script>

<apex:actionfunction name="saveFormUnique" action="{!saverecord}">

<apex:pageBlock id="blk1">
 
    <apex:pageblockButtons location="bottom">
       <apex:commandButton onclick="exportImage();" value="Save  Generate PDF"  oncomplete="alert('ok');" />
    </apex:pageblockButtons>

</apex:pageBlock>

</apex:form>

</apex:page>

 

This code doesnt work:

 

 

<apex:page controller="cocController"  id="page" >
<apex:form >

 

<script type="text/javascript">

    function exportImage(){
                    saveFormUnique();
        }
   

</script>

<apex:actionfunction name="saveFormUnique" action="{!saverecord}" doctype="html-5.0">

<apex:pageBlock id="blk1">
 
    <apex:pageblockButtons location="bottom">
       <apex:commandButton onclick="exportImage();" value="Save  Generate PDF"  oncomplete="alert('ok');" />
   
    </apex:pageblockButtons>

</apex:pageBlock>

</apex:form>

</apex:page>

 

 

  • September 11, 2013
  • Like
  • 0

Hi I am using Border Radius property in my VF page.

 

It works fine in VF page but at the same page does not sustain this style when renderd as PDF.

 

I have used many other styles on the same page like background color and border etc, which works fine in both VF page.

 

Thanks

Ashok

  • September 03, 2013
  • Like
  • 0

HI I have a requirement where we need to show an image in a background of the page but due to some reasons pic on the page is show only 1/2. I want the complete image to be shown with a scroll bar.

but sue to some reasons i cant see th scroll bar as well.

 can any one help?

 

 

 

<apex:page sidebar="false" standardStylesheets="false" showHeader="false" applyBodyTag="true">
<apex:form >
<apex:pageBlock >
<html>  
<head>
<style type="text/css" > 

@page{
            size: 8.32in 11.69in;
            margin-top:0px;
            margin-right:0px;
            margin-left:0px;
            margin-bottom:0px;
            overflow:scroll;
       }

 
body
{
   
    background-image:url({!$Resource.COC1});
    background-repeat:no-repeat;
    overflow = scroll;
  
    
}

        
</style>


<body >



</body >


</head>
</html>
</apex:pageBlock>
</apex:form>
</apex:page>

 

  • August 30, 2013
  • Like
  • 0

Hi I need to develop a pdf which looks like this below:

 

 

 

I have used follwing code to develop this one. but

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

<html>
<head>
<style type="text/css" media="print,screen"> 
    
   
  
    .container1
	{
	width:48%;
	margin:2px;
	border:1px solid gray;
	line-height:150%;
	background-color:#8FD8FF;
	text-align:justify;
	}
	
	.container2
	{
	width:48%;
	margin:2px;
	border:1px solid gray;
	position:absolute;
	top:185px;
	right:15px;
	background-color:#8FD8FF;
	height:65%;
	}
	
	.container3
	{
	width:99%;
	margin:2px;
	border:1px solid gray;
	background-color:#8FD8FF;
	height:20%;
	}
	
	.container4
	{
	width:48%;
	margin:2px;
	border:1px solid gray;
	position:absolute;
	top:790px;
	right:15px;
	background-color:#8FD8FF;
	
	}
	
	.container5
	{
	width:48%;
	margin:2px;
	border:1px solid gray;
	position:absolute;
	top:840px;
	right:15px;
	background-color:#8FD8FF;
	height:25%;
	}
	
	.container6
	{
	width:48%;
	margin:2px;
	border:1px solid gray;
	position:absolute;
	top:1120px;
	right:15px;
	background-color:#8FD8FF;
	height:15%;
	}
    .bold
    {
    	margin-left:5px;
    	margin:1px;
    	font-family:Calibri; 
    	font-size:25px; 
    	font-weight:bold;
    	line-height:120%;
    }      
    .normal
    {
    	margin-left:5px;
    	margin:2px;
    	font-family:Calibri; 
    	font-size:15px; 
    	font-weight:bold;
    }
    .bgText
    {
    	font-family:Agency FB; 
    	font-size:25px; 
    	font-weight:bold; 
    	color:#8FD8FF; 
    	letter-spacing:2px;
    }
</style>
</head>
<body>

<div class="container1">

<p class ="bold">Condensing Boiler</p>
<p class ="normal">Natural gas fired and liquified petroleum gas fired:</p>

</div>
<br/>
<div class="container1">

<p class ="bold">Micro Combined heat and power (Micro-CHP)</p>


</div>
<br/>
<div class="container1">

<p class ="bold">Heating and hot water controls:</p>
<p class ="normal">TRV's</p>
<p class ="normal">Programmers</p>
<p class ="normal">Room Thermostats</p>
<p class ="normal">Timer and Temperature Control Devices</p>


</div>
<br/>
<div class="container1">
<div>
<p class ="bold">Heating system insulation:</p>
<p class ="normal">Ducting</p>
<p class ="normal">Pipes</p>
<p class ="normal">Cylinders</p>
</div>
</div>
<br/>
<div class="container1">
<p class ="bold">Solar Thermal</p>
</div>

<div class="container2">

<p class = "bold">Notes:</p></div>

<br/>
<div>


</div>
</body>
</html>



</apex:form>

</apex:page>

 Bur when i use Renderas = "PDf" it looses it format. So can any help how can i achieve this as i have very less exp in CSS.

  • August 28, 2013
  • Like
  • 0

Our company has recently buyed Google business license i am trying to client id the key and private key to generate the signature but i am not sucessfull. Please see the code below and help me if any one has done it before:

 

string origin = 'sk12lg';
string destination = 'm130ws';
string GoogleBaseUrl = 'http://maps.googleapis.com';  
string clientid = '**********************';
string privateKey = '*********************';
string domain = '/maps/api/distancematrix/json?';
string query = 'origins='+origin+'&destinations='+destination+'&sensor=false&units=imperial&client='+clientid;
//string inputStr = EncodingUtil.urlEncode(domain+query, 'UTF-8');
string inputStr = domain+query;
system.debug('Sign Url-->'+inputStr );
String algorithmName = 'hmacSHA1';
Blob mac = Crypto.generateMac(algorithmName,  Blob.valueOf(inputStr), Blob.valueOf(privateKey));
String macUrl = EncodingUtil.urlEncode(EncodingUtil.base64Encode(mac), 'UTF-8');
string encodedMac = EncodingUtil.base64Encode(mac);
system.debug('mac-->'+encodedMac);
system.debug('macUrl----->'+macUrl);
string finalUrl = GoogleBaseUrl +domain+query+'&signature='+encodedMac;
system.debug('finalUrl--->'+finalUrl);

Http obj_Http = new Http();
HttpRequest http_Req = new HttpRequest();
http_Req.setEndpoint(finalUrl);
http_Req.setMethod('GET');
http_Req.setTimeout(60000);  
HttpResponse http_Res = obj_Http.send(http_Req);
System.debug('STATUS:'+http_Res .getStatus());
System.debug('STATUS_CODE:'+http_Res .getStatusCode());
System.debug('BODY: '+http_Res .getBody());

 

I have tried usind encodedmac and macUrl but result is same :(.

  • April 04, 2013
  • Like
  • 0

have anyone trried using NEXT_N_DAYS:n in dataloader query ? i know that this can be used in apex but can that be used in dataloader?

 

 

my requriment is to run a query in dataloader using something ilike today+ 3? so any one can help?

  • October 23, 2012
  • Like
  • 0

Hi, I would like to know weather anyone has worked someting similar to text servie which is simialr to email service in salesforce? is it possible to invoke a apex class when a text message is sent to salesforce org?

  • January 31, 2012
  • Like
  • 0

how to use @readonly notatio. can any one explain with an example.

  • January 09, 2012
  • Like
  • 0

Is there any way to stop the user entering required number of characters when it reaches its field size. For ex if the field lenght is 10 then stop showing him characters after 10 th character even if he tries to enter any character.

  • December 29, 2011
  • Like
  • 0

HI I have two VF page and corresponding to them i have 2 controllers.

 

In first page i invoke a method on page load where it gets text version vf page2 and sends it in a form of attachement.

 

i have used VF page because to create a specific format.

 

So i get a get text attached email every time i load my first VF page but when i try to automate it by using a  batch class its sending the mail with text attachment but with  incorrect data.  Any idea how can this achieved.

 

We need to automate this sending of mail from salesforce.

 

this file contains data from two different objects and for more than one record.

 

  • November 22, 2011
  • Like
  • 0

Hi  i have a requirement where i need to add a fixed amount of spaces before a Word. for example we have a word 'SALESFORCE' then i need to add fixed amount of space i.e 10 spaces before it or after it like "          Salesforce" or "SALESFORCE          ". How could i achieve this?

 

This requirement is for creating a text attachememnt where our third party  reads this and does its work.

  • November 18, 2011
  • Like
  • 0

Hi
Is there is any way we can get rid of

 

How can we get rid of Save and New Button from Edit page layout of a record.

 

Thanks in Adavnce.

  • October 11, 2011
  • Like
  • 0
Hi I need to draw a VF Bar chart, i need to group by 2 fields. Say Example I have 1 Field is Sales regiona and Another is Status. I want to show in bar show in bar chart and how many differnet status are present in each Slaesregion. 

Screen Shot

Can any one tell me if this is achieveble in salesforce charting, and if yes then can any point me to an example where there have grouped by 2 fields.
  • January 24, 2014
  • Like
  • 0

Hi Everyone.

 

We have a requirement in salesforce where i need to communicate with other system using API -- which is not a problem .

 

But the problem is the other ther system is very old and it can handle only one requests in every 3 seconds. So i cant sent multiple requests in one go.

 

So did any body has done anything like those before? 

 

I know following options, but none of them meet our requirements:

 

1) Using VF page and Actionpoller. But this need VF page to be open all the time & doesnt meet our requirements. we want more dynamic and reliable.

 

2) Introduce delay in apex code by usign dummy for loop to run for random times - This is not good way & we are more likely to hit the script statments limit . 

 

4) I can use the apex schduler but salesforce gives flexibility to run every hour not every min. :(  So i need to send atleast 60 requests in every hour, even this fails to meet our requirment.

 

3) Use Cronkit  app - As we are already use it for other functioanlity. I am not sure how best it can be used.   Can any one please answer my following basic fuction:

 

a) As of now we use cornkit to implement one class to execute every 15 mins . So can i create one more cron batch in the same org to execute one more class??  

 

b) What minimum frequency can i set up a cron batch, Can it be as low as 1 min. ?

 

c) present bacth with is supposed to run every 15 min runs some wherre around 25 min , so adding one more cron bacth would have any impact on the exisiting ones or the new ones?

 

 

If any one has implemented any thing of this sort of requirement, please share your thoughts.

 

 

Thanks

Ashok

  • October 09, 2013
  • Like
  • 0

Hi I am trying to override New button using S control.

What i am trying to achieve here is open normal salesforce stabdard new page but prepopulate one of the picklist field with profile name.

 

I using this s-control.

 

<html>
<head>
<script src="/soap/ajax/13.0/connection.js">
</script>
<script>
function init()
{
var idVal = ( (window.parent.location).toString() );

idVal = idVal.split('retURL=%2F')[1].substring(0,15);

//alert(idVal.length);
var profile="{!$Profile.Name}";
var hstring = "/a0V/e?retURL=%2Fnooverride=1&a0V&00NW0000000iiaV="+profile;
if(idVal.length ==7)
{
alert(idVal.length);
this.parent.location.href =hstring;
}

}
</script>
</head>
<body onload="init()">
<p>&nbsp;</p>
</body>
</html>

 

But the problem is this is ending up with blank white page. but the same URL which i am trying to create works fine with a custom button. if i try using scontrol & then overeride New button its ends up in blank screen.

 

 

 

Thanks

Ashok

  • September 23, 2013
  • Like
  • 0

Hello Everyone,

 

I have a VF page where i use a Java script to invoke a apex:actionfunction which works perfectly fine wher we dont declare doctype on the page. But the same Javascript doesnt invoke the actionfunction when the page has doctype declared? Can any one help.

 

I am using HTML-5.0 in order to use the new apex:input & type attribute on vf page. which i have not shown in the page to keep it simple.

 

Thanks

 

Ashok

 

This code works:

 

<apex:page controller="cocController"  id="page" >
<apex:form >

 

<script type="text/javascript">

    function exportImage(){
                    saveFormUnique();
        }
   

</script>

<apex:actionfunction name="saveFormUnique" action="{!saverecord}">

<apex:pageBlock id="blk1">
 
    <apex:pageblockButtons location="bottom">
       <apex:commandButton onclick="exportImage();" value="Save  Generate PDF"  oncomplete="alert('ok');" />
    </apex:pageblockButtons>

</apex:pageBlock>

</apex:form>

</apex:page>

 

This code doesnt work:

 

 

<apex:page controller="cocController"  id="page" >
<apex:form >

 

<script type="text/javascript">

    function exportImage(){
                    saveFormUnique();
        }
   

</script>

<apex:actionfunction name="saveFormUnique" action="{!saverecord}" doctype="html-5.0">

<apex:pageBlock id="blk1">
 
    <apex:pageblockButtons location="bottom">
       <apex:commandButton onclick="exportImage();" value="Save  Generate PDF"  oncomplete="alert('ok');" />
   
    </apex:pageblockButtons>

</apex:pageBlock>

</apex:form>

</apex:page>

 

 

  • September 11, 2013
  • Like
  • 0

Hi I need to develop a pdf which looks like this below:

 

 

 

I have used follwing code to develop this one. but

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

<html>
<head>
<style type="text/css" media="print,screen"> 
    
   
  
    .container1
	{
	width:48%;
	margin:2px;
	border:1px solid gray;
	line-height:150%;
	background-color:#8FD8FF;
	text-align:justify;
	}
	
	.container2
	{
	width:48%;
	margin:2px;
	border:1px solid gray;
	position:absolute;
	top:185px;
	right:15px;
	background-color:#8FD8FF;
	height:65%;
	}
	
	.container3
	{
	width:99%;
	margin:2px;
	border:1px solid gray;
	background-color:#8FD8FF;
	height:20%;
	}
	
	.container4
	{
	width:48%;
	margin:2px;
	border:1px solid gray;
	position:absolute;
	top:790px;
	right:15px;
	background-color:#8FD8FF;
	
	}
	
	.container5
	{
	width:48%;
	margin:2px;
	border:1px solid gray;
	position:absolute;
	top:840px;
	right:15px;
	background-color:#8FD8FF;
	height:25%;
	}
	
	.container6
	{
	width:48%;
	margin:2px;
	border:1px solid gray;
	position:absolute;
	top:1120px;
	right:15px;
	background-color:#8FD8FF;
	height:15%;
	}
    .bold
    {
    	margin-left:5px;
    	margin:1px;
    	font-family:Calibri; 
    	font-size:25px; 
    	font-weight:bold;
    	line-height:120%;
    }      
    .normal
    {
    	margin-left:5px;
    	margin:2px;
    	font-family:Calibri; 
    	font-size:15px; 
    	font-weight:bold;
    }
    .bgText
    {
    	font-family:Agency FB; 
    	font-size:25px; 
    	font-weight:bold; 
    	color:#8FD8FF; 
    	letter-spacing:2px;
    }
</style>
</head>
<body>

<div class="container1">

<p class ="bold">Condensing Boiler</p>
<p class ="normal">Natural gas fired and liquified petroleum gas fired:</p>

</div>
<br/>
<div class="container1">

<p class ="bold">Micro Combined heat and power (Micro-CHP)</p>


</div>
<br/>
<div class="container1">

<p class ="bold">Heating and hot water controls:</p>
<p class ="normal">TRV's</p>
<p class ="normal">Programmers</p>
<p class ="normal">Room Thermostats</p>
<p class ="normal">Timer and Temperature Control Devices</p>


</div>
<br/>
<div class="container1">
<div>
<p class ="bold">Heating system insulation:</p>
<p class ="normal">Ducting</p>
<p class ="normal">Pipes</p>
<p class ="normal">Cylinders</p>
</div>
</div>
<br/>
<div class="container1">
<p class ="bold">Solar Thermal</p>
</div>

<div class="container2">

<p class = "bold">Notes:</p></div>

<br/>
<div>


</div>
</body>
</html>



</apex:form>

</apex:page>

 Bur when i use Renderas = "PDf" it looses it format. So can any help how can i achieve this as i have very less exp in CSS.

  • August 28, 2013
  • Like
  • 0

Our company has recently buyed Google business license i am trying to client id the key and private key to generate the signature but i am not sucessfull. Please see the code below and help me if any one has done it before:

 

string origin = 'sk12lg';
string destination = 'm130ws';
string GoogleBaseUrl = 'http://maps.googleapis.com';  
string clientid = '**********************';
string privateKey = '*********************';
string domain = '/maps/api/distancematrix/json?';
string query = 'origins='+origin+'&destinations='+destination+'&sensor=false&units=imperial&client='+clientid;
//string inputStr = EncodingUtil.urlEncode(domain+query, 'UTF-8');
string inputStr = domain+query;
system.debug('Sign Url-->'+inputStr );
String algorithmName = 'hmacSHA1';
Blob mac = Crypto.generateMac(algorithmName,  Blob.valueOf(inputStr), Blob.valueOf(privateKey));
String macUrl = EncodingUtil.urlEncode(EncodingUtil.base64Encode(mac), 'UTF-8');
string encodedMac = EncodingUtil.base64Encode(mac);
system.debug('mac-->'+encodedMac);
system.debug('macUrl----->'+macUrl);
string finalUrl = GoogleBaseUrl +domain+query+'&signature='+encodedMac;
system.debug('finalUrl--->'+finalUrl);

Http obj_Http = new Http();
HttpRequest http_Req = new HttpRequest();
http_Req.setEndpoint(finalUrl);
http_Req.setMethod('GET');
http_Req.setTimeout(60000);  
HttpResponse http_Res = obj_Http.send(http_Req);
System.debug('STATUS:'+http_Res .getStatus());
System.debug('STATUS_CODE:'+http_Res .getStatusCode());
System.debug('BODY: '+http_Res .getBody());

 

I have tried usind encodedmac and macUrl but result is same :(.

  • April 04, 2013
  • Like
  • 0

Is there any way to stop the user entering required number of characters when it reaches its field size. For ex if the field lenght is 10 then stop showing him characters after 10 th character even if he tries to enter any character.

  • December 29, 2011
  • Like
  • 0

Hi,

 

I need to construct a CSV file with APEX and am a bit new to this cloud computing.

Do you have any sample code I could get started with that, or a resources that you can point me to develop and generate a  CSV File to send through the Email??

 

Can this be achieved in salesforce by any Way?

  • December 29, 2011
  • Like
  • 0

I'm wondering is it possible to create Excel or CSV file in apex code (as attachment) is it possible ? currently i only see it works with VF page, but i'm looking to do it in apex code not using vf page, I don't see any options.

 

Any help is appreciated.

 

Thanks

Ram

 

  • December 29, 2011
  • Like
  • 0

HI I have two VF page and corresponding to them i have 2 controllers.

 

In first page i invoke a method on page load where it gets text version vf page2 and sends it in a form of attachement.

 

i have used VF page because to create a specific format.

 

So i get a get text attached email every time i load my first VF page but when i try to automate it by using a  batch class its sending the mail with text attachment but with  incorrect data.  Any idea how can this achieved.

 

We need to automate this sending of mail from salesforce.

 

this file contains data from two different objects and for more than one record.

 

  • November 22, 2011
  • Like
  • 0

Hi  i have a requirement where i need to add a fixed amount of spaces before a Word. for example we have a word 'SALESFORCE' then i need to add fixed amount of space i.e 10 spaces before it or after it like "          Salesforce" or "SALESFORCE          ". How could i achieve this?

 

This requirement is for creating a text attachememnt where our third party  reads this and does its work.

  • November 18, 2011
  • Like
  • 0

Is this possible and, if so, how? Any advice would be much appreciated. I am trying to avoid the VF route because the rich text fields have more flexibility with the pictures. However, most of my clients show up with 1000+ pictures that need to be associated with a custom object in my app and I need to mass upload. 

Hi,

 

I tried googling around, but I couldn't really find what I am looking for. What are currently the options of changing the behaviour and content of standard (new/edit) pages? See below for the scenario I would like to create.

 

I would like to create address lookup based on postcode details. For this I would like to modify existing pages for accounts.So I created a sidebar component and added some javasript to modify the components. Unfortunately, when deploying to sandbox I found out that it will not work, because different server addresses for the visual force servers

 

[code]

window.parent.document.getElementById('acc17country')

[/code]

 

Since the account has a lot of fields I don't really like to go into the way of full recreate the new/edit pages with a new visual force page.

 

So I am looking for ways to modify the content, I know there are some things possible like adding a (floatable) picklist for the countries in this app CountryCompleteFree. But I cannot really understand how they are doing this. Any help will be appreciated.