• asadim2
  • NEWBIE
  • 155 Points
  • Member since 2009

  • Chatter
    Feed
  • 4
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 70
    Questions
  • 71
    Replies

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>

 

  • September 20, 2010
  • Like
  • 0

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

The following SOSL fails, even when re-written in SOQL or used in a query for-loop, when there are 100K+ Contacts in the org:
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!
I have this very simple script on the JSforce script executor (https://jsforce.github.io/document/#tooling-api):
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.
Running the following query in Developer Console using Tooling API fails.
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.
The following 2 points should explain everything:

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?

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.

In my managed VF page how can I leave room for external components to be plugged in from client orgs? The key question for me here is, how do I pass variables to the placeholder so that the external component sees them.

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.
Controller:
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.
Controller:
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?!
According to the online documentation:

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?
I have a managed VF page with a custom section whose content is dependent on the client. I want to be able to configure this particular section in each client org.

Any ideas as to what options I have?

Thanks.
I don't understand how we can store Geolocation values that are not in degrees (i.e. different spatial reference) in SF. Seems like the 2 available sub-types for Geolocation fields are the same. I thought choosing Decimal would allow for non-degree values, but it doesn't work.

To make the problem less technical, how can I enter 665679.879932 as latitude in SF?

Thanks.
3 questions:

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!
We are on the Customer Portal Manager Custom license, and I want to allow our portal users view related records on *THEIR* Accounts. This means the Sharing Settings for said related records need to be Private.

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?
The current Metadata API that is available under Setup > Develop > API seems to be org-specific. Is there a generic one that can be used across all orgs? Or maybe can I modify the existing one to make it global?

Thanks.
Issue: If a parent object is deleted, the Date fields on the now-orphan children show as today in VF when binded using outputFields. If using outputText the proper value (empty) is shown.


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?

I haven't found anything in the documentation that addresses Security Settings. Is it possible at all to write code to set security settings for the Apex classes and pages that are created using the Tooling API?

Thanks!
You know how you need to use Changesets to deploy stuff from sandbox to production? So am I going to run into errors if my code tries to create Apex classes and VF pages in a production org?

Thanks.

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!

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!

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!

I don't understand how we can store Geolocation values that are not in degrees (i.e. different spatial reference) in SF. Seems like the 2 available sub-types for Geolocation fields are the same. I thought choosing Decimal would allow for non-degree values, but it doesn't work.

To make the problem less technical, how can I enter 665679.879932 as latitude in SF?

Thanks.
3 questions:

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!
I haven't found anything in the documentation that addresses Security Settings. Is it possible at all to write code to set security settings for the Apex classes and pages that are created using the Tooling API?

Thanks!
The following SOSL fails, even when re-written in SOQL or used in a query for-loop, when there are 100K+ Contacts in the org:
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!
I have this very simple script on the JSforce script executor (https://jsforce.github.io/document/#tooling-api):
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.
Running the following query in Developer Console using Tooling API fails.
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.
The following 2 points should explain everything:

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?
Hello Helpers


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
  • April 20, 2015
  • Like
  • 0
Controller:
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.
Controller:
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?!
I don't understand how we can store Geolocation values that are not in degrees (i.e. different spatial reference) in SF. Seems like the 2 available sub-types for Geolocation fields are the same. I thought choosing Decimal would allow for non-degree values, but it doesn't work.

To make the problem less technical, how can I enter 665679.879932 as latitude in SF?

Thanks.
Issue: If a parent object is deleted, the Date fields on the now-orphan children show as today in VF when binded using outputFields. If using outputText the proper value (empty) is shown.


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?

You know how you need to use Changesets to deploy stuff from sandbox to production? So am I going to run into errors if my code tries to create Apex classes and VF pages in a production org?

Thanks.

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!

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

  • May 27, 2011
  • Like
  • 0