• James S. CloudAnswers.com
  • NEWBIE
  • 90 Points
  • Member since 2009
  • CloudAnswers


  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 49
    Replies

We have PROFESSIONAL edition so I don't have the ability to edit profiles.

I would like to restrict non-admin from deleting records. Is there a way to do this? I've been searching the boards and can't seem to find a solution, or else I'm just looking in all the wrong places.

 

Any assistance would be much appreciated!

Thanks!

 

Kimberly J

I recently inherited the administration of SalesForce so bear wiht me please.

We recently change the standard Fiscal year to go from Feb 1 to Jan 31.  Previoulsy it was from jan to Dec.

We have a Custom Summary Formulas  that calculates YTD % for the sales reps.  This is the formula.

Opportunity.Order_Sale_Price__c:SUM / User.YTD_Sales_Quota__c:SUM   The format is percent and decimals are 2. 

This of course is wrong now since the calculation assumes January being included in the equation. Therefore all quoats are off by 50% as of right now which will increase as the year goes on since its still including January.

 

How could i change this formula to only include  the months that belong in this current Fiscal year?

 

THank you

  • March 03, 2009
  • Like
  • 0

On a newly installed 10.8 mac, I'm trying to run LexiLoader but it quits immediately upon start.  No window is shows, the icon appears in the doc and then goes away within 1 second.  Here is what happens in the console:

 

From v26:

2/6/13 11:24:50.914 AM com.apple.launchd.peruser.501[217]: ([0x0-0x8a08a].com.pocketsoap.LexiLoader[624]) Exited with code: 1

 

From v27:

2/6/13 11:26:32.417 AM com.apple.launchd.peruser.501[217]: ([0x0-0x90090].com.pocketsoap.LexiLoader[640]) Exited with code: 1

 

Java is installed, all updates are installed, Eclipse and PyCharm run fine (maybe not a java problem), security setting for running entrusted apps is set to the lowest setting.

 

The MD5 is not listed for the downloads, so I can't confirm if I have a good copy of them.  Can anyone list the MD5 of either v26 or v27 here?

I am using the web server oauth2 flow and have an application that lets a user connect 2 salesforce orgs to my application (which is Python/Django).  I found that if the user authenticates org 1 they come back to my app and when we try to send them to authenticate org 2 it automatically redirects them back to my site (the callback url) with the credentials for org 1.

 

Unfortunately, that means they have to log out of each org to set up the connection for the next one.  Is there a way to always prompt the user when they hit the oauth approval page instead of immediatly bouncing them back immately?  I tried changing the "state" parameter too but no luck - it just assumes if you've been authenticated for one org that you have to go back to that one if you're still logged into it.  The immediate parameter is defaulted to false and i even explicitly tried to set it with no luck.  I just want it to get that prompt page so you can get the option to log out and login as a new org.

 

Thoughts?

I am having a problem with some responses returned from the API when I delete fields.  API describe responses for page layouts are not consistent if a field on a related-list object was deleted.

Possible way to recreate:

Create custom field "TESTING" as text on contact.  Add the TESTING field to the account detail page related list for contact.  Delete the field from contact.

At this point the page layout returned in the account describe call still includes the TESTING field in the contact related list.

 

This is a problem because I would like to query the data based on the page layout but the query fails because the field does not exist.

I have a bunch of orgs that could benefit greatly from using the rest api.  How can I get into the pilot or have it enabled at all?

I use Trapdoor every day - there is simply no better way to manage all of my logins.  The fact it is integrated with the standard mac keychain is a big, big win for me as well.

 

Unfortunately, it stopped working today.  I just started up my snow leopard macbook and clicked trapdoor from dock and it crashes on start.  I downloaded a new copy from the website and ran it from my desktop just in case it was something locally corrupted in the program but I get the same error on start.

 

Here is the crash info, ideas?

 

 

Process:         Trapdoor [1330]
Path:            /Applications/Trapdoor.app/Contents/MacOS/Trapdoor
Identifier:      com.pocketsoap.trapdoor
Version:         ??? (1.7)
Code Type:       X86 (Native)
Parent Process:  launchd [663]

