• Jordan Boxer
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
Hi,

I'm trying to upload dates to a custom date field in a custom object, but the records are only updating the non-date fields. Is there a format dates need to be in?

Thanks
Hi,

I am very new to Apex and need some help. I created an Apex trigger to run on a custom object that checks a box when a file is uploaded and unchecks a box when the file is removed. I manually tested it which worked and uploaded it to my production org, but found out that my code needs 75% testing coverage. I created a Test class but I'm getting 0% code coverage. Here is my Trigger:
 
trigger imaUp on Attachment (after insert, after update, after delete) {
	if(trigger.isInsert || trigger.isUpdate){
		List<IMA__c> co = [select id, Uploaded__c from IMA__c where id =: Trigger.New[0].ParentId];
			if(co.size()>0) {
				co[0].Uploaded__c = true;
				update co;
			}
	}
	if(trigger.isDelete) {
		List<IMA__c> co1 = [select id, Uploaded__c from IMA__c where id =: Trigger.old[0].ParentId];
			if(co1.size()>0) {
				co1[0].Uploaded__c = false;
				update co1;
            }
	}
}


And here is my Test Class:
@isTest
public class imaUpTest {
    @isTest static void test_method_one() {
      IMA__c co = new IMA__c();
        co.Date_Sent__c = Date.today();
        co.Date_Signed__c = Date.today();
        co.Entity__c = 'Test';
        co.Status__c = 'Signed';
        co.Uploaded__c = TRUE;
        insert co;
	  Attachment attach = new Attachment();
        attach.Name = 'TestFile';
        attach.parentId = co.id;
        insert attach;
    }
}


Once complete will I also have to reupload my code into my production org?

Thanks!
Hi,

I am very new to Apex and need some help. I created an Apex trigger to run on a custom object that checks a box when a file is uploaded and unchecks a box when the file is removed. I manually tested it which worked and uploaded it to my production org, but found out that my code needs 75% testing coverage. I created a Test class but I'm getting 0% code coverage. Here is my Trigger:
 
trigger imaUp on Attachment (after insert, after update, after delete) {
	if(trigger.isInsert || trigger.isUpdate){
		List<IMA__c> co = [select id, Uploaded__c from IMA__c where id =: Trigger.New[0].ParentId];
			if(co.size()>0) {
				co[0].Uploaded__c = true;
				update co;
			}
	}
	if(trigger.isDelete) {
		List<IMA__c> co1 = [select id, Uploaded__c from IMA__c where id =: Trigger.old[0].ParentId];
			if(co1.size()>0) {
				co1[0].Uploaded__c = false;
				update co1;
            }
	}
}


And here is my Test Class:
@isTest
public class imaUpTest {
    @isTest static void test_method_one() {
      IMA__c co = new IMA__c();
        co.Date_Sent__c = Date.today();
        co.Date_Signed__c = Date.today();
        co.Entity__c = 'Test';
        co.Status__c = 'Signed';
        co.Uploaded__c = TRUE;
        insert co;
	  Attachment attach = new Attachment();
        attach.Name = 'TestFile';
        attach.parentId = co.id;
        insert attach;
    }
}


Once complete will I also have to reupload my code into my production org?

Thanks!