• AxxxV
  • NEWBIE
  • 25 Points
  • Member since 2006

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 28
    Replies

I am just wondering if anyone has developed or come across as framework that would extend the unit test automation  that is built into the force.com platform to add capabilities of a Continuous Integrated Testing framework to allow scheduled automated builds and produce some kind of dashboard with statistics. I am thinking something similar to what frameworks like CruiseControl can do.

 

So, an example scenario would be n ISV, or a System integrator that needs to develop and maintain many force.com applications. In order to promote proper usage and discipline among development teams and encourage Test-Driven Development practices - it would be good to have a tools that would run scheduled builds across multiple dev orgs or sandboxes and provide an overall statistics on test coverage, test failures etc.

 

I am sure this should not be very hard to build since force.com does expose the API to execute the test methods (which is used for the Ecplise IDE plug-in to display test results). The limitation of the current IDE capabilities is that  you need to execute unit tests manually for each project.  

 

 

Message Edited by AxxxV on 03-11-2009 11:07 AM
Message Edited by AxxxV on 04-08-2009 12:10 PM
  • March 11, 2009
  • Like
  • 0

Is it possible to suppress or somehow avoid the automated email change notification/confirmation email.

 

In our case - we have an automated job (integration) that loads user records in the sadbox environment. Initially, actual user email addreses were loaded. Now we need to replace them with a "fudged" emails, so users do not receive any email, BUT when we update the email oa user record, the notification email will go out to the old email address.

 

Is there a way to avoid this?

Message Edited by AxxxV on 03-10-2009 12:53 PM
  • March 10, 2009
  • Like
  • 0

I have the following trigger which runs fine in the sandbox. However, when I attempt to deploy into production org, I receive the following message:

 

"DML not allowed on CampaignShare". 

 

It apears that for simne reason deleting CampaignShare records inproduction is not allowe, while is ok in the sandbox.

 

Both orgs are Spring '09 release.

 

Any help appreciated.

 

 

 

 

trigger CM_T20_SoftDeleteCampaign on Campaign (after update) {
deleteCampaignShare(Trigger.new);

private void deleteCampaignShare(Campaign[] campArr) {

Id softDeleteOwnerId = ConfigurationHelper.SOFT_DELETE_OWNER_USER.Id;

Set<ID> setCampaignIds = new Set<ID>();
for(Campaign campObj :campArr){
if(campObj.Soft_Delete_Pending__c == true) {
setCampaignIds.add(campObj.Id);
}
}

// check array size > 0 before calling update / delete
Campaign[] CampaignLst = [select Id, Soft_Deleted__c, Soft_Delete_Pending__c from Campaign where Id in :setCampaignIds];
if(CampaignLst != null && CampaignLst.size() > 0) {
for(Campaign campObj :CampaignLst)
{
campObj.Soft_Deleted__c = true;
campObj.Soft_Delete_Pending__c = false;
campObj.OwnerId = softDeleteOwnerId;
}
update CampaignLst;
}

CampaignShare[] lstCampShare = [select Id From CampaignShare where CampaignId in :setCampaignIds and RowCause = 'Manual'];
if(lstCampShare != null && lstCampShare.size() > 0)
delete lstCampShare;
}

}

 

 

 

Message Edited by AxxxV on 02-16-2009 11:04 PM
  • February 16, 2009
  • Like
  • 0

I have a VF page for a standard object that uses standard controller and a controller extension. When an invalid object Id is passed, or record is unavailable (deleted or due to permissions), the standard controller throws the "hard-error" and the error is displayed in the standard SFDC UI (with the sidebar and header). My application has a completely cusom UI and I do not want to be "thrown" into the standard SFDC UI in case of an error. I tried to trap the error in the extension controller class, but it looks like standard controller traps it first and does not allow me to put in place any custom error handling.

Any suggestions?

  • November 20, 2008
  • Like
  • 0
I am having difficulty finding a good solution to the following problem:

I have an edit page for a standard object that uses a standard controller and a controller extension. The controller extension has the following method that I am intending to use in order to implement my custom page redirection logic when "cancel" action occurs on the page:

