• Taneja
  • NEWBIE
  • 55 Points
  • Member since 2012

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

I created a visualforce page that displays the opportunity owner's phone number with the standard U.S. formatting "(555) 555-5555". Since the phone number is retrieved from the database unformatted (e.g. "5555555555"), I uploaded the jquery 1.9.1 library as a static resource and added a script to format the number as shown below. It works perfectly, however, when I try to render the page as pdf it no longer displays with the formatting. Is there any way to display it without having to create a controller extension? And if not, what is the simplest controller extension that would format the phone number?

 

<apex:page standardController="Quote" renderAs="pdf">
<head>
<apex:includeScript value="{!$Resource.jquery}"/>
<script>

$(document).ready(function() {
// Attach masks to correct input fields

$(".phone").text(function(i, text) {
text = text.replace(/(\d\d\d)(\d\d\d)(\d\d\d\d)/, "($1) $2-$3");
return text;
});

});

</script>
</head>
<apex:outputText styleClass="phone" value="{!Quote.Opportunity.Owner.Phone}" />
</apex:page>

Even after including the projects (SalesforceSDK and SmartStore) and I am getting the "No resource found" error when i am trying to build the sample AccoundEditor app. can anyone please tell me how to fix this??

Error: No resource found that matches the given name (at 'resource' with value '@xml/authenticator')

 

I am trying to create an app using the forcedroid package.

 

  • October 27, 2013
  • Like
  • 0

I am trying to achieve a simple thing but somehow not able to get the desired result, may be due to my amateur CSS skills.

I have an apex:inputcheckbox and all I want is, when someone selects this checkbox, the CSS of accompanying should change i.e., just to show this one is highlighted. Just want to make it bold and different colour. Here is my sample:

 

<apex:pageBlockSectionItem > 
            <apex:inputCheckbox value="{!Dept2}" label="">Elektron
                <apex:actionsupport event="onchange" action="{!getSomething}" rerender="working" />     
            </apex:inputCheckbox>   
</apex:pageBlockSectionItem>

 

The inputcheckbox is a subsection in pageBlockSectionItem. There are 10 items for the user to select and I want to highlight which one he has selected. When I display "Elektron" in the label, it doesn't show you up on the screen.

The function getSomething is an apex page-reference function and displays result in another PageBlockSection depending upon user selection

It doesn't matter if we use jquery or not, although I believe this can be achieved without query.

Many thanks in advance.

  • October 21, 2013
  • Like
  • 0

Hello All,

 

I have installed a Managed Beta Package in a Group edition Org. I have a Apex batch job which runs onClick of a button and saves the results to a Custom Object.

 

I then display the results in an apex:pageBlockTable. The issue is: I don't see any result in the table, i.e. it shows me there are 6 rows but does not display any values in the columns. Not even in any one of them.

 

In the Last 2 columns I have Custom Buttons which perform CRUD operations on individual row elements. I see the buttons and when you click on one of these buttons, I get "System.QueryException: List has no rows for assignment to SObject".

 

Here is a preview: https://www.dropbox.com/s/rxqhv64hsqi1kqg/emptyTable.tiff

 

Can anyone tell me whats going on here?? Why do I see empty rows?? Are batch jobs supported in GE/PE??

 

Same issue with Professional Edition as well. Although it works perfectly fine in EE, UE and DE orgs.

 

Any help would be highly appreciated.

 

Best,
Taneja

Hi All,

 

I am trying to have a jquery slideToggle() function bound to a row of data in an apex:pageBlockTable.

 

I am displaying some information in the table and want that if someone clicks on any row, some more information related to that contact is displayed in a slider and the rest of the rows move down. When he clicks again, the slider moves up and everything is back to normal.

 

If I am not wrong, I think I need to bind row elements (apex:columns) in one div and the information in the slider in the other. But somehow this is not working.

 

Here is the code:

 

<apex:page controller="xingShowSearchResult">

<head>
<style type="text/css"> 
#rowInfo,#rows
{
	padding:5px;
	text-align:center;
	background-color:#e5eecc;
	border:solid 1px #c3c3c3;
}
#rowInfo { 
	width:50px;
	display:none; 
}
 </style>
    
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>

<script>
$j = jQuery.noConflict();

   $j(document).ready(function(){
      $j("#rows").click(function(){
    $j("#rowInfo").slideToggle("slow");
  });
});

</script>

</head>
<body>

<apex:pageMessages />
    <div id='backtoDiv' style="height:20px;">
        <apex:outputLink value="/apex/XingPageTab" style="color:blue;">Back to Home Page</apex:outputLink>
    </div>
    
