• Marco Mancilla
  • NEWBIE
  • 5 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 4
    Questions
  • 7
    Replies
Hello,

I want to add a button to my Product2 object that lets a user upload a photo of the product. I would like the image URL be stored automatically in a field on the Product2 record after uploading. I am guessing that to achieve this, I need to make some kind of visualforce widget for uploading the image, tie that to the action of a button on the object, and then have some kind of workflow rule or apex trigger fire after the image is uploaded and enter its URL into the field. What is the easiest way to do this?
Hello,

I posted the following question in the developer forum yesterday afternoon:
https://developer.salesforce.com/forums#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Developer_Forums&criteria=OPENQUESTIONS&id=9060G000000MPjtQAG

However, I have still not gotten any replies and was just wondering how long I will need to wait before I get a response. I'd like to think that its not that complicated of a problem, but I could be wrong about that.

I did follow-up and posted the relevant markup in my VF page, my CSS and relevant Javascript function for the piecharts that is causing the issue for further context.

I would just like to figure out how to fix this issue as soon as possible. It's not a huge bug - just a cosmetic UI glitch - but it doesn't look good and I'd rather get it fixed sooner than later. I would greatly appreciate it if I could get some feedback on this issue. Thanks.
Hello,

I am trying to write a simple Apex class with a very simple method that returns a list that I can iterate over in my Javascript without having to resort to using <apex:repeat> and generating a very large document. Unfortunately, I find the documentation on this feature to be confusing and my Javascript is getting an empty array despite my method returning a non-empty array.

Here is my Apex code:
global with sharing class SalesGoalsController {
    public list<Countries__c> CountryRecords {get; set;}
    @RemoteAction
    global static List<Countries__c> getCountryRecords() {
        List<Countries__c>CountryRecords = [select name, psl_goal__c, ps_goal__c, psl_total_goal__c, ps_total_goal__c from Countries__c];
        return CountryRecords;
    }
}
Here is my Visualforce page:
 
<apex:page controller="SalesGoalsController" sidebar="false">
    <script type="text/javascript">
    	Visualforce.remoting.Manager.invokeAction(
            '{!$RemoteAction.SalesGoalsController.getCountryRecords}',
            function(result, event){
                if (event.status) {
                    console.log(result);
                }
            }, {escape: true}
        );
    </script>
</apex:page>
The console.log() call is just showing an empty array in my web browser console. How do I get the list returned by getCountryRecords() into my javascript? I tried JSON.serialize() and parse() but this still doesn't work.

 
Hello,

I have a javascript function in a visualforce page that makes an AJAX request for some report JSON data. The function works fine when it is embedded directly in the visualforce page. However, if I attempt to move it to a static resource outside the visualforce file, include that static resource in the VF file and call the function, it fails. The json data it returns says "INVALID_SESSION_ID" even though I passed the value of {!$Api.Session_ID} to my function. For some reason salesforce won't allow this to work. How can I make this work?

Here is the code that works:
 
<apex:page sidebar="false">
    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" />
    <script>
var apiSid = '{!$Api.Session_ID}';
var report_id = 'my report id goes here'
function getReportJsonData(apiSid, report_id) {
	console.log(apiSid);
	var jsonData = JSON.parse($.ajax({
		beforesend: function(xhr) {
			xhr.setRequestHeader('Authorization', 'Bearer ' + apiSid);
		},
		url: "/services/data/v29.0/analytics/reports/" + report_id,
		dataType: "json",
		async: false
	}).responseText);
    console.log(jsonData);
	return jsonData;
}
var jsonData = getReportJsonData(apiSid, report_id);
</script>
</apex:page>
However if I move getReportJsonData() into a static resource, then try to call it like so:
<apex:page>
<apex:includeScript value="{!$Resource.MapSettings}"/> 
<script>
var apiSid = '{!$Api.Session_ID}';
var report_id = 'my report id goes here';
var jsonData = getReportJsonData(apiSid, report_id);
</script>
</apex:page>
This fails, the json data returned says "INVALID_SESSION_ID".

Would appreciate some help with this.

Thanks.


 
Hello,

I want to add a button to my Product2 object that lets a user upload a photo of the product. I would like the image URL be stored automatically in a field on the Product2 record after uploading. I am guessing that to achieve this, I need to make some kind of visualforce widget for uploading the image, tie that to the action of a button on the object, and then have some kind of workflow rule or apex trigger fire after the image is uploaded and enter its URL into the field. What is the easiest way to do this?
Hello,

I posted the following question in the developer forum yesterday afternoon:
https://developer.salesforce.com/forums#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Developer_Forums&criteria=OPENQUESTIONS&id=9060G000000MPjtQAG