Code:
public PageReference cancel2(){
        PageReference targetPage;
String loopbackUrl = System.currentPageReference().getParameters().get('loopback');

if(loopbackUrl != null && loopbackUrl != ''){
targetPage = new PageReference(loopbackUrl);
targetPage.setRedirect(true);
return targetPage;
}
else{
return this.stdController.cancel();
}
}

Page
<apex:commandLink action="{!cancel2}" value="></apex:commandLink>

Problem is that when cancel2 action is invoked on the page, the standard controller validation display the error "Error: Name you must enter a value", and the page never gets to my custom cancel routine. What is the best way to get around this?

I also have other scenarios where standard controller validation prevents me from invoking various methods in the extension controller.



  • November 19, 2008
  • Like
  • 0
Is it possible to use custom style for a standard related list component?

My sample page code:

Code:
<apex:page standardController="Lead" sidebar="false" showHeader="false" >
    <apex:relatedList subject="{!Lead}" list="CampaignMembers" pagesize="10"/>
</apex:page>

 
The resulting page looks like this:



I need to remove the default salesforce styling and apply my own stylesheet.
  • September 08, 2008
  • Like
  • 0
Is it possible to send a mass email from a trigger?

My scenario is:

- invoke trigger by editing a record
- trigger queries a Lead object and retrieves up to 250 records
- trigger constructs a massEmailMessage
- trigger executes "Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });"
- trigger finalizes and commits changes




Message Edited by AxxxV on 09-05-2008 03:46 PM
  • September 05, 2008
  • Like
  • 0
1. Is it possible to use multiple dashboards on top of a single set of reports passing parameters to the reports from each dashboard?

2. Is it possible to display a dashboard component in a VF page or an S-Control. Most likely the answer is no. I am just wondering if anyone has come up with some creative solution for this. This would be somewhat simlar to the dashboards section in a Home page, but I would like to be able to pick and choose which components to embed in a my custom page...


3. How can I show a dashboard page without the header? I cannot do this with VisualForce (showHeader="false") because dashboardsa are not supported in VF. I do remember though that there was a URL parameter that can be passed to a salesforce page to hide the header. I am sure I used it somewhere before, but now I cannot find it anywhere...



Message Edited by AxxxV on 07-02-2008 02:39 PM
  • July 02, 2008
  • Like
  • 0
I would like to prevent a user from deleting a Contact record based on certain logic based on record attributes.
However, instead of outputting an error message, I would like to update a record ownership, and not show the error to the user.

In short, can I prevent deletion without throwing an error?
  • June 24, 2008
  • Like
  • 0
I have the following use case that I have difficulty implementing. Premium support has been no help. I have a couple of workarounds in mind, but they seem too complex. Has anyone implemented similar use case? Seems like a very trivial scenario...


We have a
Private sharing in our org for Contact object. However, within Makreting group, users need to be able to have full access to each others' records. For example, if one user creates a few contact records, another other user should be able to delete them either directly, or as a result of a merge or import of data.

Sharing Rules and Manual Sharing only go as far as giving Read/Write access but no Full Access (no ability to delete).
 
An attempt of using Role Hierarchy solves this only half way, i.e. user in the top of the hierarchy can delete records owned by users below in the hierarchy, but not their peers or users above...
 



  • June 23, 2008
  • Like
  • 0
How can I restrict an ability to restore records froma Recycle Bin?

I tried the following code it did not work. This is for 'after undelete' trigger. The 'before undelete' is not supported as far as I can see.


Code:
if(Trigger.isUndelete){ 
 for(SCS_Client_Time_Series__c clts : Trigger.old){
  clts.addError('Not allowed to restore Time Series from Recycle Bin. Create new Time Series record instead.');
 }

}

 

  • June 17, 2008
  • Like
  • 0
Is there a way to restrict a user to only be able to add products to a pricebook only from a list of products contained in another in another pricebook?

  • June 11, 2008
  • Like
  • 0
I am looking for a message board product (preferably SaaS) that is integrated with salesforce and can be used as part of Customer Portal. I did some searching on AppExchange, but only found one vendor (Jive) which seems like an overkill for my use case and also has no SaaS option (i.e. has to be installed and hosted by me).

Are there any other solutions out there?