<apex:pageBlock title="Suche Kontakte"> 
    <apex:pageBlockSection columns="1">
    <apex:form style="float:right" >
        <apex:commandLink style="height:20px;font-weight: bold;" value="Suchergebnisse entfernen" action="{!deleteSearchResult}" />
    </apex:form>
    </apex:pageBlockSection>
    <apex:pageBlockTable value="{!newList}" var="contacts" id="contactsTable">
       
       <div id="rows">
        <apex:column > 
            <apex:image url="{!contacts.photoURL__c}" /> 
        </apex:column>
        
       
        <apex:column headerValue="Name"> {!contacts.displayName__c}</apex:column>
      
        
        <apex:column headerValue="Firma"> {!contacts.firma__c}</apex:column>
        <apex:column headerValue="Title" > {!contacts.title__c}</apex:column>
      </div>
        
               
      
     <div id="rowInfo" >
         <p>
            This is the paragraph to end all paragraphs.  You
            should feel <em>lucky</em> to have seen such a paragraph in
            your life.  Congratulations!
         </p>
     </div>  
     </apex:pageBlockTable>
</apex:pageBlock>              
</body>



</apex:page>

 

I am trying to understand VF and JS so any help would be appreciated.

 

Best,

Ankit

Hello All,

 

I have a Client, who has an Enterprise Edition Org and they have asked us for a quotation for the following project. Since, I am relatively new to Salesforce, I would like your suggestions/comments on the Architecture of the App. 

 

  1. They have a approx. 50 field Technicians helping their Customers. The field technicians do not have salesforce login. The client is not gonna buy too :(
  2. Each Technician has to login to a webform to fill out service details on their iPad, which in return have to be saved in Salesforce. Also, some fields have to be Auto-populated in the webform from SF ( eg. Account Details)
  3. According to the Client, 20% of times, the technicians don't have internet connection on customers place, so the webform should have the capability to save data offline and then send it to SF, when it gets an internet connection.

Here is the Solution that I have planned:

 

  • A Rails App, hosted on Heroku utilizing the Force.com API for sending/receiving data from SF.
  • For offline storage, use HTML5 manifest capabilities and use CouchDB for its replication Engine.

I would like to know any suggestions/feedback regarding the same. Also, if there is a better way to achieve it, plz let me know. 

Would it be advisable to use Force.com REST API?? Any better suggestion for Offiline Storage??

 

Best,

Taneja

  • February 21, 2013
  • Like
  • 0

My Company recently signed up for Google Maps API for business.

 

To use the API, I need to generte a HMacSHA1 signature, and add it to my HTTP request. Unfortunately, somehow, I am not able to generate the right signature.

 

For testing, I am using the values provided by google to ensure that the algorithm works fine and I get the right result. Here is the code:

 

string url = 'maps/api/geocode/json?address=New+York&sensor=false&client=clientID';
string privateKey = 'vNIXE0xscrmjlyV-12Nj_BvUPaw=';

privateKey = privateKey.replace('-', '+');
privateKey = privateKey.replace('_', '/');

 

//Blob privateKeyBlob = EncodingUtil.base64Decode(privateKey);
Blob privateKeyBlob = Blob.valueOf(privateKey);
Blob urlBlob = Blob.valueOf(url);

Blob signatureBlob = Crypto.generateMac('HMacSHA1', urlBlob, privateKeyBlob);

 

String signature =EncodingUtil.urlEncode(EncodingUtil.base64Encode(signatureBlob), 'UTF-8');

signature = signature.replace('+', '-');
signature = signature.replace('/', '_');

 

system.debug('signature is ' +signature);

 

The generated signature should be : KrU1TzVQM7Ur0i8i7K3huiw3MsA=

 

Here is the link to Google Documentation where you can also find the same example: https://developers.google.com/maps/documentation/business/webservices

 

Few points to note:

1. I used the sample Python script provided in API Documentation and it gives the right result.

2. I think the problem is, API Documentation says that we should decode the privateKey and then provide it to the function. Although the documentation for Crypto Class says the "The value of privateKey does not need to be in decoded form.". I tried both, with and without decoding, still no result.

3. For Google API, everything has to be UTF-8 Encoded; I don't know if thats the way Encoding.Util decode's it.

 

I have tried a lot fo combinations, but could not find a solution. Any help would be highly appreciated.

 

Thanks,

Ankit

 

 

 

  • December 14, 2012
  • Like
  • 0

Can anybody help me What is the difference between javascript Remoting and Actionfunction...?

Hi,

 

I am unable to load a hybrid_remote application that is pointing to a remote visual force page on Android.  Here are the steps I followed 

 

1) I installed the following visual force examples into  my DE

   - http://bit.ly/mobile_vf_phonebook

   - and the example mentioned in http://www2.developerforce.com/en/mobile/getting-started/html5#backbone

