• vijayn
  • NEWBIE
  • 25 Points
  • Member since 2008

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 20
    Replies

Hi all,

 

I am simply trying to enable rich text editing for one of my custom object fields 

Here's the VF code: 

<apex:page standardController="MyObject__c" sidebar="false" showHeader="false" > <apex:form > <apex:outputPanel id="contentPanel"> <apex:actionRegion > <apex:pageBlock> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> <apex:commandButton onclick="window.close();" value="Cancel"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Rich Text" columns="1" collapsible="false"> <apex:inputTextArea value="{!MyObject__c.TextArea__c}" richText="true"/> </apex:pageBlockSection> </apex:pageBlock> </apex:actionRegion> </apex:outputPanel> </apex:form></apex:page>

 

With no rich text attribute, this works. With richText=true, the value of the inputTextArea is not even sent to the server. Do I need to have something else to enable rich text editing. 

 

Any help appreciated.

 

thanks,

Vijay 

 

 

  • April 14, 2009
  • Like
  • 0

I see what looks like a language bug in Apex (either that, or 'protected' has a surprising meaning in Apex).

 

According to the language reference: protected is defined as:

"This means that the method or variable is visible to any subclasses in the defining Apex class". Note that it says any *subclasses* *in* the defining apex class.

 

Here's what I see:

 

 

public class TestClass { public abstract class Base { protected abstract String protected_method(); public void protected_method_caller() { System.debug('Returning ' + protected_method()); } protected void is_this_really_protected() { System.assert(true, 'Not true'); System.debug('this is a test'); } } public class Derived extends Base { protected override String protected_method() { System.debug('Calling protected method'); System.assert(true, 'Not True'); return 'Test'; } } public class UnRelated { public void unrelated_method() { Derived d = new Derived(); d.is_this_really_protected();// THIS LINE SHOULD FAIL AS UNRELATED IS NOT A SUBCLASS

} } public testmethod static void test_protected_method() { Derived d = new Derived(); d.protected_method_caller(); } public testmethod static void test_unrelated_method() { UnRelated u = new UnRelated(); u.unrelated_method(); } }

 

In the above test case,  an unrelated inner class is able to call a protected method(as long as it is defined in the same outer class). (Ie. It is *in* the same defining class but not a *subclass*)

 

Now consider this:

 

// In base.cls public abstract class Base { protected abstract String protected_method(); public void protected_method_caller() { System.debug('Returning ' + protected_method()); // QUITE LEGITIMATE. SHOULD WORK! } } // In derived.cls public class Derived extends Base { protected override String protected_method() { System.debug('Calling protected method'); System.assert(true, 'Not True'); return 'Test'; } public static testmethod void testderived() { Derived d = new Derived(); d.protected_method_caller(); } }

 

What, to me, seems a fairly normal use of protected. Running this test fails with:

System.TypeException: Method is not visible: [Derived].protected_method()  

 