P.S. It is now possible to build my own forum with VisualForce, but I not veturing into that effort quite yet. I need some basic forum  functionality out-of-the-box that I can start using almost immediately.
  • June 09, 2008
  • Like
  • 0
I am having the following error in my unit tests. I was unable to find any information on this error in the documentation. Would like to know if possible whether this is a current limitation in Apex, that is not documented, or I am missing something.

This woks fine in pre-summer 08 orgs, but is failing in my Summer 08 enabled sandboxes.

Here is my code

Code:
static testMethod void InsertInvestmentAccountBulkTriggerBypass(){


User user = [Select Id From User Where Id =: UserInfo.getUserId()];
user.Bypass_Triggers__c = 'SCS_Investment_Account_Time_Series__c;Asset';

update user;

System.assert(GlobalSettings.bypassTriggers('Asset'));
System.assert(GlobalSettings.bypassTriggers('SCS_Investment_Account_Time_Series__c'));

Test.startTest();
Map<Id, Asset> IAMap = unitTests.createTestAsset(200);
System.assertEquals(200, IAMap.size());
Test.stopTest();
}




public static Map<Id, Asset> createTestAsset(Integer numberOfRecords){

Map<Id, Asset> IAMap = new Map<Id, Asset>();
Asset [] IAs = new List<Asset>();

Account client = unitTests.createTestAccount();
Product2 fund = [Select Id from Product2 LIMIT 1]; //TODO: extract out as a helper method

for (Integer i=0; i<numberOfRecords; i++){
Asset IA = new Asset();

IA.Name = 'unitTest_IA';
IA.AccountId = client.Id;
IA.Product2Id = fund.Id;

IAs.add(IA);
}


public static Account createTestAccount(){

Account a = new Account();
a.Name = 'Test Account';
a.Employee_Id__c = '123456';
insert a;

System.assertEquals(1, [Select count() from Account where Id = : a.Id]);

return a;
}

insert IAs;

for(Asset ia : IAs){
IAMap.put(ia.Id, ia);
}

return
}

Full error message:

System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on non-setup object is not supported after you have updated a setup object: Account

Stack trace:
Class.unitTests.createTestAccount: line 94, column 9
Class.unitTests.createTestAsset: line 146, column 26
Class.TimeSeriesUnitTests.InsertInvestmentAccountBulkTriggerBypass: line 27, column 32



Basically, I need to update a current user record, prior to testing triggers. Problem is that I am not allowed to update a user record and then execute DML statements on other objects.


Message Edited by AxxxV on 05-28-2008 02:29 PM
  • May 28, 2008
  • Like
  • 0
Is there a way to asoociate an Activity with multiple Contacts?

Our client's use case: When there is a meeting involving multiple contacts they want to be able to create a single task that will be related to all of the participating contacts.

If this is not possible by means of configuration or out of the box, what are the other avalable options? We have an EE edition, so no Apex Code. I can only think of fully custom UI pages using S-Controls that would create duplicate activity records and assign to multiple Contacts. Any alternative suggestions?


Thank you.
  • January 09, 2008
  • Like
  • 0
I am looking for a way to create documentation for Apex Code from Eclipse. I have not used Eclipse outside of Apex development, but I know there is a way to document code using comments and @parameters (Javadoc for example). Can anyone give me some pointers on how to implement code documenting with the Apex code?

Thank you!
  • November 29, 2007
  • Like
  • 0
I keep getting this error when attampt to synchronize the project in Eclipse:
I am using Eclipse 3.3.1 with with Apex Toolkit 8.1.0.200708160841


Error details:
Errors have occurred while calculating the synchronization state for Apex subscriber.
  An internal error occurred processing subscriber events.
    An internal error occurred processing subscriber events.
    Invalid thread access
  An internal error occurred processing subscriber events.
    An internal error occurred processing subscriber events.
    Invalid thread access

  • November 07, 2007
  • Like
  • 0
I am trying to copy an attachment from one account to the other in Apex Code and receive the following compilation error: "Data type not supported".

I highlighted the line of code that generated the error. It lookslike Apex Code does not support the .Body datatype. Is there anyway to insert an Attachment in Apex?

Here is the snippet of my code:

Code:
for (Attachment attachmentSource : [Select Body, ContentType, IsPrivate, Name from Attachment where ParentId = :a.Clone_From_ID__c])
{
Attachment attachmentTarget = new Attachment();


attachmentTarget.ParentId = a.Id;
attachmentTarget.OwnerId = a.OwnerId; //assign same owner as parent account

attachmentTarget.Body = attachmentSource.Body;
attachmentTarget.ContentType = attachmentSource.ContentType;
attachmentTarget.IsPrivate = attachmentSource.IsPrivate;
attachmentTarget.Name = attachmentSource.Name;

insert(attachmentTarget);
}

 




  • July 19, 2007
  • Like
  • 0

Please help me figure out the following seemingly trivial SOQL task:

I need to retrieve certain fields from Account object while filtering by fields from User object based on Account.OwnerId relationship. Conceptually the SOQL statement should look something like this:

Select Id, (Select Account.Owner.Name, Account.Owner.SomeotherField)
FROM User
WHERE User.SomeField = 'Something'

My problem is that I can't figure out how to reference the User fields through Account.OwnerId relationship. It appears that User object is different in a way that when you look at describeObject in ApexExplorer, the relashionship name for Account.Owner is not specified.

I suspect that this may have something to do with polymorphic keys, but I just can't connect all the dots here.

The main objective is to retrieve all the data in one SOQL statement as I am dealing with very large volume of records.

Your help is greatly appreciated.

 

 

  • May 22, 2007
  • Like
  • 0

We're in the process of evaluating the Force.com PaaS.  We've happily used Perforce as our SCM tool for many, many years, and of course Eclipse (and most other tools) offer extremely robust support for Perforce.  While I've found that the Force.com IDE plug-in and the Perforce plug-in can co-exist, it doesn't exactly seem to be a harmonious pairing.  Operations in Perforce are much more explicit than in other SCM systems, in particular SVN.

 

For example, by default files synced to the client from Perforce are read-only until explicitly opened for edit, and files added to the filesystem are unknown to Perforce until they are explicitly added.  Files can be added or updated via the Force.com IDE plug-in as a result of changes made through the Web system menu, e.g., in-browser editing of VisualForce pages, changes to custom objects and attributes, etc.  These changes are brought to the client by doing a Refresh from Server or Synchronize with Server.  When this happens, if the files are read-only the Force.com IDE complains that it can't overwrite a read-only file.  I would hope/expect that it would instead engage any active Team plug-in to ask the user whether it should be checked out for edit.  Similar with any added files.  Instead I have to go to the top of the tree and explicitly check out everything for edit, mark everything for add, and then revert all unchanged files to see my "real" changelist.  Alternatively I can set my Perforce client spec to be "allwrite", but it still doesn't really know which files have been edited or added, so while I don't get the complaints about read-only files, I still have to edit/add the files explicitly.
Hopefully I'm just missing something in the Force.com IDE plug-in, the Perforce plug-in, or Eclipse in general.  I'm very concerned about the potential for human error with the current process...enough so that we're discussing whether perhaps a stateless SCM system like SVN might be better, at least for the Force.com portion of the product.
Thanks in advance for any advice!  I may send the same thing to Perforce support to see if I can make progress on a solution.

 

hi,

I have created my custom page on visualforce platform,Now how do i make it visible to all others? Now only i can view it.

  • August 02, 2010
  • Like
  • 0

Some of our clients are experiencing random "Insufficient Privileges" errors on our managed Visualforce page that's embedded inside the Case object.  It appears to be happening on both IE, Safari and Firefox, but goes away after some time or if they switch browsers...

 

Any ideas on what might be causing this?

Thanks,

Jon

 

 

 

Hi all,

 

I'm currently stuck with batch Apex. My soql in batch apex doesn't return the formula fields value (rumber formula field.) It always return 0 for each number formula field. But the other fields except formula field are returned the value correctly.

 

 

Does any one have problem like me?

 

Any help is greatly appreciated.

  

I am just wondering if anyone has developed or come across as framework that would extend the unit test automation  that is built into the force.com platform to add capabilities of a Continuous Integrated Testing framework to allow scheduled automated builds and produce some kind of dashboard with statistics. I am thinking something similar to what frameworks like CruiseControl can do.

 