2) using forcedroid create command I created a hybrid_remote application, I pointed the start page as /apex/PhoneBook or /apex/MobileSample_Backbone (neither pages worked) 

3) I editied oauthRedirectURI (testsfdc:///mobilesdk/detect/oauth/done) and consumerkey in the bootconfig.json.

 

I use ecllipse for building and launching my application, when i launched the app (either on device or simulator) the app simply shows a blank screen.

 

I was expecting it to show a sfdc login screen followed by permission screen and upon clicking allow it would take me to my remote visual force page, but that dint work.

 

Could someone let me know if there is an issue with my configuration ? 

 

Thanks,

 

Nikhil

1. We are executing batch as follows:-
ID batchprocessid1 = Database.executeBatch(new batchAccountsImport(),8);

2. In batchAccountImport code snippet is as follows:-

global class batchAccountsImport implements Database.Batchable<SObject>,Database.AllowsCallouts { 

  public string soql = 'select id,safariUserId__c, isActive from User where isactive = true and safariUserid__c<>NULL LIMIT 2';
  global Database.queryLocator
                    start(Database.BatchableContext ctx){

        return Database.getQueryLocator(soql);
  }
  global void execute(Database.BatchableContext ctx, List<Sobject> scope){

// code

  }

  global void finish(Database.BatchableContext ctx) {

// code

  }

}


The execute method is not getting called and we are getting the CUMULATIVE_LIMIT_USAGE issue even when the query has been limited to 2 users.

Thanks

  • May 24, 2013
  • Like
  • 0

Hi All,

 

I am trying to have a jquery slideToggle() function bound to a row of data in an apex:pageBlockTable.

 

I am displaying some information in the table and want that if someone clicks on any row, some more information related to that contact is displayed in a slider and the rest of the rows move down. When he clicks again, the slider moves up and everything is back to normal.

 

If I am not wrong, I think I need to bind row elements (apex:columns) in one div and the information in the slider in the other. But somehow this is not working.

 

Here is the code:

 

<apex:page controller="xingShowSearchResult">

<head>
<style type="text/css"> 
#rowInfo,#rows
{
	padding:5px;
	text-align:center;
	background-color:#e5eecc;
	border:solid 1px #c3c3c3;
}
#rowInfo { 
	width:50px;
	display:none; 
}
 </style>
    
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>

<script>
$j = jQuery.noConflict();

   $j(document).ready(function(){
      $j("#rows").click(function(){
    $j("#rowInfo").slideToggle("slow");
  });
});

</script>

</head>
<body>

<apex:pageMessages />
    <div id='backtoDiv' style="height:20px;">
        <apex:outputLink value="/apex/XingPageTab" style="color:blue;">Back to Home Page</apex:outputLink>
    </div>
    
<apex:pageBlock title="Suche Kontakte"> 
    <apex:pageBlockSection columns="1">
    <apex:form style="float:right" >
        <apex:commandLink style="height:20px;font-weight: bold;" value="Suchergebnisse entfernen" action="{!deleteSearchResult}" />
    </apex:form>
    </apex:pageBlockSection>
    <apex:pageBlockTable value="{!newList}" var="contacts" id="contactsTable">
       
       <div id="rows">
        <apex:column > 
            <apex:image url="{!contacts.photoURL__c}" /> 
        </apex:column>
        
       
        <apex:column headerValue="Name"> {!contacts.displayName__c}</apex:column>
      
        
        <apex:column headerValue="Firma"> {!contacts.firma__c}</apex:column>
        <apex:column headerValue="Title" > {!contacts.title__c}</apex:column>
      </div>
        
               
      
     <div id="rowInfo" >
         <p>
            This is the paragraph to end all paragraphs.  You
            should feel <em>lucky</em> to have seen such a paragraph in
            your life.  Congratulations!
         </p>
     </div>  
     </apex:pageBlockTable>
</apex:pageBlock>              
</body>



</apex:page>

 

I am trying to understand VF and JS so any help would be appreciated.

 

Best,

Ankit

I created a visualforce page that displays the opportunity owner's phone number with the standard U.S. formatting "(555) 555-5555". Since the phone number is retrieved from the database unformatted (e.g. "5555555555"), I uploaded the jquery 1.9.1 library as a static resource and added a script to format the number as shown below. It works perfectly, however, when I try to render the page as pdf it no longer displays with the formatting. Is there any way to display it without having to create a controller extension? And if not, what is the simplest controller extension that would format the phone number?

 

<apex:page standardController="Quote" renderAs="pdf">
<head>
<apex:includeScript value="{!$Resource.jquery}"/>
<script>

$(document).ready(function() {
// Attach masks to correct input fields

$(".phone").text(function(i, text) {
text = text.replace(/(\d\d\d)(\d\d\d)(\d\d\d\d)/, "($1) $2-$3");
return text;
});

});

