-
ChatterFeed
-
4Best Answers
-
3Likes Received
-
0Likes Given
-
70Questions
-
71Replies
Visualforce page to run javascript onload?
is it possible to have javascript run upon opening a visual page? I know I can get the apex controller constructor to run, but I want javascript to access the browser url.
The following only works in development mode:
<script type="text/javascript"> var detailURL= parent.document.referrer; detailURL = detailURL.substring(detailURL.lastIndexOf('/')+1); function init() { if ((detailURL > "" ) && (detailURL.length == 15)) { alert('pushing '+detailURL); nowPushURL(detailURL); } } parent.onload = init; //window.onload; </script>
- JWikk
- September 20, 2010
- Like
- 0
- Continue reading or reply
Adding "Blank Space" to Form Page
Hello,
I am modifying a page overrrideing our Edit page. I have a 2-column section that I would like 4 items on the left, and 6 on the right.
Is there a way to insert a Blank Space/Cell using Visualforce, similar to what the Page Editor allows?
Thank you,
AT
- uptime_andrew
- December 29, 2010
- Like
- 0
- Continue reading or reply
Querying large tables
FIND :value1 IN ALL FIElDS RETURNING Contact(Id WHERE PKG__Field__c = :value2 OR (Lastname = :value3 OR Name = :value4))The error is: System.QueryException: Non-selective query against large object type (more than 100000 rows)
I know why it's failing but I don't know how to fix it! I can't split this into 2 queries/searches either because the where-clause is ORed which means I have no choice but to query with the custom non-indexed field.
Note that this SOSL only fails when ran in a trigger!
- asadim2
- October 30, 2015
- Like
- 0
- Continue reading or reply
Tooling API error when setting standardController
var apexBody = "<apex:page standardController='Account'>Test</apex:page>"; conn.tooling.sobject('ApexPage').create({ markup: apexBody, name: "PageTest", masterlabel: "PageTestLabel" }, function(err, res) { if (err) { return console.error(err); } console.log(res); });
I am in a DE org as Sys Admin. I recall getting the same error while ago when I tried the Tooling API in Apex:
FIELD_INTEGRITY_EXCEPTION: Object type not accessible. Please check permissions and make sure the object is not in development mode: sObject type 'Account' is not supported.. Original queryString was: 'SELECT Id FROM Account WHERE id = '000000000000000'': Markup
The script works without setting standardController in the markup. Any ideas? Thanks.
- asadim2
- July 04, 2015
- Like
- 0
- Continue reading or reply
Query using Tooling API: sObject type 'Account' is not supported
SELECT Id FROM Account WHERE id = '000000000000000'
Error: sObject type 'Account' is not supported.
Same query runs fine without the Tooling API. I am the System Admin in a Developer Edition org. Any ideas? Thanks.
- asadim2
- July 04, 2015
- Like
- 0
- Continue reading or reply
Strange Code Coverage error in deployment
1. Code coverage in production is 74% (cleared all tests, then re-ran all to make sure). When deploying a single field (some dummy test field) from the sandbox we get this error:
Your code coverage is 63%. You need at least 75% coverage to complete this deployment.
2. Production is on Summer '15. Sandbox is not. Regardless, we hardly have multi-line code anywhere (maybe 1% of all Apex code).
Why is production code coverage falling to some obscure value during deployment of changesets?
- asadim2
- June 09, 2015
- Like
- 0
- Continue reading or reply
Bugs with duplicate objects (local and packaged)
Scenario
We have a package consisting of objects PKG__Object__c and PKG__Parent__c, and class PKG.ClassA. This package is installed inside a client org. The client org also has an object called Object__c (same name as the packaged object) with a lookup to PKG__Parent__c called Parent__c.
Issues
1. Global method PKG.ClassA.runQuery1() runs a dynamic query. Said method is called from a custom Apex class in client org. The resulting query looks like this: "select Id from Object__c where Id in :ids". But SF treats it as PKG__Object__c, and if we block access to the packaged object, SF throws an exception:
sObject type 'PKG__Object__c' is not supported. (PKG)
2. Global method PKG.ClassA.runQuery2() runs a dynamic query. Said method is called from a custom Apex class in client org. The resulting query looks like this: "select Id, (select Parent__c from Objects__r) from PKG__Parent__c where Id in :ids". But SF throws an exception:
No such column 'PKG__Parent__c' on entity 'PKG__Object__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name.
Is anyone aware of this? This is causing major issues as we upgrade historic clients.
- asadim2
- February 09, 2015
- Like
- 0
- Continue reading or reply
Creating placeholders for external components inside a VF page
Imagine my managed page shows Car Details. This page has a standard layout except for one area that is custom for each client. Once this page is packaged up and installed in a client org I want to be able to customize the aforementioned area. I also want this area to be aware of certain variables in the main page (e.g. Car Model, Brand, etc).
I know VF components can be plugged into pages and I can also pass parameters, but I don't think I can use them as external components (outside the package). On the other hand we have compositions that I can define dynamically on the client side (I think) but I cannot pass parameters to. So I'm in a deadlock.
Any ideas would be appreciated.
- asadim2
- October 03, 2014
- Like
- 0
- Continue reading or reply
Rerendering loses my values -except the last one!
public class TestRerenderController { public List<String> titles { get; set; } public List<VO> vos { get; set; } public TestRerenderController() { titles = new String[]{'Title A', 'Title B', ' Title C'}; vos = new List<VO>(); vos.add(new VO('text a')); vos.add(new VO('text b')); vos.add(new VO('text c')); } public void hi() { titles.add('Title D'); vos.add(new VO('text d')); } public class VO { public String text { get; set; } public VO(String s) { text = s; } } }
VF page:
<apex:page controller="TestRerenderController" id="p"> <apex:form id="f"> <apex:pageBlock id="pb"> <apex:variable value="{!-1}" var="index"/> <apex:repeat value="{!titles}" var="title"> <b>{!title}</b><br/> <apex:variable value="{!index+1}" var="index"/> <apex:inputText value="{!vos[index].text}"/><br/> <apex:commandLink action="{!hi}" value="Add D row" reRender="pb"/> <br/><br/> </apex:repeat> </apex:pageBlock> </apex:form> </apex:page>
Problem 1:
When the commandLink on each row except the last one is clicked, I get a new row but all the input fields reset to their original values. However if I change the value of the last row and click the link on the last row, the value is remembered.
Problem 2:
On click of the link, if I rerender the page instead of pageBlock I don't get a new row. Any ideas why?!
To make it simple you can directly copy/paste above code into your org and test.
- asadim2
- August 27, 2014
- Like
- 0
- Continue reading or reply
I can't have inputText within repeat?!!!!
public class TestRerenderController { public List<String> text { get; set; } public TestRerenderController() { text = new List<String>(); text.add('a'); text.add('b'); text.add('c'); } public void hi() { } }
VF page:
<apex:page controller="TestRerenderController" id="p"> <apex:form > <apex:repeat value="{!text}" var="t"> <apex:inputText value="{!t}"/><br/> </apex:repeat> <br/> <apex:commandLink action="{!hi}" value="Click me" reRender="p"/> </apex:form> </apex:page>
Error when saving the page:
Error: Unknown property 't'
What gives?!
- asadim2
- August 27, 2014
- Like
- 0
- Continue reading or reply
SingleEmailMessage limits
If you use SingleEmailMessage to email your organization’s internal users, specifying the user’s ID in setTargetObjectId means the email doesn’t count toward the daily limit. However, specifying internal users’ email addresseses in setToAddresses means the email does count toward the limit.
Question: what if instead of the user's ID I pass in a contact ID? Is that considered an exclusion from the daily limits as well?
- asadim2
- August 26, 2014
- Like
- 0
- Continue reading or reply
Client-side VF components to plug into managed VF pages
Any ideas as to what options I have?
Thanks.
- asadim2
- July 21, 2014
- Like
- 0
- Continue reading or reply
Geolocation decimals
To make the problem less technical, how can I enter 665679.879932 as latitude in SF?
Thanks.
- asadim2
- July 03, 2014
- Like
- 1
- Continue reading or reply
Geolocation bounded box SOQL queries
1) How can I get a list of records that reside within a certain bounded box (aka extent) on the map?
2) How can I get a list of records that intersect with a straight line on the map?
3) If my Geolocation fields are not standard x-y coordinates (spatial reference different than 4326) how does SOQL figure out the DISTANCE clause?
Thanks!
- asadim2
- July 03, 2014
- Like
- 1
- Continue reading or reply
Access Account and its children in Portal
When a portal user is registered they get a Contact, and thereby an Account (maybe a new Account or an existing one). But these 2 records are not owned by the portal user, and as such they won't be accessible by the portal user.
How can I allow portal users view (aka Read) related records on their Accounts?
- asadim2
- May 23, 2014
- Like
- 0
- Continue reading or reply
Global Metadata API
Thanks.
- asadim2
- May 06, 2014
- Like
- 0
- Continue reading or reply
Date field on deleted lookup shows as today (bug?)
Scenario:
2 objects: Car__c is the parent for Part__c
Excerpt from controller (partly pseudo):
public Schema.FieldSetMember[] carFields { get; set; } public Part__c[] parts { get; set; } public Controller() { carFields = list of fields from Fieldset containing Model__c, CreatedDate, Intro_Date__c parts = [select Name, Car__r.Model__c, Car__r.CreatedDate, Car__r.Intro_Date__c from Part__c]; }
Excerpt from VF page (a table with a list of part Names + their corresponding Car info):
<apex:pageBlockTable value="{!parts}" var="part"> <!-- Part Name --> <apex:column value="{!part.Name}"> <!-- Car Fields --> <apex:repeat value="{!carFields}" var="f"> <apex:column> <apex:outputField value="{!part.Car__r[f]}"/> </apex:column> </apex:repeat> </apex:pageBlockTable>
The resulting table looks like this:
Name____Model__Created Date__Intro Date ======================================= Gear____Benz___4/9/2013______1/4/2013 Knob____BMW____6/8/2012______6/7/2012 Screw__________5/5/2014______5/5/2014 < CHILD DELETED > Pedal__________5/5/2014______5/5/2014 < CHILD DELETED > Bushing_Audi___3/5/2011______________This seems like a bug to me. Anything I'm missing?
- asadim2
- May 05, 2014
- Like
- 0
- Continue reading or reply
Tooling API: Security Settings for pages/classes
Thanks!
- asadim2
- April 06, 2014
- Like
- 1
- Continue reading or reply
Can Tooling API create Apex content in Production Orgs?
Thanks.
- asadim2
- April 06, 2014
- Like
- 0
- Continue reading or reply
FTP file stream
I am pretty sure Salesforce doesn't support this in Apex -or does it?! If not then does that mean I have to use the Streaming API? But that would involve Visualforce, and I'm hoping to find a solution only in Apex.
Thanks!
- asadim2
- June 19, 2013
- Like
- 0
- Continue reading or reply
Custom instructions on pages per object
Hello!
I'd like to hear some suggestions about displaying custom instructions on pages, per object. For example, I want to show a text on top of the New Object page (New mode) that tells the user what to do.
I'm not looking for field-level help or even the Help Page link that Salesforce can be configured to use.
Thanks!
- asadim2
- June 12, 2013
- Like
- 0
- Continue reading or reply
Home page component disappears on tabs and detail pages
We have a homepage component that is added to the sidebar. It shows up on the Home page but not on tabs or detail pages. Even the standard components like Messages & Alerts and Custom Links disappear too!
Any ideas what's going on?! It must be a config thing because this is not happening in the rest of our orgs. Btw this is a sandbox org.
Thanks!
- asadim2
- May 23, 2013
- Like
- 0
- Continue reading or reply
Geolocation decimals
To make the problem less technical, how can I enter 665679.879932 as latitude in SF?
Thanks.
- asadim2
- July 03, 2014
- Like
- 1
- Continue reading or reply
Geolocation bounded box SOQL queries
1) How can I get a list of records that reside within a certain bounded box (aka extent) on the map?
2) How can I get a list of records that intersect with a straight line on the map?
3) If my Geolocation fields are not standard x-y coordinates (spatial reference different than 4326) how does SOQL figure out the DISTANCE clause?
Thanks!
- asadim2
- July 03, 2014
- Like
- 1
- Continue reading or reply
Tooling API: Security Settings for pages/classes
Thanks!
- asadim2
- April 06, 2014
- Like
- 1
- Continue reading or reply
Querying large tables
FIND :value1 IN ALL FIElDS RETURNING Contact(Id WHERE PKG__Field__c = :value2 OR (Lastname = :value3 OR Name = :value4))The error is: System.QueryException: Non-selective query against large object type (more than 100000 rows)
I know why it's failing but I don't know how to fix it! I can't split this into 2 queries/searches either because the where-clause is ORed which means I have no choice but to query with the custom non-indexed field.
Note that this SOSL only fails when ran in a trigger!
- asadim2
- October 30, 2015
- Like
- 0
- Continue reading or reply
Tooling API error when setting standardController
var apexBody = "<apex:page standardController='Account'>Test</apex:page>"; conn.tooling.sobject('ApexPage').create({ markup: apexBody, name: "PageTest", masterlabel: "PageTestLabel" }, function(err, res) { if (err) { return console.error(err); } console.log(res); });
I am in a DE org as Sys Admin. I recall getting the same error while ago when I tried the Tooling API in Apex:
FIELD_INTEGRITY_EXCEPTION: Object type not accessible. Please check permissions and make sure the object is not in development mode: sObject type 'Account' is not supported.. Original queryString was: 'SELECT Id FROM Account WHERE id = '000000000000000'': Markup
The script works without setting standardController in the markup. Any ideas? Thanks.
- asadim2
- July 04, 2015
- Like
- 0
- Continue reading or reply
Query using Tooling API: sObject type 'Account' is not supported
SELECT Id FROM Account WHERE id = '000000000000000'
Error: sObject type 'Account' is not supported.
Same query runs fine without the Tooling API. I am the System Admin in a Developer Edition org. Any ideas? Thanks.
- asadim2
- July 04, 2015
- Like
- 0
- Continue reading or reply
Strange Code Coverage error in deployment
1. Code coverage in production is 74% (cleared all tests, then re-ran all to make sure). When deploying a single field (some dummy test field) from the sandbox we get this error:
Your code coverage is 63%. You need at least 75% coverage to complete this deployment.
2. Production is on Summer '15. Sandbox is not. Regardless, we hardly have multi-line code anywhere (maybe 1% of all Apex code).
Why is production code coverage falling to some obscure value during deployment of changesets?
- asadim2
- June 09, 2015
- Like
- 0
- Continue reading or reply
Unable to abort Recursive batch job
by mistake I started recursive batch class chain
In the batch finsih() method I inserted a call for the same batch
Now I have a batc running for half day I can not stop it
Abor does not work If i try to abort I get the be,ow message
Failed to Abort Job Unable to remove job from Apex Job Queue.
I need to stop this somehow
What opton I have?
In the specs I sew that "You can submit up to 5,000 batches per rolling 24 hour period."
but since start my batch run more then 5000 times
regards
csaba
- csbaa
- April 20, 2015
- Like
- 0
- Continue reading or reply
Rerendering loses my values -except the last one!
public class TestRerenderController { public List<String> titles { get; set; } public List<VO> vos { get; set; } public TestRerenderController() { titles = new String[]{'Title A', 'Title B', ' Title C'}; vos = new List<VO>(); vos.add(new VO('text a')); vos.add(new VO('text b')); vos.add(new VO('text c')); } public void hi() { titles.add('Title D'); vos.add(new VO('text d')); } public class VO { public String text { get; set; } public VO(String s) { text = s; } } }
VF page:
<apex:page controller="TestRerenderController" id="p"> <apex:form id="f"> <apex:pageBlock id="pb"> <apex:variable value="{!-1}" var="index"/> <apex:repeat value="{!titles}" var="title"> <b>{!title}</b><br/> <apex:variable value="{!index+1}" var="index"/> <apex:inputText value="{!vos[index].text}"/><br/> <apex:commandLink action="{!hi}" value="Add D row" reRender="pb"/> <br/><br/> </apex:repeat> </apex:pageBlock> </apex:form> </apex:page>
Problem 1:
When the commandLink on each row except the last one is clicked, I get a new row but all the input fields reset to their original values. However if I change the value of the last row and click the link on the last row, the value is remembered.
Problem 2:
On click of the link, if I rerender the page instead of pageBlock I don't get a new row. Any ideas why?!
To make it simple you can directly copy/paste above code into your org and test.
- asadim2
- August 27, 2014
- Like
- 0
- Continue reading or reply
I can't have inputText within repeat?!!!!
public class TestRerenderController { public List<String> text { get; set; } public TestRerenderController() { text = new List<String>(); text.add('a'); text.add('b'); text.add('c'); } public void hi() { } }
VF page:
<apex:page controller="TestRerenderController" id="p"> <apex:form > <apex:repeat value="{!text}" var="t"> <apex:inputText value="{!t}"/><br/> </apex:repeat> <br/> <apex:commandLink action="{!hi}" value="Click me" reRender="p"/> </apex:form> </apex:page>
Error when saving the page:
Error: Unknown property 't'
What gives?!
- asadim2
- August 27, 2014
- Like
- 0
- Continue reading or reply
Geolocation decimals
To make the problem less technical, how can I enter 665679.879932 as latitude in SF?
Thanks.
- asadim2
- July 03, 2014
- Like
- 1
- Continue reading or reply
Date field on deleted lookup shows as today (bug?)
Scenario:
2 objects: Car__c is the parent for Part__c
Excerpt from controller (partly pseudo):
public Schema.FieldSetMember[] carFields { get; set; } public Part__c[] parts { get; set; } public Controller() { carFields = list of fields from Fieldset containing Model__c, CreatedDate, Intro_Date__c parts = [select Name, Car__r.Model__c, Car__r.CreatedDate, Car__r.Intro_Date__c from Part__c]; }
Excerpt from VF page (a table with a list of part Names + their corresponding Car info):
<apex:pageBlockTable value="{!parts}" var="part"> <!-- Part Name --> <apex:column value="{!part.Name}"> <!-- Car Fields --> <apex:repeat value="{!carFields}" var="f"> <apex:column> <apex:outputField value="{!part.Car__r[f]}"/> </apex:column> </apex:repeat> </apex:pageBlockTable>
The resulting table looks like this:
Name____Model__Created Date__Intro Date ======================================= Gear____Benz___4/9/2013______1/4/2013 Knob____BMW____6/8/2012______6/7/2012 Screw__________5/5/2014______5/5/2014 < CHILD DELETED > Pedal__________5/5/2014______5/5/2014 < CHILD DELETED > Bushing_Audi___3/5/2011______________This seems like a bug to me. Anything I'm missing?
- asadim2
- May 05, 2014
- Like
- 0
- Continue reading or reply
Can Tooling API create Apex content in Production Orgs?
Thanks.
- asadim2
- April 06, 2014
- Like
- 0
- Continue reading or reply
FTP file stream
I am pretty sure Salesforce doesn't support this in Apex -or does it?! If not then does that mean I have to use the Streaming API? But that would involve Visualforce, and I'm hoping to find a solution only in Apex.
Thanks!
- asadim2
- June 19, 2013
- Like
- 0
- Continue reading or reply
Can we add method block inside the Trigger file?
Hi,
Can we add method block inside the Trigger file? We got a scenario of executing the common block of statements for two set of records, which run serially. Can anyone assist me?
Regards,
SuBaa
- subaa
- May 27, 2011
- Like
- 0
- Continue reading or reply