Date/Time:       2010-05-17 08:31:29.357 -0400
OS Version:      Mac OS X 10.6.3 (10D573)
Report Version:  6

Interval Since Last Report:          730638 sec
Crashes Since Last Report:           6
Per-App Interval Since Last Report:  1404866 sec
Per-App Crashes Since Last Report:   6
Anonymous UUID:                      BCFA652D-EC91-4FDF-A2F3-D2FEE6C8BEB1

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: aString != nil'
*** Call stack at first throw:
(
	0   CoreFoundation                      0x96c49bda __raiseError + 410
	1   libobjc.A.dylib                     0x92dba509 objc_exception_throw + 56
	2   CoreFoundation                      0x96c49908 +[NSException raise:format:arguments:] + 136
	3   Foundation                          0x9118cdc3 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
	4   AppKit                              0x9060690e -[NSMenuItem initWithTitle:action:keyEquivalent:] + 146
	5   Trapdoor                            0x0000be04 +[Browser buildPopUpButtonForBrowsers:] + 283
	6   Trapdoor                            0x00008424 -[NewCredentialsController awakeFromNib] + 39
	7   CoreFoundation                      0x96be2584 -[NSSet makeObjectsPerformSelector:] + 196
	8   AppKit                              0x905c7bc8 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1566
	9   AppKit                              0x905c5ba0 loadNib + 257
	10  AppKit                              0x905c4f99 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 228
	11  AppKit                              0x905c4eaa +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 158
	12  AppKit                              0x905c4df5 +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 383
	13  AppKit                              0x905c1bf9 NSApplicationMain + 434
	14  Trapdoor                            0x00002362 start + 54
)


Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   com.apple.CoreFoundation      	0x96c94a07 ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ + 7
1   libobjc.A.dylib               	0x92dba509 objc_exception_throw + 56
2   com.apple.CoreFoundation      	0x96c49908 +[NSException raise:format:arguments:] + 136
3   com.apple.Foundation          	0x9118cdc3 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4   com.apple.AppKit              	0x9060690e -[NSMenuItem initWithTitle:action:keyEquivalent:] + 146
5   com.pocketsoap.trapdoor       	0x0000be04 +[Browser buildPopUpButtonForBrowsers:] + 283
6   com.pocketsoap.trapdoor       	0x00008424 -[NewCredentialsController awakeFromNib] + 39
7   com.apple.CoreFoundation      	0x96be2584 -[NSSet makeObjectsPerformSelector:] + 196
8   com.apple.AppKit              	0x905c7bc8 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1566
9   com.apple.AppKit              	0x905c5ba0 loadNib + 257
10  com.apple.AppKit              	0x905c4f99 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 228
11  com.apple.AppKit              	0x905c4eaa +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 158
12  com.apple.AppKit              	0x905c4df5 +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 383
13  com.apple.AppKit              	0x905c1bf9 NSApplicationMain + 434
14  com.pocketsoap.trapdoor       	0x00002362 start + 54

Thread 1:
0   libSystem.B.dylib             	0x91a4ebd2 __workq_kernreturn + 10
1   libSystem.B.dylib             	0x91a4f168 _pthread_wqthread + 941
2   libSystem.B.dylib             	0x91a4ed86 start_wqthread + 30

Thread 2:  Dispatch queue: com.apple.libdispatch-manager
0   libSystem.B.dylib             	0x91a4fb42 kevent + 10
1   libSystem.B.dylib             	0x91a5025c _dispatch_mgr_invoke + 215
2   libSystem.B.dylib             	0x91a4f719 _dispatch_queue_invoke + 163
3   libSystem.B.dylib             	0x91a4f4be _dispatch_worker_thread2 + 240
4   libSystem.B.dylib             	0x91a4ef41 _pthread_wqthread + 390
5   libSystem.B.dylib             	0x91a4ed86 start_wqthread + 30

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x00000000  ebx: 0x92dba4e5  ecx: 0xa021a4e0  edx: 0x0000003b
  edi: 0xa03e3af0  esi: 0x00242cb0  ebp: 0xbffff648  esp: 0xbffff630
   ss: 0x0000001f  efl: 0x00000286  eip: 0x96c94a07   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
  cr2: 0x52eed000

