• System Admin 995
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
Hello, 
We are currently facing an issue. If two users both preform in line edits to a record at the same time, and click save at the same time, no error is thrown and the user who clicked the save button last overwrites the previous user. 
Normally we would expect an error to be thrown stating that another user has made edits to the record, but this error is not appearing in all cases. Upon saving both users see their changes as being made, but after a refreash only one users changes will have been saved. All processes that would normally go off go off as if both sets of changes were saved.
Hello, 
We are currently facing an issue. If two users both preform in line edits to a record at the same time, and click save at the same time, no error is thrown and the user who clicked the save button last overwrites the previous user. 
Normally we would expect an error to be thrown stating that another user has made edits to the record, but this error is not appearing in all cases. Upon saving both users see their changes as being made, but after a refreash only one users changes will have been saved. All processes that would normally go off go off as if both sets of changes were saved.
Hello Community ! I am attemptimng to deploy a Apex Trigger to update resource requests on Opportunites with a Project name and change the status of the request as well. I want all this to occur when the opportunity hits closed won. 

WITH that said I have written the code and have it executing fully in the Sandbox wihtout any erros, and have my code coverage passing 100% when I run the tests for the test class in the SB.. 

What I am struggling with is deploying the code to Production.. 

When I attempt to deplot the code I am recieving the following error and I am not sure why i am at all.. 

Here is my Code 
public override void afterUpdate(SObject oldSo, SObject so)
    {
        Opportunity newOpp = (Opportunity)so;
        Opportunity oldOpp = (Opportunity)oldSo;
        
        if (newOpp.StageName == Constants.OPTY_STAGE_CLOSED_WON && newopp.Does_Not_Need_Resource_Request__c == FALSE){

        list<pse__Resource_Request__c> resourceRequests = [select ID, pse__Opportunity__c, Pse__Status__c FROM pse__Resource_Request__c];
        list<opportunity> opps = [Select ID, pse__Primary_Project__c from Opportunity];
        boolean isValid = false;
        
        for (pse__Resource_Request__c resourceRequest : resourceRequests)
        {

            if (resourceRequest.pse__Opportunity__c == newOpp.Id)
            {
            
                //there is a resource request that has the opportunity id of the current opp meaning the opp is valid
                isValid = true;
                resourceRequest.pse__Project__c = newOpp.pse__Primary_Project__c;
                resourceRequest.pse__Status__c = 'Assigned';

            }
        } 
        // if we get out of the loop and isValid is false, it means there were 0 opps that matched the resource request
        // return error
         if (!isValid) {
            so.addError('Please add Resource Requests to this Opportunity before marking it as "Closed Won." If no Resource Requests need to be added to the Opportunity please check the "Does Not Need Resource Request" checkbox in order to Close Win.');
                }

            }
        }

And here is my Test Class to go along with it. 
 
@isTest static void aftUpTest() 
        {

        TestDataFactory.initPermissionControls();


        //Prep the data 
        TestDataFactory.projects = TestDataFactory.createprojects(2);
        TestDataFactory.opportunities = TestDataFactory.createOpportunities(2);
        TestDataFactory.createResourceRequests(1, TestDataFactory.opportunities[0], TRUE);

	system.test.startTest();
            
        TestDataFactory.opportunities[0].StageName = Constants.OPTY_STAGE_CLOSED_WON;
        TestDataFactory.opportunities[0].Does_Not_Need_Resource_Request__c = FALSE;
        TestDataFactory.opportunities[0].Create_Project__c = FALSE;
        TestDataFactory.opportunities[0].Info_Complete__c = TRUE;
        TestDataFactory.opportunities[0].Pse__Primary_Project__c = TestDataFactory.projects[0].id;

        update TestDataFactory.opportunities;



        system.test.stopTest();

        }
 }

In the test code the test data factory is creating an opp for me, and setting it all up to be ready to close win, and then the test data factory is creating a resource request for me with the associated opportunity on the respource request set to the same opportunity the test data factory just created. 

With all this said the error message I am recieving when attempting to deploy the code to Production reads.. 


"Methods defined as TestMethod do not support Web service callouts 
Stack Trace: null"

PLEASE HELP. 


I have spent 3 days trying to uncover the error and still nothing, so any help would be MUCH appreciated!