In this case, Base cannot see the overriden Derived protected_method(). NOTE: If I change the modifier in Derived to public override protected_method() {...}, it works. (Ie. it is a *subclass* but not *in* the same defining class.

 

Is this how it's supposed to behave? Or is this a bug?

 

thanks,

Vijay

 

  • April 11, 2009
  • Like
  • 0

Hi all,

 

I'd like to override the New/Edit and View actions with the same VF page. Is this possible? If so, how do I detect when I'm in the 'new' mode, edit mode and view mode?

 

I can see that new gets passed a save_new=1 param. Is that the best indicator? what about View vs edit?

 

Any help is appreciated.

 

thanks,

Vijay

  • April 08, 2009
  • Like
  • 0

Hi all,

 

I am trying to do something like this:

        <apex:outputText rendered="{!state=SHOW}">This is the dashboard</apex:outputText>
 

where SHOW is a constant in my controller.(Rather than hard code numbers in my visual force pages).

 

Is there a way to do this. 

 

Vijay

  • March 23, 2009
  • Like
  • 0

We would like to annotate a site/page with some custom fields for our application. Is there a way to augment these objects with custom fields? 

 

thanks,

Vijay

 

 

  • March 05, 2009
  • Like
  • 0

I need to add essentially add a few values that are 'singletons'. I could create a custom object and use validation to ensure it was a singleton.

 

But is there a better way?

 

  • March 05, 2009
  • Like
  • 0

Hi,

 

We're an ISV working on multiple applications that we want to distribute independently. Is there a way to have multiple packages within the same DE? As far as I can tell, it looks like we can only build 1 managed package within a single DE, meaning I've to have two DEs to achieve the above. Is that correct?

 

As a secondary question, we are debating(internally) whether we should split one application into two packages (one being an 'extension' of the other). Do we have to have two DEs for that as well? Ie one for the base package and one for the extension?

 

Note that we want to use License management for both apps(packages).

 

-cheers,

Vijay

 

 

thanks,

Vijay

  • March 04, 2009
  • Like
  • 0

Hi all,

 

Has anybody seen this problem before. When I try to navigate to my sites site. I see this:

 

Page Not Found: /

Stay tuned. Please email us if you need to get in touch.

 

 

 

And I get this email in my inbox:

 

There was a problem loading the FileNotFound page -- the designated Page Not Found Page (404) for Force.com site "root" -- when processing the following URL request: http://bhivesb1-developer-edition.na6.force.com/.

 

Note that the above page is not my 'FileNotFound' page (as I modified it slightly to tell the difference). This appears to be a failsafe page of some sort.

 

There's nothing interesting about this site. It's the default site. The only thing interesting was that it was in a DE with a managed package (and therefore w/ a package prefix).

 

The previews work fine.

 

Also, I tried this in another DE which did not have a managed package or prefix (and things were working). Then I set a package prefix and it failed in the same way.

 

Any help is greatly appreciated.

 

  • February 20, 2009
  • Like
  • 0
Hi all,

Is using relationships in SOQL supported in ASF?

I am trying something like this and ASF seems to be stripping out the relationship name.
    @list = MyCustomObject.find(:all, :conditions => ["MyCustomRelationship__r.Name = 'foo'"])

Note:
SELECT Id, owner.Name, Name,  Title__c, Description__c FROM MyCustomObject__c WHERE (MyCustomRelationship__r.Name = 'foo') works, but  the above results in:

SELECT Id, owner.Name, Name,  Title__c, Description__c FROM MyCustomObject__c WHERE (Name = 'foo')


If not, is there a way to do this? does ASF support :join?

Vijay


Message Edited by vijayn on 12-09-2008 11:32 AM
  • December 09, 2008
  • Like
  • 0
Hi all,

I am a newbie to activesalesforce and I'm trying to get it running. I ran into the above error when I created a simple rails app and added a scaffold for 'Account' using:

script/generate scaffold account

so, I tried to run the unit tests and got the same error (Error details after env)

My env:

ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]

actionmailer (2.2.2, 2.0.2.9216, 2.0.2.9129, 2.0.2, 1.3.6, 1.3.3)
actionpack (2.2.2, 2.0.2.9216, 2.0.2.9129, 2.0.2, 1.13.6, 1.13.3)
actionwebservice (1.2.6, 1.2.3)
activerecord (2.2.2, 2.0.2.9216, 2.0.2.9129, 2.0.2, 1.15.6, 1.15.3)
activerecord-activesalesforce-adapter (2.0.0)
activeresource (2.2.2, 2.0.2.9216, 2.0.2.9129, 2.0.2)
activesupport (2.2.2, 2.0.2.9216, 2.0.2.9129, 2.0.2, 1.4.4, 1.4.2)


database config
adapter: activesalesforce
username: <removed>
password: <removed>

I've tried with and w/o URLs specified (https://test.salesforce.com doesn't work for me).


Error details:

The log shows
Starting test 'AsfUnitTestsBasicTest.test_add_notes_to_contact'
   Created one-to-one relationship 'master_record' from Contact to Contact using master_record_id
   Creating ActiveRecord stub for the referenced entity 'Account'
E

The exception is:
  1) Error:
test_add_notes_to_contact(Asf::UnitTests::BasicTest):
NoMethodError: undefined method `connection=' for #<Class:0x19b0a90>
    /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1833:in `method_missing
'
    /Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connec
tion_adapters/activesalesforce_adapter.rb:698:in `configure_active_record'
    /Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connec
tion_adapters/activesalesforce_adapter.rb:672:in `each'
    /Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connec
tion_adapters/activesalesforce_adapter.rb:672:in `configure_active_record'
    /Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connec
tion_adapters/activesalesforce_adapter.rb:649:in `get_entity_def'
    /Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connec
tion_adapters/activesalesforce_adapter.rb:764:in `lookup'
    /Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connec
tion_adapters/activesalesforce_adapter.rb:717:in `columns'
    /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1220:in `columns'
    /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2839:in `attributes_fro
m_column_definition_without_lock'
    /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/locking/optimistic.rb:55:in `at
tributes_from_column_definition'
    /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2279:in `initialize'
    unit/basic_test.rb:56:in `new'
    unit/basic_test.rb:56:in `setup'


Note that the above is essentially the same when I try to access the accounts listing from my rails app, with the expected variations in the backtrace

With the rails app, if I generate the model class for XXXX (using script/generate model XXXX) for the object referred to in the log statement "Creating ActiveRecord stub for the referenced entity 'XXXXX'", the code will proceed further and fail identically but refer to another entity. After enough model classes are generated (to satisfy all associations, I guess), the code does work. But I realized after more research that ASF should handle all that for me. Somehow it doesn't.