Binary Images:
    0x1000 -    0x11ff7 +com.pocketsoap.trapdoor ??? (1.7) <7C956715-AFB9-B209-A435-CF78AFE2B9F6> /Applications/Trapdoor.app/Contents/MacOS/Trapdoor
   0x1e000 -    0x2aff7 +org.andymatuschak.Sparkle ??? (1.1) /Applications/Trapdoor.app/Contents/Frameworks/Sparkle.framework/Versions/A/Sparkle
   0x35000 -    0xeafe7  libcrypto.0.9.7.dylib 0.9.7 (compatibility 0.9.7) <0B69B1F5-3440-B0BF-957F-E0ADD49F13CB> /usr/lib/libcrypto.0.9.7.dylib
0x8fe00000 - 0x8fe4162b  dyld 132.1 (???) <211AF0DD-42D9-79C8-BB6A-1F4BEEF4B4AB> /usr/lib/dyld
0x901e6000 - 0x9024affb  com.apple.htmlrendering 72 (1.1.4) <4D451A35-FAB6-1288-71F6-F24A4B6E2371> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HTMLRendering.framework/Versions/A/HTMLRendering
0x902d1000 - 0x90379ffb  com.apple.QD 3.35 (???) <B80B64BC-958B-DA9E-50F9-D7E8333CC5A2> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/QD
0x90403000 - 0x905bfff3  com.apple.ImageIO.framework 3.0.2 (3.0.1) <CB39B067-58B8-70DB-3E40-160604664A6D> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
0x905c0000 - 0x90e9fff7  com.apple.AppKit 6.6.5 (1038.29) <E76A05A6-27C6-DA02-0961-5C8EEDC5F0A7> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
0x90ed1000 - 0x90f8afe7  libsqlite3.dylib 9.6.0 (compatibility 9.0.0) <16CEF8E8-8C9A-94CD-EF5D-05477844C005> /usr/lib/libsqlite3.dylib
0x9102c000 - 0x910acfeb  com.apple.SearchKit 1.3.0 (1.3.0) <9E18AEA5-F4B4-8BE5-EEA9-818FC4F46FD9> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit
0x910ad000 - 0x9131dffb  com.apple.Foundation 6.6.2 (751.21) <DA7A173A-4435-ECD6-F4AF-977D722FD2F7> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
0x918ae000 - 0x9190ffe7  com.apple.CoreText 3.1.0 (???) <1372DABE-F183-DD03-03C2-64B2464A4FD5> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreText.framework/Versions/A/CoreText
0x91910000 - 0x919dafef  com.apple.CoreServices.OSServices 357 (357) <764872C3-AE30-7F54-494D-4BA3CE4F4DFB> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
0x919db000 - 0x919dbff7  com.apple.CoreServices 44 (44) <AC35D112-5FB9-9C8C-6189-5F5945072375> /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
0x91a28000 - 0x91bcdfeb  libSystem.B.dylib 125.0.1 (compatibility 1.0.0) <06A5336A-A6F6-4E62-F55F-4909A64631C2> /usr/lib/libSystem.B.dylib
0x91c40000 - 0x91c8dfeb  com.apple.DirectoryService.PasswordServerFramework 6.0 (6.0) <BF66BA5D-BBC8-78A5-DBE2-F9DE3DD1D775> /System/Library/PrivateFrameworks/PasswordServer.framework/Versions/A/PasswordServer
0x91c8e000 - 0x91cb6ff7  libxslt.1.dylib 3.24.0 (compatibility 3.0.0) <769EF4B2-C1AD-73D5-AAAD-1564DAEA77AF> /usr/lib/libxslt.1.dylib
0x91cb7000 - 0x91cd8fe7  com.apple.opencl 12.1 (12.1) <1BCA4F60-E612-5C1B-EF50-A810D70CDF05> /System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL
0x91cd9000 - 0x9210eff7  libLAPACK.dylib 219.0.0 (compatibility 1.0.0) <5E2D2283-57DE-9A49-1DB0-CD027FEFA6C2> ......... (truncated, too big to paste here)

 

 

