• Vla Cha
  • NEWBIE
  • 95 Points
  • Member since 2015

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 13
    Replies
I created a static resource called jsquery by uploading Jquery.js and then tried to include the static resource in VF as follows

<apex:page >   
<!--<apex:includeScript value="{!URLFOR($Resource.jsquery, 'jquery-1.11.2.min.js')}"/>-->
    <apex:includeScript value="{$Resource.jsquery}"/>
    <script>   
    alert('Test...');
    jQuery(document).ready(function() {           
            alert("Hello My Jquery is working!!!!"); 
    });       
    </script>
    <a href="#">Test</a>
</apex:page>

However, while executing the visualforce page, first alert is shown and second is not shown. Browser console says JQuery is not an object or null.

Can some help me to find out what is going wrong?
Hello All-

Maybe I'm doing something wrong here, but I am not getting the expected result.  I am trying to convert a UNIX timestamp to a DateTime object in Salesforce and the times that I am getting in the DateTime objects are way off.  Here are 3 examples:

System.debug(Datetime.newInstance(1426982400L).format());
       Debug Log: 1/17/1970 4:23 AM
       Expected: Sun, 22 Mar 2015 00:00:00 GMT

System.debug(Datetime.newInstance(1490140800L).format());
       Debug Log: USER_DEBUG|[197]|DEBUG|1/17/1970 9:55 PM
       Expected: Wed, 22 Mar 2017 00:00:00 GMT

System.debug(Datetime.newInstance(4645814400L).format());
       Debug Log: USER_DEBUG|[198]|DEBUG|2/23/1970 10:30 AM
       Expected: Mon, 22 Mar 2117 00:00:00 GMT

Again maybe there is something I am missing here.

Thanks,

John
Hello All,

I want to display progress bar (5%, 8%,etc not the percentage but the progress) in visualforce page depending on a Custom field value.

I followed blog, but not at great help

 http://www.jitendrazaa.com/blog/salesforce/creating-progress-bar-field-using-formula-without-any-coding/
IMAGE('/resource/1398170360000/BlueProgressBar', 'Test', 10, ( percField__c * 100 )) &
IMAGE('/resource/1398170333000/ProgressBorder', 'Test', 10, (100 - percField__c * 100 )) &
' ' &
TEXT (percField__c * 100) &
'%'

Thank you for advise
  • February 18, 2015
  • Like
  • 0
I was solving the challenge of trailhead of Apex development:

The question was:
Create an Apex class that returns an array (or list) of formatted strings ('Test 0', 'Test 1', ...). The length of the array is determined by an integer parameter.The Apex class must be called 'StringArrayTest' and be in the public scope.
The Apex class must have a public static method called 'generateStringArray'.
The 'generateStringArray' method must return an array (or list) of strings. Each string must have a value in the format 'Test n' where n is the index of the current string in the array. The number of returned strings is specified by the integer parameter to the 'generateStringArray' method.

My code is:


public class StringArrayTest {

    static List<String> TestArray= new List<String>();
    public static String[] generateStringArray(Integer n){
        
        for(Integer i=1;i<=n;i++){   
            TestArray.add('Test'+i);
        }
        
        return TestArray;
    }
    
}

I am able to get desired outpuut but still it is returning an error:
Challenge not yet complete... here's what's wrong: 
Executing the 'generateStringArray' method failed. Either the method does not exist, is not static, or does not return the proper number of strings.

Not able to understand what it want exactly
I was looking for the way to programmatically determine the expiration date of package licenses via PackageLicense Table, I've tried this with following ways :

1.) Via Status Column of PackageLicense  Table, but it seems that the status column in this table do not changes to Expired even after the package has expired on the org.

2.) Via ExpirationDate column, not able to understand how this expiration date is exactly used in salesforce implementation because I checked this with both user timezone and org's timezone but sometime it gets expired according to user's timezone but sometime its not exactly behaving in that way.

I've also crossed check this with GMT but seems like it do not depends on timezone.

Problem is Expiration date-time has crossed but package is still accessible to me and gets expired after some undetermined time.

Please let me know how can I exactly determine programmatically whether my package has expired or not.
I'm testing a web service and when trying to make a callout, I'm getting an error message - System.HttpResponse[Status=Method Not Allowed, StatusCode=405].

I'm trying to call a test website "http://httpbin.org/ip" and this is my code  :

    String content = 'test';
    Http m_http = new Http();
    HttpRequest req = new HttpRequest();
            
    req.setEndpoint('http://httpbin.org/ip');
    req.setHeader('Content-Type','application/json');        
    req.setMethod('POST');
    req.setBody(content);
            
     httpResponse response = m_http.send(req);
     system.debug('response : ' + response);

Anyone ? 
Hi All,

I am uploading documents into Attachment object and keeping a custom object as parent. I want to show the attachment content inside the visualforce page .
Below is part of my code. But in the page content is not getting displayed, it's blank
Page:
        
        <apex:pageBlockSection title="Resume" id="Resume" >
           <apex:iframe src="/servlet/servlet.FileDownload—file={!resume.id}"/>
        </apex:pageBlockSection>
        
Controller:
public Attachment resume{ get; set;}
resume=[select Id,Body,ContentType,Name from Attachment where ParentId =: currentRecordId];