I know I'm missing something, but don't know what. Any help is greatly appreciated.

Thanks,
Vijay



Message Edited by vijayn on 12-01-2008 03:20 PM
  • December 01, 2008
  • Like
  • 0

I get the "Method is not visible" error when a subclass extends an abstract class and implements an abstract method that is protected.  That method is called from the abstract class.  This is common implementation in other languages, but am getting an error when attempting this in Apex.  Only work around seems to be to make the method in the subclass that implements it to be public, even if it is only called from within the class.

 

Any ideas?

 

public abstract class SalesRecord_SupportCalc_Base { public SalesRecord_SupportCalc_Base(List<Id> salesRecordIds){ } protected abstract void RetrieveSalesRecords (); public void CalculateSupport(){ RetrieveSalesRecords(); } } public class SalesRecord_SupportCalc_Quote extends SalesRecord_SupportCalc_Base { public SalesRecord_SupportCalc_Quote(List<Id> salesRecordIds){ super(salesRecordIds); } protected override void RetrieveSalesRecords (){ } }

 

Hi all,

 

I am simply trying to enable rich text editing for one of my custom object fields 

Here's the VF code: 

<apex:page standardController="MyObject__c" sidebar="false" showHeader="false" > <apex:form > <apex:outputPanel id="contentPanel"> <apex:actionRegion > <apex:pageBlock> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> <apex:commandButton onclick="window.close();" value="Cancel"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Rich Text" columns="1" collapsible="false"> <apex:inputTextArea value="{!MyObject__c.TextArea__c}" richText="true"/> </apex:pageBlockSection> </apex:pageBlock> </apex:actionRegion> </apex:outputPanel> </apex:form></apex:page>

 

With no rich text attribute, this works. With richText=true, the value of the inputTextArea is not even sent to the server. Do I need to have something else to enable rich text editing. 

 

Any help appreciated.

 

thanks,

Vijay 

 

 

  • April 14, 2009
  • Like
  • 0

Hi all,

 

I'd like to override the New/Edit and View actions with the same VF page. Is this possible? If so, how do I detect when I'm in the 'new' mode, edit mode and view mode?

 

I can see that new gets passed a save_new=1 param. Is that the best indicator? what about View vs edit?

 

Any help is appreciated.

 

thanks,

Vijay

  • April 08, 2009
  • Like
  • 0

Hi all,

 

I am trying to do something like this:

        <apex:outputText rendered="{!state=SHOW}">This is the dashboard</apex:outputText>
 

where SHOW is a constant in my controller.(Rather than hard code numbers in my visual force pages).

 

Is there a way to do this. 

 

Vijay

  • March 23, 2009
  • Like
  • 0

We would like to annotate a site/page with some custom fields for our application. Is there a way to augment these objects with custom fields? 

 

thanks,

Vijay

 

 

  • March 05, 2009
  • Like
  • 0

Hi,

 

We're an ISV working on multiple applications that we want to distribute independently. Is there a way to have multiple packages within the same DE? As far as I can tell, it looks like we can only build 1 managed package within a single DE, meaning I've to have two DEs to achieve the above. Is that correct?

 

As a secondary question, we are debating(internally) whether we should split one application into two packages (one being an 'extension' of the other). Do we have to have two DEs for that as well? Ie one for the base package and one for the extension?

 

Note that we want to use License management for both apps(packages).

 

-cheers,

Vijay

 

 

thanks,

Vijay

  • March 04, 2009
  • Like
  • 0

Hi all,

 

Has anybody seen this problem before. When I try to navigate to my sites site. I see this:

 

Page Not Found: /

Stay tuned. Please email us if you need to get in touch.

 

 

 

And I get this email in my inbox:

 

There was a problem loading the FileNotFound page -- the designated Page Not Found Page (404) for Force.com site "root" -- when processing the following URL request: http://bhivesb1-developer-edition.na6.force.com/.

 

Note that the above page is not my 'FileNotFound' page (as I modified it slightly to tell the difference). This appears to be a failsafe page of some sort.

 

There's nothing interesting about this site. It's the default site. The only thing interesting was that it was in a DE with a managed package (and therefore w/ a package prefix).

 

The previews work fine.

 

Also, I tried this in another DE which did not have a managed package or prefix (and things were working). Then I set a package prefix and it failed in the same way.

 

Any help is greatly appreciated.

 

  • February 20, 2009
  • Like
  • 0