</script>
</head>
<apex:outputText styleClass="phone" value="{!Quote.Opportunity.Owner.Phone}" />
</apex:page>

Hi,

 

I have a requirement wherein I need to deploy 1-2 triggers and classes in a Salesforce Group Edition org.

The only solution I found from Google, is to create a managed package and get it authorized, through Security review and then deploy it from Appexchange.

 

Is this a viable solution? Does Salesforce allows(and pass the Security review)  to put such custom packages for specific customers on appexchange?

 

If yes, any other constraints in this? I am aware about the time which is around 5 weeks.

If no, any other solution ?

(The basic aim is to enable commision tracking on Opportunities, without using any paid app. )

 

Thanks.

  • March 18, 2013
  • Like
  • 0

I'm trying to write out JSON from multiple Salesforce objects using the JSONGenerator class, with the below lines as a small example. 

 JSONGenerator gen = JSON.createGenerator(true);   
 gen.writeStartObject(); 
 gen.writeStringField('companyname', account.name); 

 gen.writeStringField('permalink', opp.permalink__c); 

gen.writeEndObject()

 

When writing the string fields, I can't guarantee the string won't be null (for example, that opp.permalink__c is null), which means that the generator throws an error when I try when I attempt to write a null string. To get around it, I could do a null check on every field, and set it to the empty string instead of null, but I'm retrieving a lot of fields and don't want to make the code too unreadable... Is there a cleaner fix for this?

 

Thanks in advance!

Good day you all

 

I a newbie to Salesforce mobile SDK and android developement in general and I got stuck on my first sample app ContactExplorer which comes with SalesforceMobileSDK. I have imported the project successfully but got the following error 

Error: No resource found that matches the given name (at 'resource' with value '@xml/authenticator')

 this is in line 50 of AndroidManifet.xml file of the application.

 

How can I solve the above problem, your help will be highly appreciated

My Company recently signed up for Google Maps API for business.

 

To use the API, I need to generte a HMacSHA1 signature, and add it to my HTTP request. Unfortunately, somehow, I am not able to generate the right signature.

 

For testing, I am using the values provided by google to ensure that the algorithm works fine and I get the right result. Here is the code:

 

string url = 'maps/api/geocode/json?address=New+York&sensor=false&client=clientID';
string privateKey = 'vNIXE0xscrmjlyV-12Nj_BvUPaw=';

privateKey = privateKey.replace('-', '+');
privateKey = privateKey.replace('_', '/');

 

//Blob privateKeyBlob = EncodingUtil.base64Decode(privateKey);
Blob privateKeyBlob = Blob.valueOf(privateKey);
Blob urlBlob = Blob.valueOf(url);

Blob signatureBlob = Crypto.generateMac('HMacSHA1', urlBlob, privateKeyBlob);

 

String signature =EncodingUtil.urlEncode(EncodingUtil.base64Encode(signatureBlob), 'UTF-8');

signature = signature.replace('+', '-');
signature = signature.replace('/', '_');

 

system.debug('signature is ' +signature);

 

The generated signature should be : KrU1TzVQM7Ur0i8i7K3huiw3MsA=

 

Here is the link to Google Documentation where you can also find the same example: https://developers.google.com/maps/documentation/business/webservices

 

Few points to note:

1. I used the sample Python script provided in API Documentation and it gives the right result.

2. I think the problem is, API Documentation says that we should decode the privateKey and then provide it to the function. Although the documentation for Crypto Class says the "The value of privateKey does not need to be in decoded form.". I tried both, with and without decoding, still no result.

3. For Google API, everything has to be UTF-8 Encoded; I don't know if thats the way Encoding.Util decode's it.

 

I have tried a lot fo combinations, but could not find a solution. Any help would be highly appreciated.

 

Thanks,

Ankit

 

 

 

  • December 14, 2012
  • Like
  • 0

Is it possible, using one of the action components like actionFunction or actionSupport, to rerender just one piece of a table? (in this case a pageBlockTable)

 

My table is listing Leads.  (Leads contained in a wrapper obj defined in the controller, to be exact.)  One of the columns contains a select control (so we've got a separate select control for each row).  When onchange fires for the select, I'd like to rerender the contents of another column in the same row.  Or it would be OK to rerender the entire other column.  But I don't want to rerender the whole table, or the whole row.

 

I don't seem to be able to do this.  If I put the column id in the rerender attribute, nothing seems to happen.  Same if I use the id of the outputPanel that's contained inside that column (which would be repeated for each row, so not sure how to refer to the outputPanel contained in a particular row.)

 

Is this possible?  Or is it only possible to refresh the table as a whole?

 

Thanks much!

  • April 08, 2009
  • Like
  • 0