Can anyone please advice on this ?
Thanks in advance
I have an issue with Salesforce1 Lightning Component with-in Salesforce1 on iPhone 4s and 5 after Summer '15 upgrade. The same Lightning Component works from another Sandbox that is on Spring '15 (same phones). But, when I switch over to running on the upgraded to Summer '15 Org it is throwing this error: "Uncaught error in markup://native:hostComponent : Unknown component: markup://c:component_name" when running the component with-in Salesforce1. I have looked all through my code and Aura documentation to see what degraded but see nothing. I have looked on Salesforce Developer and read through the documentation for Summer '15 Lightning Developer's Guide and can not find anything that should be causing this. Has anyone else seen this? Note: I can run the Lightning Component with Salesforce1 if run from Safari on the same phone but will not work straight in the Salesforce1 App on the phone.
Please help!! This is the if statement in a trigger:

 if((c.RecordTypeId == caseRTypeMap.get('Promotions') && c.S_Category__c != 'Draft Kit') || (c.RecordTypeId = caseRTypeMap.get('Fantasy') && c.S_Category__c == 'Referral, Trophy')){
            c.Queue__c = '(Fulfillment) Promotions';
        }

This is the error message I am getting:
“Error: Compile Error: AND operator can only be applied to Boolean expressions at line 400 column 191

Thanks in Advance,
  • March 02, 2015
  • Like
  • 0
I created a static resource called jsquery by uploading Jquery.js and then tried to include the static resource in VF as follows

<apex:page >   
<!--<apex:includeScript value="{!URLFOR($Resource.jsquery, 'jquery-1.11.2.min.js')}"/>-->
    <apex:includeScript value="{$Resource.jsquery}"/>
    <script>   
    alert('Test...');
    jQuery(document).ready(function() {           
            alert("Hello My Jquery is working!!!!"); 
    });       
    </script>
    <a href="#">Test</a>
</apex:page>

However, while executing the visualforce page, first alert is shown and second is not shown. Browser console says JQuery is not an object or null.

Can some help me to find out what is going wrong?
Hi,
I have a liltte problem with accountid in my test class. In my test method I create account and contact in this way:
 
Account a = new Account(name='Mycompany'); 
	 	insert a;
	 	Contact c = new Contact(Accountid=a.id, firstname='Mario', lastname='Rossi',Codice_Cliente__c='001');
	 	insert c;
In my production class I do this:
private static Account idAccount;
	
	idAccount = [select id from Account where name='MyCompany'];

       id idContact=[select id from Contact where Accountid=:idAccount.Id].id;
But second select, fail.
With the system.debug I have seen that the Accountid filed in Contact record, is different from idAccount variable populeted by selecting Account record by name. How is it possible?

Benny
 
I'm developing an Apex application in which SFDC makes rest based calls to an external data source.  But it isn't working now.   The external vendor is saying this is a bug with the version of Java that Salesforce.com is using.  Can this be true?  Here is the error message I'm seeing.

java.lang.RuntimeException: Could not generate DH keypair
After Spring 15 update, when I tried to deploy from sandbox to production, I got errors on two tests (out of 32 total) that have always worked fine. Here's what makes this particularly weird:

- Both tests run with no errors when executed by themselves in Apex Test Execution.
- These are the only two of my tests that have asynchronous (@future) methods.  The calls to those methods are only made if not running under a batch (!system.isBatch()).  When I remove that condition so the future calls are always made, the deployment errors go away.

My hypothesis is that Spring 15 has changed deployment somehow so that tests are run in a batch-like process.  I say "batch-like" because if it was a real batch process, then my future call would break since you can't call future from batch.  And yet, system.isBatch() seems to be returning TRUE during deployment (and presumably FALSE under Apex Test Execution).

Is that even possible?  Is there another explanation?

Thanks,

   - Randy
  • February 26, 2015
  • Like
  • 0
Hello All-

Maybe I'm doing something wrong here, but I am not getting the expected result.  I am trying to convert a UNIX timestamp to a DateTime object in Salesforce and the times that I am getting in the DateTime objects are way off.  Here are 3 examples:

System.debug(Datetime.newInstance(1426982400L).format());
       Debug Log: 1/17/1970 4:23 AM
       Expected: Sun, 22 Mar 2015 00:00:00 GMT

System.debug(Datetime.newInstance(1490140800L).format());
       Debug Log: USER_DEBUG|[197]|DEBUG|1/17/1970 9:55 PM
       Expected: Wed, 22 Mar 2017 00:00:00 GMT

System.debug(Datetime.newInstance(4645814400L).format());
       Debug Log: USER_DEBUG|[198]|DEBUG|2/23/1970 10:30 AM
       Expected: Mon, 22 Mar 2117 00:00:00 GMT

Again maybe there is something I am missing here.

Thanks,

John
Hello All,

I want to display progress bar (5%, 8%,etc not the percentage but the progress) in visualforce page depending on a Custom field value.

I followed blog, but not at great help

 http://www.jitendrazaa.com/blog/salesforce/creating-progress-bar-field-using-formula-without-any-coding/
IMAGE('/resource/1398170360000/BlueProgressBar', 'Test', 10, ( percField__c * 100 )) &
IMAGE('/resource/1398170333000/ProgressBorder', 'Test', 10, (100 - percField__c * 100 )) &
' ' &
TEXT (percField__c * 100) &
'%'

Thank you for advise
  • February 18, 2015
  • Like
  • 0