However, I have still not gotten any replies and was just wondering how long I will need to wait before I get a response. I'd like to think that its not that complicated of a problem, but I could be wrong about that.

I did follow-up and posted the relevant markup in my VF page, my CSS and relevant Javascript function for the piecharts that is causing the issue for further context.

I would just like to figure out how to fix this issue as soon as possible. It's not a huge bug - just a cosmetic UI glitch - but it doesn't look good and I'd rather get it fixed sooner than later. I would greatly appreciate it if I could get some feedback on this issue. Thanks.
Hello,

I am trying to write a simple Apex class with a very simple method that returns a list that I can iterate over in my Javascript without having to resort to using <apex:repeat> and generating a very large document. Unfortunately, I find the documentation on this feature to be confusing and my Javascript is getting an empty array despite my method returning a non-empty array.

Here is my Apex code:
global with sharing class SalesGoalsController {
    public list<Countries__c> CountryRecords {get; set;}
    @RemoteAction
    global static List<Countries__c> getCountryRecords() {
        List<Countries__c>CountryRecords = [select name, psl_goal__c, ps_goal__c, psl_total_goal__c, ps_total_goal__c from Countries__c];
        return CountryRecords;
    }
}
Here is my Visualforce page:
 
<apex:page controller="SalesGoalsController" sidebar="false">
    <script type="text/javascript">
    	Visualforce.remoting.Manager.invokeAction(
            '{!$RemoteAction.SalesGoalsController.getCountryRecords}',
            function(result, event){
                if (event.status) {
                    console.log(result);
                }
            }, {escape: true}
        );
    </script>
</apex:page>
The console.log() call is just showing an empty array in my web browser console. How do I get the list returned by getCountryRecords() into my javascript? I tried JSON.serialize() and parse() but this still doesn't work.

 
Hello,

I have a javascript function in a visualforce page that makes an AJAX request for some report JSON data. The function works fine when it is embedded directly in the visualforce page. However, if I attempt to move it to a static resource outside the visualforce file, include that static resource in the VF file and call the function, it fails. The json data it returns says "INVALID_SESSION_ID" even though I passed the value of {!$Api.Session_ID} to my function. For some reason salesforce won't allow this to work. How can I make this work?

Here is the code that works:
 
<apex:page sidebar="false">
    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" />
    <script>
var apiSid = '{!$Api.Session_ID}';
var report_id = 'my report id goes here'
function getReportJsonData(apiSid, report_id) {
	console.log(apiSid);
	var jsonData = JSON.parse($.ajax({
		beforesend: function(xhr) {
			xhr.setRequestHeader('Authorization', 'Bearer ' + apiSid);
		},
		url: "/services/data/v29.0/analytics/reports/" + report_id,
		dataType: "json",
		async: false
	}).responseText);
    console.log(jsonData);
	return jsonData;
}
var jsonData = getReportJsonData(apiSid, report_id);
</script>
</apex:page>
However if I move getReportJsonData() into a static resource, then try to call it like so:
<apex:page>
<apex:includeScript value="{!$Resource.MapSettings}"/> 
<script>
var apiSid = '{!$Api.Session_ID}';
var report_id = 'my report id goes here';
var jsonData = getReportJsonData(apiSid, report_id);
</script>
</apex:page>
This fails, the json data returned says "INVALID_SESSION_ID".

Would appreciate some help with this.

Thanks.


 
Anyone every get horrendously slow performance when saving classes and pages from the Eclipse IDE back to the org? 

I'm experiencing times when it takes several minutes just to save one file.  Trying to work in a rapid development cycle is almost impossible and it's also hard not to completely lose your train of thought when debugging.

I guess I'm sort of venting here.  We did enter a support case once.  But a support case will sit for a day or two before anything happens.  And by then, the SB is back to saving in 5 or 10 seconds.  Then a week or two later, for the better part of the day, save time is back to several minutes.

I'm wondering if anyone else ever has the same issue.

I did check my network speed and have a 40ms ping, 20mbs download, and 5mbs upload.  My network is fast enought to do voice-over-IP meetings with screen sharing so you think I could upload a couple K text file in maybe a second.

Does anyone know how to use the Apex Data loader extract feature to pull data with a condition of "not equal" to null or blank?

 

using the GUI I select the field I want to not be null and then 'not equals' and the value field is a dorp down of the hard coded values.  When I try entering 'null' there I still get blanks and when I try " " it also returns blanks.  Can someone help?

Does anyone know how to use the Apex Data loader extract feature to pull data with a condition of "not equal" to null or blank?

 

using the GUI I select the field I want to not be null and then 'not equals' and the value field is a dorp down of the hard coded values.  When I try entering 'null' there I still get blanks and when I try " " it also returns blanks.  Can someone help?