So, an example scenario would be n ISV, or a System integrator that needs to develop and maintain many force.com applications. In order to promote proper usage and discipline among development teams and encourage Test-Driven Development practices - it would be good to have a tools that would run scheduled builds across multiple dev orgs or sandboxes and provide an overall statistics on test coverage, test failures etc.

 

I am sure this should not be very hard to build since force.com does expose the API to execute the test methods (which is used for the Ecplise IDE plug-in to display test results). The limitation of the current IDE capabilities is that  you need to execute unit tests manually for each project.  

 

 

Message Edited by AxxxV on 03-11-2009 11:07 AM
Message Edited by AxxxV on 04-08-2009 12:10 PM
  • March 11, 2009
  • Like
  • 0

Is it possible to suppress or somehow avoid the automated email change notification/confirmation email.

 

In our case - we have an automated job (integration) that loads user records in the sadbox environment. Initially, actual user email addreses were loaded. Now we need to replace them with a "fudged" emails, so users do not receive any email, BUT when we update the email oa user record, the notification email will go out to the old email address.

 

Is there a way to avoid this?

Message Edited by AxxxV on 03-10-2009 12:53 PM
  • March 10, 2009
  • Like
  • 0

I have a VF page for a standard object that uses standard controller and a controller extension. When an invalid object Id is passed, or record is unavailable (deleted or due to permissions), the standard controller throws the "hard-error" and the error is displayed in the standard SFDC UI (with the sidebar and header). My application has a completely cusom UI and I do not want to be "thrown" into the standard SFDC UI in case of an error. I tried to trap the error in the extension controller class, but it looks like standard controller traps it first and does not allow me to put in place any custom error handling.

Any suggestions?

  • November 20, 2008
  • Like
  • 0
I am having difficulty finding a good solution to the following problem:

I have an edit page for a standard object that uses a standard controller and a controller extension. The controller extension has the following method that I am intending to use in order to implement my custom page redirection logic when "cancel" action occurs on the page:

Code:
public PageReference cancel2(){
        PageReference targetPage;
String loopbackUrl = System.currentPageReference().getParameters().get('loopback');

if(loopbackUrl != null && loopbackUrl != ''){
targetPage = new PageReference(loopbackUrl);
targetPage.setRedirect(true);
return targetPage;
}
else{
return this.stdController.cancel();
}
}

Page
<apex:commandLink action="{!cancel2}" value="></apex:commandLink>

Problem is that when cancel2 action is invoked on the page, the standard controller validation display the error "Error: Name you must enter a value", and the page never gets to my custom cancel routine. What is the best way to get around this?

I also have other scenarios where standard controller validation prevents me from invoking various methods in the extension controller.



  • November 19, 2008
  • Like
  • 0
Is it possible to use custom style for a standard related list component?

My sample page code:

Code:
<apex:page standardController="Lead" sidebar="false" showHeader="false" >
    <apex:relatedList subject="{!Lead}" list="CampaignMembers" pagesize="10"/>
</apex:page>

 
The resulting page looks like this:



I need to remove the default salesforce styling and apply my own stylesheet.
  • September 08, 2008
  • Like
  • 0
Is it possible to send a mass email from a trigger?

My scenario is:

- invoke trigger by editing a record
- trigger queries a Lead object and retrieves up to 250 records
- trigger constructs a massEmailMessage
- trigger executes "Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });"
- trigger finalizes and commits changes




Message Edited by AxxxV on 09-05-2008 03:46 PM
  • September 05, 2008
  • Like
  • 0
1. Is it possible to use multiple dashboards on top of a single set of reports passing parameters to the reports from each dashboard?

2. Is it possible to display a dashboard component in a VF page or an S-Control. Most likely the answer is no. I am just wondering if anyone has come up with some creative solution for this. This would be somewhat simlar to the dashboards section in a Home page, but I would like to be able to pick and choose which components to embed in a my custom page...


3. How can I show a dashboard page without the header? I cannot do this with VisualForce (showHeader="false") because dashboardsa are not supported in VF. I do remember though that there was a URL parameter that can be passed to a salesforce page to hide the header. I am sure I used it somewhere before, but now I cannot find it anywhere...



