• dblaze
  • NEWBIE
  • 0 Points
  • Member since 2012

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

Hi Everyone,

I am trying to create a trigger that updates a field (Passed_Test_Count__c on the Employee__c Object.  It will update the field by adding +1 each time another field Passed_Date__c on the Team_Member_Test_Result__c changes from null to an actual date.  Listed below is my code, any help is greatly appreciated!

 

 

trigger PassedTestCounter on Team_Member_Test_Result__c (after insert, after update) {
{
Map<Id,Id> TeamMemberResultsMap = new Map<Id,Id>();
for(Team_Member_Test_Result__c A : trigger.new)
TeamMemberResultsMap.put(A.Passed_Date__c,A.Id);

List<Employee__c> EmployeeToUpdate = new List<Employee__c>{};

for (Employee__c Employee: [SELECT Id,Passed_Test_Count__c FROM Employee__c WHERE Id IN: TeamMemberResultsMap.keySet()])
{
Id empId = TeamMemberResultsMap.get(EmployeeToUpdate.Id);
Employee__c emp = trigger.newMap.get(empId);

boolean transition = trigger.IsInsert || (trigger.isUpdate && trigger.oldMap.get(emp.Id).Passed_Date__c != emp.Passed_Date__c);
if (emp.Passed_Date__c != null){
EmployeeToUpdate.Passed_Test_Account__c = EmployeeToUpdate.Active_Count__c.Passed_Test_Account__c + 1 ;
EmployeeToUpdate.add(EmployeeToUpdate);
}else if (emp.Passed_Date__c == 'null') {
EmployeeToUpdate.Active_Count__c = EmployeeToUpdate.Active + 0;
EmployeeToUpdate.add(Employee);
}
}
if(EmployeeToUpdate.Active_Count__c != null && !EmployeeToUpdate.Active_Count__c.isEmpty())
Database.update(EmployeeToUpdate.Active_Count__c);
}
}

 

 

 

Thank you!!

Hi Everyone,

As of right now I have a trigger that works exactly how I want it too but I am not able to get the test coverage working so that I can push it to production.  Can anyone help?  Below is the code for my trigger and my test coverage as it stands now...

 

Trigger

trigger AssignmentSubmitForApproval on lmscons__Transcript_Line__c (after update) {

for (Integer i = 0; i < Trigger.new.size(); i++) {

if (Trigger.old[i].lmscons__Percent_Complete__c == 0 && Trigger.new[i].lmscons__Percent_Complete__c == 100) {

// create the new approval request to submit
Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
req.setComments('Submitted for approval. Please approve.');
req.setObjectId(Trigger.new[i].Id);
// submit the approval request for processing
Approval.ProcessResult result = Approval.process(req);
// display if the reqeust was successful
System.debug('Submitted for approval successfully: '+result.isSuccess());
}
}
}

 

 

Test Coverage

@isTest
private class TestAssignmentSubmitForApproval {

static testMethod void MyUnitTest() {
lmscons__Transcript_Line__c lms = new lmscons__Transcript_Line__c();

lms.lmscons__Percent_Complete__c = 0;
//lms.lmscons__Transcript__c = lms.Id;
//lms.lmscons__Training_User_License__c = lms.id;

// insert the new lms
insert lms;
// change the probability of the lms so the trigger submits it for approval
lms.lmscons__Percent_Complete__c = 100;
// update the lms which should submit it for approval
update lms;
}
}

 

Note: the Transcript and User Liscensce fields are Master-Detail

 

Any help would be greatly appreciated!!

 

I am unable to create a new Force.com project

I enter my username/password  & security token but I keep getting the same error

 

I tried both Eclipse 3.5 & 3.4 same thing happens.

 

I tried a new security token - still unable to connect.

 

Can anyone please help.

 

This is from the log

 

WARN [2012-10-19 16:10:51,784] (BaseRetryAspect.java:isLoginExceptionRetryable:95) - Login evaluation deemed exception not retry-able:

SunCertPathBuilderException: unable to find valid certification path to requested target

WARN [2012-10-19 16:10:51,787] (BaseRetryAspect.java:isConnectionExceptionRetryable:131) - Connection evaluation deemed exception not retry-able:

SunCertPathBuilderException: unable to find valid certification path to requested target

WARN [2012-10-19 16:10:51,789] (ProjectController.java:getRemotePackageNames:882) - Unable to get project packages for project 'Mileage Tracker': unable to find valid certification path to requested target

WARN [2012-10-19 16:10:51,805] (ProjectOrganizationPage.java:prepareNextPage:271) - Unable to load org details - package names and component enablement

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)

at java.security.cert.CertPathBuilder.build(Unknown Source)

at sun.security.validator.PKIXValidator.doBuild(Unknown Source)

at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)

at sun.security.validator.Validator.validate(Unknown Source)

at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(Unknown Source)

at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)

at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)

at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(Unknown Source)

at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)

at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)

at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)

at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)

Hi I want to place a custom Add to campaign button on a custom object list page similar to the standard add to campaign button on contact and lead list view.

 

So this is the standrad ADD TO Campaign Button URL on the  Contact List view page 

 

https://cs15.salesforce.com/ui/campaign/MassAddCMFromListingWizard?ent=contact&retURL=%2F003%3Ffcf%3D00B30000006tYyH&wizardRetUrl=%2F003%3Ffcf%3D00B30000006tYyH&macmflw_idSourceType=List&macmflw_memberType=Contact

 

https://cs15.salesforce.com/ui/campaign/MassAddCMFromListingWizard?ent=contact&retURL=%2F003%3Ffcf%3D00B30000006tYyH&wizardRetUrl=%2F003%3Ffcf%3D00B30000006tYyH&macmflw_idSourceType=List&macmflw_memberType=Contact

 

And using this i have wrote a custom Button 

 

https://cs15.salesforce.com/ui/campaign/MassAddCMFromListingWizard?ent=Relationship__c.id&retURL=%2Fa09%3Ffcf%3D00B30000006YRjw&wizardRetUrl=%2Fa09%3Ffcf%3D00B30000006YRjw&macmflw_idSourceType=List&macmflw_memberType=Lead

 

https://cs15.salesforce.com/ui/campaign/MassAddCMFromListingWizard?ent=Relationship__c.id&retURL=%2Fa09%3Ffcf%3D00B30000006YRjw&wizardRetUrl=%2Fa09%3Ffcf%3D00B30000006YRjw&macmflw_idSourceType=List&macmflw_memberType=Lead

 it almost same problem is in the standard contact list page i can select all the contacts and clicl add to campaigns and it takes to the right screen but where as with the custom button it takes to the add campaigns screen once we click the button but if i select some records on the custom object list page and then click on the Add to campaigns button i get an Error saying 

Unable to Access Page

The value of the "ids" parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information.

 

 

Any Clue how to make this button work.

 

Thanks 

Akhil

Hello,

I am using Eclipse Galelio ver 3.5.2 and i am unable to login into the salesforce perspective with my credentials as it says connection timed out .also i have increased the time from 400 to 600 but still its not working .need help!!!