• jeveleth
  • NEWBIE
  • 55 Points
  • Member since 2011

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 15
    Replies

When I dowload the latest Force.com IDE for Mac OS, and I try to extract the .tgz file using Archive Utility, I get an error:

 

Unable to expand "force.com-ide-installer-macosx.tgz" into "Downloads". (Error 1 – Operation not permitted.)

 

Doing tar -zvzf force.com-ide-installer-macosx.tgz in the Terminal results in:

 

force.com-ide-installer-macosx/configuration/install-content.bin: (Empty error message)
tar: Error exit delayed from previous errors.

 

What's up with that?

My Lead object contains a custom field Sales_Development_Rep__c that should contain the name of one of the two people on our staff whose user role is Sales Development (as represented by a specific UserRoleID). Sometimes Leads are created by a Marketo flow, and sometimes they are created by the Sales Development staff.

I'm trying to create a trigger that will ensure that when a Lead is created by someone whose role is Sales Development *and* the Sales Development Rep field is blank, the record will autopopulate the Sales Development Rep field with the appropriate person's name (via their User.Id). I've tried several approaches, but I haven't been able to get the trigger to work. The latest version of my code is below. Can anyone help?

trigger FillBlankSDRField on Lead (before insert) { 

for (l : [Select l.Owner.UserRoleId, l.Owner.Username, l.OwnerId, l.Sales_Development_Rep__c, l.Id From Lead l) { if (l.Sales_Development_Rep__c != null) continue; if !(l.Owner.UserRoleId = '00E50000000kyI8') continue; l.Sales_Development_Rep__c = l.OwnerId; }
}

 

I've created a Visualforce page for my instance's Lead object, because I'd like to enable tabbed views of the different related lists on a given Lead record. One of the related lists that I'd like to carry over from the original view is "HTML Email Status." Unfortunately, I cannot find the API name. I've looked through all of the elements on the Lead object in my instance's WSDL where type=tns:QueryResult, but to no avail. Can anyone advise?

I'm writing a trigger that *should* update a blank custom field (named Setup_User_Fname__c) on the Opportunity object with values from a the Opportunity's Primary Contact when the Opportunity is closed.


I'm pretty sure that my SOQL query in the code below is not restrictive enough, as it returns the following error:

This code yields this result: System.QueryException: List has more than 1 row for assignment to SObject:
Trigger.FillBlankSetupUserFieldsonOpportunityClose: line 5, column 1

Unfortunately, I'm new to SOQL, and I'm not sure what I'm doing wrong. The full code is below.

trigger FillBlankSetupUserFieldsonOpportunityClose on Opportunity (before update) {

    for (Opportunity o : Trigger.new) {
        if (o.IsClosed) {
            Contact c =    [Select c.LastName, c.FirstName, c.Email,
            (Select Id, ContactId, Role, IsPrimary From OpportunityContactRoles Where IsPrimary = true and OpportunityId = :o.id) From Contact c];
                if (c != null && o.Setup_User_Fname__c == null) {
                    o.Setup_User_Fname__c = c.FirstName;
                }
        }
    }
}

 I'd be grateful for any advice on how to fix this error.

I'm trying to create an Apex trigger that will prevent a record on the custom object Work Order from being deleted if a box in the object (Ready For Invoice) is checked. The trigger fires in my sandbox, but my unit tests seem to cover 0% of the trigger. I've walked through the relevant sections of the Force.com workbook on testing (Tutorials 7 and 8), but I'm having little luck. Can anyone advise?


The code is below:

 

//Trigger
trigger noDeleteReadyForInvoice on Work_Order__c (before delete)
  {
     for (Work_Order__c q: trigger.old)
      if (q.Ready_for_Invoice__c == true)
      {
       q.AddError('Cannot delete Work Order that is ready for invoice.');
       }
  }

//Test
@isTest
private class noDeleteReadyForInvoice {
static testMethod void testWorkOrderTrigger(){

//First, prepare 200 work orders for the test data
Account a = new Account(Name='test account');
insert a;
Projects__c p = new Projects__c(Account__c=a.Id,Project_Name__c='test project');
insert p;

Work_Order__c[] wo = new Work_Order__c[]{
new Work_Order__c(Project__c=p.Id,Work_Order_Description__c='test description',Ready_for_Invoice__c=true)
};
insert wo;

//Now insert data causing a work order trigger to fire. 

Test.startTest();
update wo;
Test.stopTest();

 

Update:

 

I've change "update wo" to "delete wo" in the test, but the trigger's code still doesn't seem to be covered: http://i.imgur.com/GGsb2.png. 

My Lead object contains a custom field Sales_Development_Rep__c that should contain the name of one of the two people on our staff whose user role is Sales Development (as represented by a specific UserRoleID). Sometimes Leads are created by a Marketo flow, and sometimes they are created by the Sales Development staff.

I'm trying to create a trigger that will ensure that when a Lead is created by someone whose role is Sales Development *and* the Sales Development Rep field is blank, the record will autopopulate the Sales Development Rep field with the appropriate person's name (via their User.Id). I've tried several approaches, but I haven't been able to get the trigger to work. The latest version of my code is below. Can anyone help?

trigger FillBlankSDRField on Lead (before insert) { 

for (l : [Select l.Owner.UserRoleId, l.Owner.Username, l.OwnerId, l.Sales_Development_Rep__c, l.Id From Lead l) { if (l.Sales_Development_Rep__c != null) continue; if !(l.Owner.UserRoleId = '00E50000000kyI8') continue; l.Sales_Development_Rep__c = l.OwnerId; }
}

 

I've created a Visualforce page for my instance's Lead object, because I'd like to enable tabbed views of the different related lists on a given Lead record. One of the related lists that I'd like to carry over from the original view is "HTML Email Status." Unfortunately, I cannot find the API name. I've looked through all of the elements on the Lead object in my instance's WSDL where type=tns:QueryResult, but to no avail. Can anyone advise?

I'm writing a trigger that *should* update a blank custom field (named Setup_User_Fname__c) on the Opportunity object with values from a the Opportunity's Primary Contact when the Opportunity is closed.


I'm pretty sure that my SOQL query in the code below is not restrictive enough, as it returns the following error:

This code yields this result: System.QueryException: List has more than 1 row for assignment to SObject:
Trigger.FillBlankSetupUserFieldsonOpportunityClose: line 5, column 1

Unfortunately, I'm new to SOQL, and I'm not sure what I'm doing wrong. The full code is below.

trigger FillBlankSetupUserFieldsonOpportunityClose on Opportunity (before update) {

    for (Opportunity o : Trigger.new) {
        if (o.IsClosed) {
            Contact c =    [Select c.LastName, c.FirstName, c.Email,
            (Select Id, ContactId, Role, IsPrimary From OpportunityContactRoles Where IsPrimary = true and OpportunityId = :o.id) From Contact c];
                if (c != null && o.Setup_User_Fname__c == null) {
                    o.Setup_User_Fname__c = c.FirstName;
                }
        }
    }
}

 I'd be grateful for any advice on how to fix this error.

When I dowload the latest Force.com IDE for Mac OS, and I try to extract the .tgz file using Archive Utility, I get an error:

 

Unable to expand "force.com-ide-installer-macosx.tgz" into "Downloads". (Error 1 – Operation not permitted.)

 

Doing tar -zvzf force.com-ide-installer-macosx.tgz in the Terminal results in:

 

force.com-ide-installer-macosx/configuration/install-content.bin: (Empty error message)
tar: Error exit delayed from previous errors.

 

What's up with that?

I'm trying to create an Apex trigger that will prevent a record on the custom object Work Order from being deleted if a box in the object (Ready For Invoice) is checked. The trigger fires in my sandbox, but my unit tests seem to cover 0% of the trigger. I've walked through the relevant sections of the Force.com workbook on testing (Tutorials 7 and 8), but I'm having little luck. Can anyone advise?


The code is below:

 

//Trigger
trigger noDeleteReadyForInvoice on Work_Order__c (before delete)
  {
     for (Work_Order__c q: trigger.old)
      if (q.Ready_for_Invoice__c == true)
      {
       q.AddError('Cannot delete Work Order that is ready for invoice.');
       }
  }

//Test
@isTest
private class noDeleteReadyForInvoice {
static testMethod void testWorkOrderTrigger(){

//First, prepare 200 work orders for the test data
Account a = new Account(Name='test account');
insert a;
Projects__c p = new Projects__c(Account__c=a.Id,Project_Name__c='test project');
insert p;

Work_Order__c[] wo = new Work_Order__c[]{
new Work_Order__c(Project__c=p.Id,Work_Order_Description__c='test description',Ready_for_Invoice__c=true)
};
insert wo;

//Now insert data causing a work order trigger to fire. 

Test.startTest();
update wo;
Test.stopTest();

 

Update:

 

I've change "update wo" to "delete wo" in the test, but the trigger's code still doesn't seem to be covered: http://i.imgur.com/GGsb2.png.