Message Edited by AxxxV on 07-02-2008 02:39 PM
  • July 02, 2008
  • Like
  • 0
I would like to prevent a user from deleting a Contact record based on certain logic based on record attributes.
However, instead of outputting an error message, I would like to update a record ownership, and not show the error to the user.

In short, can I prevent deletion without throwing an error?
  • June 24, 2008
  • Like
  • 0
I have the following use case that I have difficulty implementing. Premium support has been no help. I have a couple of workarounds in mind, but they seem too complex. Has anyone implemented similar use case? Seems like a very trivial scenario...


We have a
Private sharing in our org for Contact object. However, within Makreting group, users need to be able to have full access to each others' records. For example, if one user creates a few contact records, another other user should be able to delete them either directly, or as a result of a merge or import of data.

Sharing Rules and Manual Sharing only go as far as giving Read/Write access but no Full Access (no ability to delete).
 
An attempt of using Role Hierarchy solves this only half way, i.e. user in the top of the hierarchy can delete records owned by users below in the hierarchy, but not their peers or users above...
 



  • June 23, 2008
  • Like
  • 0
I am having the following error in my unit tests. I was unable to find any information on this error in the documentation. Would like to know if possible whether this is a current limitation in Apex, that is not documented, or I am missing something.

This woks fine in pre-summer 08 orgs, but is failing in my Summer 08 enabled sandboxes.

Here is my code

Code:
static testMethod void InsertInvestmentAccountBulkTriggerBypass(){


User user = [Select Id From User Where Id =: UserInfo.getUserId()];
user.Bypass_Triggers__c = 'SCS_Investment_Account_Time_Series__c;Asset';

update user;

System.assert(GlobalSettings.bypassTriggers('Asset'));
System.assert(GlobalSettings.bypassTriggers('SCS_Investment_Account_Time_Series__c'));

Test.startTest();
Map<Id, Asset> IAMap = unitTests.createTestAsset(200);
System.assertEquals(200, IAMap.size());
Test.stopTest();
}




public static Map<Id, Asset> createTestAsset(Integer numberOfRecords){

Map<Id, Asset> IAMap = new Map<Id, Asset>();
Asset [] IAs = new List<Asset>();

Account client = unitTests.createTestAccount();
Product2 fund = [Select Id from Product2 LIMIT 1]; //TODO: extract out as a helper method

for (Integer i=0; i<numberOfRecords; i++){
Asset IA = new Asset();

IA.Name = 'unitTest_IA';
IA.AccountId = client.Id;
IA.Product2Id = fund.Id;

IAs.add(IA);
}


public static Account createTestAccount(){

Account a = new Account();
a.Name = 'Test Account';
a.Employee_Id__c = '123456';
insert a;

System.assertEquals(1, [Select count() from Account where Id = : a.Id]);

return a;
}

insert IAs;

for(Asset ia : IAs){
IAMap.put(ia.Id, ia);
}

return
}

Full error message:

System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on non-setup object is not supported after you have updated a setup object: Account

Stack trace:
Class.unitTests.createTestAccount: line 94, column 9
Class.unitTests.createTestAsset: line 146, column 26
Class.TimeSeriesUnitTests.InsertInvestmentAccountBulkTriggerBypass: line 27, column 32



Basically, I need to update a current user record, prior to testing triggers. Problem is that I am not allowed to update a user record and then execute DML statements on other objects.


Message Edited by AxxxV on 05-28-2008 02:29 PM
  • May 28, 2008
  • Like
  • 0
Hi,
 
Is there any way we can set a custom error page if any uncaught exception occurs in the code, similarly we do in any of the webserver.
 
Currently if a page/class throws any such error, a salesforce error page is shown which asks to contact support@salesforce.com with an error Id.  Can we put our own custom visual force error page in place.
 
[GM]
  • April 10, 2008
  • Like
  • 0
Can I prevent deletion of an account that comes through our ERP but allow prospects to get deleted...  ?
I know i can override the button but i not very familiar with S-Controls.
 
I can distinguish between them though the prospect flag but dont know how to alert saying you cannot delete a account which is not propsect and there by make my trigger to work such that it avoids the deletion
 
Thanks in advance.
  • February 08, 2008
  • Like
  • 0