I am trying to build some Ruby utility scripts. Eventual I would like to replicate some basic export and import data scripts like Data Loader as a command line utility. Please stop me now if I am barking up the wrong tree. I am able to generate scaffolding through rails no problem using the scaffold generator(I have heard reference to a asfscaffold but can't find it.) But I would like to dump sObject data to a csv file.

the follow script works and generates a list of objects:


require 'rubygems'
require 'activesalesforce'

ActiveRecord::Base.establish_connection(
:adapter => 'activesalesforce',
:username => '',
:password => '',
:url => 'https://www.salesforce.com' )

sObjects = ActiveRecord::Base.connection.binding.describeGlobal([]).describeGlobalResponse.result.types.sort
puts sObjects



but I can't seem to figure out the syntax to describeSObjects syntax I have:

mySobjects = ['Contact', 'Account']
list = ActiveRecord::Base.connection.binding.describeSObjects(mySobjects).results

which returns nil

Can someone help me with this syntax?

Also an example of a query would be great too.

Thanks

Kyle
Hi all,

I am a newbie to activesalesforce and I'm trying to get it running. I ran into the above error when I created a simple rails app and added a scaffold for 'Account' using:

script/generate scaffold account

so, I tried to run the unit tests and got the same error (Error details after env)

My env:

ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]

actionmailer (2.2.2, 2.0.2.9216, 2.0.2.9129, 2.0.2, 1.3.6, 1.3.3)
actionpack (2.2.2, 2.0.2.9216, 2.0.2.9129, 2.0.2, 1.13.6, 1.13.3)
actionwebservice (1.2.6, 1.2.3)
activerecord (2.2.2, 2.0.2.9216, 2.0.2.9129, 2.0.2, 1.15.6, 1.15.3)
activerecord-activesalesforce-adapter (2.0.0)
activeresource (2.2.2, 2.0.2.9216, 2.0.2.9129, 2.0.2)
activesupport (2.2.2, 2.0.2.9216, 2.0.2.9129, 2.0.2, 1.4.4, 1.4.2)


database config
adapter: activesalesforce
username: <removed>
password: <removed>

I've tried with and w/o URLs specified (https://test.salesforce.com doesn't work for me).


Error details:

The log shows
Starting test 'AsfUnitTestsBasicTest.test_add_notes_to_contact'
   Created one-to-one relationship 'master_record' from Contact to Contact using master_record_id
   Creating ActiveRecord stub for the referenced entity 'Account'
E

The exception is:
  1) Error:
test_add_notes_to_contact(Asf::UnitTests::BasicTest):
NoMethodError: undefined method `connection=' for #<Class:0x19b0a90>
    /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1833:in `method_missing
'
    /Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connec
tion_adapters/activesalesforce_adapter.rb:698:in `configure_active_record'
    /Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connec
tion_adapters/activesalesforce_adapter.rb:672:in `each'
    /Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connec
tion_adapters/activesalesforce_adapter.rb:672:in `configure_active_record'
    /Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connec
tion_adapters/activesalesforce_adapter.rb:649:in `get_entity_def'
    /Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connec
tion_adapters/activesalesforce_adapter.rb:764:in `lookup'
    /Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connec
tion_adapters/activesalesforce_adapter.rb:717:in `columns'
    /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1220:in `columns'
    /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2839:in `attributes_fro
m_column_definition_without_lock'
    /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/locking/optimistic.rb:55:in `at
tributes_from_column_definition'
    /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2279:in `initialize'
    unit/basic_test.rb:56:in `new'
    unit/basic_test.rb:56:in `setup'


Note that the above is essentially the same when I try to access the accounts listing from my rails app, with the expected variations in the backtrace

With the rails app, if I generate the model class for XXXX (using script/generate model XXXX) for the object referred to in the log statement "Creating ActiveRecord stub for the referenced entity 'XXXXX'", the code will proceed further and fail identically but refer to another entity. After enough model classes are generated (to satisfy all associations, I guess), the code does work. But I realized after more research that ASF should handle all that for me. Somehow it doesn't.

I know I'm missing something, but don't know what. Any help is greatly appreciated.

Thanks,
Vijay



Message Edited by vijayn on 12-01-2008 03:20 PM
  • December 01, 2008
  • Like
  • 0
I have a custom object defined with a namespace/custom prefix : the resulting classname is something like ALT__Myklass__c

I wish to define Myklass in ActiveSFDC :
Code:
class Myklass < ActiveRecord::Base
    include ActiveSalesforce::ActiveRecord::Mixin
    set_table_name("ALT__Myklass__c")
end
This does not work : ActiveSFDC looks for ALT_Myklass (notice only 1 underscore), or defaults back to ALT_Myklass__c (still only 1 underscore). This does not work either if we do not set_table_name : AsctiveSFDC goes llooking for Myklass__c, with no prefix.


ActiveSFDC needs to handle namespace prefixes correctly, just as it handles custom '__c' suffixes.
  • March 19, 2007
  • Like
  • 0