Hello,

I'm trying to deserialize CaseHistory from a String but im getting an unhandled error

Running this code in an anonymous console produces the error:

CODE:

String caseHistoryString = JSON.serialize([SELECT Id, CaseId, OldValue, NewValue FROM CaseHistory WHERE CaseId = '5004100000KERwkAAH']);

JSON.deserialize(caseHistoryString, List<CaseHistory>.class);

ERROR:

16:40:05:040 FATAL_ERROR System.UnexpectedException: Salesforce System Error: 1379890468-29928 (482212380) (482212380)

I have also tried to deserialize this other query and I'm not getting any error, so seems that the cause must be the OldValue, NewValue fields

String caseHistoryString = JSON.serialize([SELECT Id, CaseId, CreatedDate FROM CaseHistory WHERE CaseId = '5004100000KERwkAAH']);

JSON.deserialize(caseHistoryString, List<CaseHistory>.class);

Thank you,
Miguel
Hi folks and thank you for taking a look at this question,

I am getting this error in a trigger in an org I inherited, but the error is not always presenting itself and I cant figure out exactly how to fix it.

All my research shows that it is a governor limit error, but I'm not sure how to fix it in this inherited code. And the code is as follows:
 
trigger ProcessWebFields on Lead (after insert, after update) {

  for (Lead updatedLead : Trigger.new) {  
        
        // If these criteria are met, we've just create a Lead and 
        // there are values in the Web_UMOL field.
        if(updatedLead.Web_Program_of_Interest__c != NULL && updatedLead.Primary_Program_of_Interest__c == NULL){
          
          // Break up the Web_ field
          String[] umolProgramsArr = updatedLead.Web_Program_of_Interest__c.split(';');
          
          // Create Point of Interest records
          for(String program : umolProgramsArr) {
            Utilities.registerInterest(updatedLead.Id, program);
          }

          // Set the main Program of Interest
            List<Program__c> primaryProgramList = [SELECT Id FROM Program__c WHERE Name = :Utilities.getRealProgramName(umolProgramsArr[0])];
            if(primaryProgramList.size() == 1){
                Utilities.setPrimaryProgramOfInterest(updatedLead.Id, umolProgramsArr[0]); 
                Utilities.checkPrimaryPOI(updatedLead.Id, primaryProgramList[0].Id);
            }
            
         
         // Otherwise, we are evaluating a change made that will effect the Primary 
         // Program of Interest lookup field.
        } else {

          // If no Trigger.old, it's the first time running through and we don't want this code.
          if(Trigger.old != null){
            Lead oldLead = Trigger.oldMap.get(updatedLead.Id);
            // Check to see if there is a change to the Primary_Program_of_Interest__c lookup
          if(updatedLead.Primary_Program_of_Interest__c != oldLead.Primary_Program_of_Interest__c){
            Utilities.syncPrimaryPOI(updatedLead.Id, updatedLead.Primary_Program_of_Interest__c);
          }
          }
          
        }

        

    }

Thank you for helping folks.
Is it possible to initiate another batch from the Execute method of a running batch?
My requirement:
Users charge time to Timecards. At the end of the week I have a group of timecards (Timecard Header records) where time is charged to place holder projects. These place holder projects have child projects that are Billable projects. The time charged to these place holder projects should be distributed to all the active milestones of these child projects. Currently, I have a future method that takes the time from this timecard with the place holder project and distributes it the active milestones of the child projects by creating time card Header record for each of these active milestone/project combination. We are running into CPU time limit error when a place holder project has large no. of child projects.
In order to get around this problem I chose to implement this using batch apex. The idea is to have one batch apex batch1 to process these place holder timecards in batches of 1. Then in the Execute method of batch1, if the child project count > 50 then initiate batch2 from the Execute method to process 10 child projects at a time.
 
Hi 
I've to create a deep Link to a Lightning Component that must be opened in salesforce1 mobile app. This link isn't inside salesforce, is external and must redirect to the salesforce1 mobile app . The component is inside a tab, how can be the tab redirected in salesforce1?
Thanks
I've been asked set up a rule when a customer replies to emails/cases via email-to-case.  When a customer replies we need to check if the case owner (user) is Offline in Omni-channel.  If offline, then reassign the case to the support queue.   Any thoughts on this? 
Hi,

We have requirement to take copy of deleted feeditem and its comments. As casedelete does not work, we are deleting feedcomments using feeditem trigger. It works only for system admin, but does not work for other users as they do not have "View All Data" permission (Only Admin or users with View All Data permission can query on feedcomment). So is there any way to avoid querying feedcomment while feeditem is fired.

Regards,
Animesh
 
I have a permissionset pulled from an org. In it it lists the "ApproveContract" permission, set to true. When I try to sdeploy to another Org the deployment is rejected with
Error: Unknown user permission: ApproveContract
I assume that this permission is tied to an admin activated feature. What feature is it and how can I turn it off?

I can't find any documentation for this permission at all.
I have a visualforce page with a controller.
Two parameters are passed: the ID of a custom-object and the ID of an EmailTemplate-Object.
I query the EmailTemplate and want to output the template in a textarea. That works fine.
Unfortunately the merge fields in the EmailTemplate are as they are in the template (e.g.  "{!Custom_Object__c.Field1}").
Is there are simple way to replace those placeholders with the values of the custom-object I get from the passed ID?

I tried this: http://salesforce.stackexchange.com/questions/13/using-apex-to-assemble-html-letterhead-emails/8745#8745
But unfortunately it does not work because I cannot run Database.setSavepoint() at that point. I get the error "DML currently not allowed".

Is there another way to accomplish what I want to do without doing a simple string-replace for all possible Fields of Custom_Object__c?
Hi there, 

We are looking for someone who would be able to create a way for us to send mass email from a list view in Salesforce by making a call with the Gmail API and routing the emails through our Gmail domain servers instead of through Salesforce.  The limitations of Salesforce mass email have hamstrung our sales process and we need an easy way to let our reps pick a set of Contacts from a list and compose an email to them from within Salesforce that will authenticate againest the users Gmail and send the emails through Gmail.  

I have looked through the documentation so I know it's possible, but unfortunatley we don't have the internal coding resources to handle this.  Would any body out in the communtiy care to bid for the job?

Thanks and please feel free to respond with any questions regarding the scope. 
I'm trying to use CSV data in an apex class. There are many articles written about how to parse csv data in apex, but not many on the first part: accessing the csv data in apex. I've looked into import wizard (and data loader) but my csv data is not being uploaded into any sobjects. Rather, the csv data will be used for a SOQL query.

Ultimately I'd like the following query to be able to use my csv data:
SELECT Object.Name Object.custom_field__c FROM Object WHERE custom_field__c in :[csv data]

How can I make this happen?

Thank you so much!

Hi,  

 

I am using URLRewriting and it works quite well for my requirements.  Therefore if I have for example links with "/test1", "/test2", "/test3" etc I can access my page https://mydevorg/sitehome/test1  and this works perfectly.  I wish to also rewrite (hide) url parameters if parameters are contained in the URL

 

Therefore /test1?param1=hello&param2=goodbye  would display to the user as "https://mydevorg/sitehome/test1" and not "https://mydevorg/sitehome/test1?param1=hello&param2=goodbye"

 

Do you know if this is possible?  

 

Thanks in advance for any help.

On a newly installed 10.8 mac, I'm trying to run LexiLoader but it quits immediately upon start.  No window is shows, the icon appears in the doc and then goes away within 1 second.  Here is what happens in the console:

 

From v26:

2/6/13 11:24:50.914 AM com.apple.launchd.peruser.501[217]: ([0x0-0x8a08a].com.pocketsoap.LexiLoader[624]) Exited with code: 1

 

From v27:

2/6/13 11:26:32.417 AM com.apple.launchd.peruser.501[217]: ([0x0-0x90090].com.pocketsoap.LexiLoader[640]) Exited with code: 1

 

Java is installed, all updates are installed, Eclipse and PyCharm run fine (maybe not a java problem), security setting for running entrusted apps is set to the lowest setting.

 

The MD5 is not listed for the downloads, so I can't confirm if I have a good copy of them.  Can anyone list the MD5 of either v26 or v27 here?

I have a trigger that captures the approver ID in an approval process and updates a field with it on the Opportunity. I'm trying to write the unit test for it, but I'm running into errors. It is saying that there are required fields, but I have no idea what these fields are or how to set them. Has anyone been able to resolve something like this before?

 

Below is the specific error message, trigger code, and test code. Thank you so much for the help!

 

Trigger:

rigger TagSalesPlanner on Opportunity (after update) {

for (Opportunity opp : Trigger.new) {
Opportunity OldOpp = Trigger.oldMap.get(opp.ID);
if ((oldopp.ApprovalStatus__c != 'Approved' && opp.ApprovalStatus__c == 'Approved') || (oldopp.ApprovalStatus__c != 'Rejected' && opp.ApprovalStatus__c == 'Rejected')){

//get list of Approved Opportunities
List<Opportunity> ApprovedOpps = [SELECT ID, ProposalApprovers__c
FROM Opportunity
WHERE Id in: trigger.new];
    system.debug('* * * * Approved Opps List* * * *' + ApprovedOpps);

//get list of related Approval Processes
List<ProcessInstance> ap = [SELECT ID, TargetObjectID
                            FROM ProcessInstance
                            WHERE TargetObjectID in : ApprovedOpps];
                            system.debug('processInstance List' + ap);

List<ProcessInstanceStep> actor = [SELECT ActorID,ProcessInstanceID
                                   FROM ProcessInstanceStep
                                   WHERE (StepStatus='Approved' OR StepStatus='Rejected') AND ProcessInstanceID in: ap];
                                   system.debug('processInstanceStep List' + actor);

/*****************************************************
To get the list of proposal approvers in the opportunity record , I have created Maps and List to get the records.
**********************************************************/

Map<ID,List<ID>> pactors = new  Map<ID,List<ID>>();
 List<ID> l;
for(ProcessInstanceStep pa : actor){
        if(pactors.get(pa.ProcessInstanceID) == null){
           l = new List<ID>();
           l.add(pa.ActorID);
           pactors.put(pa.ProcessInstanceID,l);
           }
        else
            pactors.get(pa.ProcessInstanceID).add(pa.ActorID);
    
    }
  system.debug('processinstancemap '+ pactors);  
  
  
Map<ID,List<ID>> actors = new Map<ID,List<ID>>();
for(ProcessInstance pi: ap){
    actors.put(pi.TargetObjectID,pactors.get(pi.ID));
}
    system.debug('Process Instance map'+ actors);

for(Opportunity opp1 : ApprovedOpps){
    List<ID> approverIds = actors.get(opp1.ID);
    system.debug('approver Ids'+ approverIds);

opp1.ProposalApprovers__c='';
for (Integer i=0; i<approverIds.size(); i++){
    opp1.ProposalApprovers__c = opp1.ProposalApprovers__c + ','+ approverIds[i];}
    system.debug('Proposal approvers'+ opp1.ProposalApprovers__c);
}
update ApprovedOpps;
}
}
}

 

Unit Test

@isTest(SeeAllData = true)
private class Test_TagSalesPlanner{
    static testMethod void testTagSalesPlanner(){

//Set up the test records for Master Terms

Account account = new Account();
    account.Name='TestAccount';
    account.website='test.com';
    account.Industry='Entertainment';
       insert account;

Opportunity opportunity = new Opportunity();
    opportunity.AccountId = account.Id;
    opportunity.Name = 'Test Opportunity';
    opportunity.CloseDate = System.today();
    opportunity.StageName = 'In Negotiations';
    opportunity.Amount = 10000.00;
    opportunity.Type = 'New Client';
    opportunity.HasMasterDDForm__c = null;
    opportunity.approvalstatus__c = 'Not Submitted';
    opportunity.rate_type__c = 'CPM';
    
    System.debug('******** Pricebook Entry ID***********' + opportunity.PricebookEntryID__c);
    System.debug('******** Pricebook Entry Name__c ***********' + opportunity.workflowPricebookEntryName__c);
    
    insert opportunity;
    
    List<Opportunity> oppList1 = [SELECT id, workflowPricebookEntryName__c, PricebookEntryID__c FROM Opportunity WHERE id =:opportunity.id];
    System.debug('********* Pricebook Entry ID After Insert*****' + oppList1[0].PricebookEntryID__c);
    System.debug('********* Pricebook Entry Name After Insert*****' + oppList1[0].workflowPricebookEntryName__c);
    
ProposalFlight__c proposalflight = new ProposalFlight__c();
   proposalflight.opportunity__c = opportunity.Id;
   proposalflight.flightbudget__c = 100;
   proposalflight.flightstartdate__c = system.today();
   proposalflight.flightenddate__c = system.today()+60;
   proposalflight.approvalstatus__c = 'Not Submitted';
   proposalflight.versiontype__c = 'Master Terms';
   insert proposalflight;
   
ProcessInstance processInstance = new ProcessInstance();
    processInstance.TargetObjectID = opportunity.ID;
    processInstance.Status = 'Pending';
    insert processInstance;
    
ProcessInstanceStep piStep = new ProcessInstanceStep();
    piStep.StepStatus = 'Approved';
    piStep.ProcessInstanceID = processInstance.ID;
    piStep.ActorId = '00570000001ups6';

//cause trigger to fire    
    Test.startTest();
    insert piStep;
    Test.stopTest();
    system.debug('*********Approver IDs***********' + opportunity.ProposalApprovers__c);
    
//Validate that the Opportunity Flight Approval Status was updated
    List<Opportunity> oppList = [SELECT id, approvalstatus__c FROM Opportunity WHERE id =:opportunity.id];
    System.assertequals('Approved', oppList[0].approvalStatus__c);
   
//Validate that the Proposal Flight Approval Status was updated
    List<ProposalFlight__c> pfList = [SELECT id, approvalstatus__c FROM ProposalFlight__c WHERE id = :proposalflight.id];
    System.assertequals('Approved',pfList[0].approvalstatus__c);   
   }
   }

 

Error Message:

System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [ProcessDefinitionId, CurrentNodeId]: [ProcessDefinitionId, CurrentNodeId]Class.Test_TagSalesPlanner.testTagSalesPlanner: line 45, column 1

 

 

Hi All, I wanted to retrieve Salesforce Id of a field in Apex code. Any Idea? Thanks
  • December 03, 2010
  • Like
  • 0

So what I am trying to accomplish is to upsert  List<sObject> with a field specification of what the external Id is. However this is the error message I get back when I try to save the class.

 

List<sObject> newlist = new List<sObject>();

 

upsert newlist ext_Id__c; (Error Msg: "Upsert with a field specification requires a concrete sObject type)

 

 

Any idea of a way around this?

 

 

I have an APEX Trigger that runs when a Task is created/updated, so it can update the related Case. 

 

Somehow, the trigger is causing the Case Assignment Rules to re-fire, but I don't know what.  Any thoughts?

 

 

 

trigger caseLastActivityDate on Task (after insert, after update) { Map<String, Task> tMap = new Map<String, Task>(); for (Task t : System.Trigger.new) { String whatId = t.WhatId; System.debug('whatId is ' + whatId); if(whatId <> null && whatId.startsWith('500') == true) { Case c = [select Id from Case where Id = :whatId]; if(c.Id <> null) { c.Last_Activity_Date__c = t.LastModifiedDate; update c; } } } }

 

 

 

Hey,

I will be finding this out for myself in the next little while, but meanwhile:  Does anybody know whether the following is possible?

Say we have a managed package, with NS prefix 'XXX' and the following class:

global virtual class baseClass {

    WebService String baseString;

    public baseClass () {
        baseString = 'bsaeClass instantiated';
    }
}

 We have this package deployed on an org, and now we want to do the following:

global class myClass extends XXX.baseClass {

    WebService String myString;

    public myClass () {
        super ();  // --- not sure if this is necessary ---
        myString = 'myClass instantiated';
    }
}

Is this legal?  Can you extend a virtual base class, if that class is sitting inside a managed package?  Can you even include virtual classes within a managed package, for that matter?
  • December 08, 2008
  • Like
  • 0