• Jeff Bomar
  • NEWBIE
  • 110 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 23
    Replies
Hello everyone I have a problem with a field formula field named Space_Cost.

Formula

(Space_Count__c - 1) *  Additional_Space_Rate__c

the problem is if the field is Null or empty I get a negative number 
For example, if the space count is null or 0 or 1 I want the field to equal 0.00 if the field equals anything else do the formula above since the first space is free. 

any help would be much appreciated.
Hello Everyone hopefully I could get some much-needed help on this I created a Flow using the Flow builder and it works great in the Sandbox I created an outbound changeset and sent it to my production org and the flow does not work. I have tried recreating the Flow on the production side and it always plays though and gives me the successful screen but the record never gets created. 

The flow is invoked through an action on the Custom Screen it passes in the ID of the record I am on and grabs some data and creates a record really straight forward. any ideas on what i am doing w
Hello everyone. I created a flow today using the flow builder flowId=30129000000ULTsAAO and added the flow to the lightning page layout. My question is there a way to instead of adding the flow to the page layout could you add a button to the page layout instead to execute the flow see the image I am gathering two pieces of information
User-added image 
Would like some advice if someone could help me out. Not sure if this is where I should post this since not sure if Apex code needs to be written.  
I have a custom object call Custom programing. I would like a button that could be clicked within the object that would create a record that is a child of the billing object and copy over the information from the custom programming object. I am just wondering if this could be done. and where would I start or some documentation could read. 

Example: 
Custom Programing: Create a New Business drop ( this is an object that would contain the button) there is a related list under the account called Monthly billing which is products once you click on the product there is a related list that contains the monthly charges for that item. 

List View:
An account with a related list Custom  Programming and Monthly Billing and monthly billing with chield records for the items related to that product. 
 
Any help would be great. I created a trigger the before update works but if I add Before insert I get a NullPointerException: not sure where to go I have added the system.debug in every block of code but bot sure what I am looking at I am very new to Apex triggers.

Code:
trigger CalculateBalanceOfCustom on Custom_Programming__c (before insert, before update) 
{
   
    //SQL statement to lookup price 
    List<PricebookEntry> Pbe = [SELECT UnitPrice FROM PricebookEntry WHERE Product2.Name IN('Custom Development','Tape Drop')AND PriceBook2.Name='DAKCS'];
    
    //New Values for loop
    for (Custom_Programming__c cp:Trigger.new){
        
       //Old record values  
       Custom_Programming__c oldcp = Trigger.oldMap.get(cp.ID);
        
        //If total hours or custom type has not changed then bail    
       if(cp.Total_Hours__c==null || (cp.Total_Hours__c==oldcp.Total_Hours__c && cp.Custom_Type__c == oldcp.Custom_Type__c))
           continue;

        //Tapedrop
       if (cp.Custom_Type__c == 'Tape Drop') 
        {
            cp.Testing_Balance__c = pbe[1].UnitPrice + (pbe[0].UnitPrice * cp.Total_Hours__c);
        }
        //No Billing Bug Fix
       else if (cp.Custom_Type__c =='No Billing' || cp.Custom_Type__c =='Bug Fix')
        {
          cp.Testing_Balance__c = 0;
        }
        //Everything Else
       else 
        {
           cp.Testing_Balance__c =pbe[0].UnitPrice * cp.Total_Hours__c;
        }        
    }
}
 
Please help I created an Apex Trigger to update a field if the total testing hours change below is the error I get. 
CalculateBalanceOfCustom: execution of BeforeUpdate caused by: System.NullPointerException: Argument cannot be null.: Trigger.CalculateBalanceOfCustom: line 25, column 1".

Code:
trigger CalculateBalanceOfCustom on Custom_Programming__c (before insert, before update) 
{
    //SQL statement to lookup price 
 List<PricebookEntry> Pbe = [SELECT UnitPrice FROM PricebookEntry WHERE Product2.Name IN('Custom Development','Tape Drop')AND PriceBook2.Name='DAKCS'];
    //New Values for loop
    for (Custom_Programming__c cp:Trigger.new)
    {
        //Map old Values and ID
        Custom_Programming__c oldcp = Trigger.oldMap.get(cp.ID);
        
        //Tapedrop        
        if (cp.Custom_Type__c == 'Tape Drop' && cp.Total_Hours__c !=oldcp.Total_Hours__c)
        {
            cp.Testing_Balance__c = pbe[1].UnitPrice + (pbe[0].UnitPrice * cp.Total_Hours__c);
        }
        
        //No Billing Bug Fix
        if (cp.Custom_Type__c =='No Billing' || cp.Custom_Type__c =='Bug Fix'&& cp.Total_Hours__c !=oldcp.Total_Hours__c)
        {
            cp.Testing_Balance__c = pbe[0].UnitPrice * 0;
        }
        //Everything Else
        if (cp.Custom_Type__c !='No Billing' || cp.Custom_Type__c !='Bug Fix' || cp.Custom_Type__c!='Tape Drop' && cp.Total_Hours__c !=oldcp.Total_Hours__c)
        {
            cp.Testing_Balance__c =pbe[0].UnitPrice * cp.Total_Hours__c;
        }
    }
}

Thanks for any assistance you can give. 
I was wondering if someone could help me answer a question. Should my apex trigger be before update or after update. unfortunately, I have to write an apex trigger for this and can't use process builder because I have to grab the unit price from the price book and perform a formula to charge the customer correctly. If I want to perform the update only when the field Total hours and Type are updated. and I don't want the trigger to change anything when any other field is updated. would that trigger be a Before or After. thanks for your help.
Any help would be much appreciated I feel like I am spinning my wheels here. 

I have a custom object called Custom_Programming__c I have three fields on that object called Total_Hours__c and Custom_Type__c and Custom_Balance. 

when a user updates or creates a Custom_Programming__c record and there is a value in Total_Hours__c I need a trigger.

what the trigger needs to do is query the DAKCS price book and get two unit prices one for 'Tape Drop' and one for 'Custom Development' I am using this query to grab the information 

SELECT UnitPrice FROM PricebookEntry WHERE Product2.Name IN('Custom Development','Tape Drop')AND PriceBook2.Name='DAKCS'

The trigger will only fire if hours get entered or changed in Custom_Programming__c.Total_Hours__c

The trigger looks at Custom_Programming__c.Custom_Type__c and calculates Custom_Programming__c.Custom_Balance.

if Custom_Programming__c.Custom_Type__c = 'Bug Fix' or 'No Billing' then Custom_Programming__c.Custom_Balance is always 0.00

If Custom_Programming__c.Custom_Type__c  = 'Tape Drop' then Custom_Programming__c.Custom_Balance would be the UnitPrice of 'Tape Drop' + UnitPrice of  ('Custom Development' * Custom_Programming__c.Total_Hours__c)
 
and everything else would be 'Custom Development' * Custom_Programming__c.Total_Hours__c

**Note** 
values of the pricebook entries
'Tape Drop' = 750.00
'Custom Development'  = 185.00 

I have tried many different ways after watching many different videos so any help would be greatly appreciated. 


 
What is needed: 
custom object: Custom_Programming__c
fields to validate: Custom_Programming__c.Custom_Type__c and  Custom_Programming__c.Total_Hours__c

Any time the record is inserted or changed:
Custom_Type__c field changes and Total_Hours__c is greater than 0 or the Total_Hours__c is changed and meets the criteria it will get the price from the price book and update custom.Testing_Balance__c

I get is this message when testing:
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger UpdateBalanceTapeDrop caused an unexpected exception, contact your administrator: UpdateBalanceTapeDrop: execution of BeforeUpdate caused by: System.NullPointerException: Argument cannot be null.: Trigger.UpdateBalanceTapeDrop: line 29, column 1".

Code: 

trigger UpdateBalanceTapeDrop on Custom_Programming__c (before insert, before update) 
{
 for (Custom_Programming__c custom : Trigger.new) 
    {
        //SQL statement to lookup price 
        List<PricebookEntry> sqlResult = [SELECT UnitPrice FROM PricebookEntry WHERE Product2.Name IN('Custom Development','Tape Drop')AND PriceBook2.Name='DAKCS'];
          
        //Conditions FOR Tapedrop
        if (custom.Custom_Type__c == 'Tape Drop' && custom.Total_Hours__c >0)

       //Calculate Balance for Tapedrop  
        {
            custom.Testing_Balance__c = sqlResult[1].UnitPrice + (sqlResult[0].UnitPrice * custom.Total_Hours__c);
           }
        
        //Conditions for No Billing or Bug Fix
        if (custom.Custom_Type__c =='No Billing' || custom.Custom_Type__c =='Bug Fix' && custom.Total_Hours__c >0)
            
       //Calculate Balance for No Billing or Bug Fix 
        {
            custom.Testing_Balance__c = sqlResult[0].UnitPrice * 0;
        }
        
        //Conditions for everything else
       if (custom.Custom_Type__c != 'No Billing' || custom.Custom_Type__c !='Bug Fix' || custom.Custom_Type__c != 'Tape Drop' && custom.Total_Hours__c >0)
           
       //Calculate Balance for everything else
        {
            custom.Testing_Balance__c =sqlResult[0].UnitPrice * custom.Total_Hours__c;
        }
    }
}

Sorry if confusing I am new to Apex triggers and any help would be much appreciated. 

 
Can someone tell me what I am doing wrong?
I want to create a trigger that when the Custom type = Tape Drop  and Total hours are updated so does not = Null or > 0 the trigger will get the cost of the Custom Development from the price book (189.00) and the cost of the Tape Drop from the price book (750.00)  and put the
(Tape Drop (750) + Total Hours * Custom Development) in Testing_Balance__c here is what I have so far.
 
trigger UpdateBalanceTapeDrop on Custom_Programming__c (before insert, before update) {
 for (Custom_Programming__c custom : Trigger.new) 
    {

    //SQL statement to lookup price 
    List<PricebookEntry> sqlResult = [SELECT UnitPrice FROM PricebookEntry WHERE Product2.Name = 'Custom Development'AND PriceBook2.Name='DAKCS'];
    List<PricebookEntry> sqlResult2 = [SELECT UnitPrice FROM PricebookEntry WHERE Product2.Name = 'Tape Drop'AND PriceBook2.Name='DAKCS'];
        if (custom.Custom_Type__c == 'Tape Drop' && custom.Total_Hours__c != null)                
        {
            custom.Testing_Balance__c = sqlResult2[0].UnitPrice + (Total_Hours__c*sqlResult[0].UnitPrice);
        }
    }        
}

Any help would be much appreciated. 
 
Any Help would be much apricated I created an Apex Trigger and am having trouble writing the test class for code coverage really green when it comes to this 

Triger 
trigger updateCustomDev on Custom_Programming__c (before Insert) {
  for (Custom_Programming__c Custom : trigger.new) {

    //SQL statement to lookup price 
    List<PricebookEntry> sqlResult = [SELECT UnitPrice 
        FROM PricebookEntry 
        WHERE Product2.Name = 'Custom Development'
                               AND PriceBook2.Name='DAKCS'];

    //save the returned SQL result inside the field 
    Custom.Hourly_Cost__c = sqlResult[0].UnitPrice;
  }    
}

Test Class
@IsTest
public class TestupdateCustomDev {
    @IsTest static void testHourlyCost(){
        //Create Custom
        Custom_Programming__c c = new Custom_Programming__c(Name='Test',Custom_State__c='Active',Custom_Type__c='Custom',Status__c='New');
        
        Test.startTest();
        Database.SaveResult result = Database.insert (c, true);
         System.assert(result.isSuccess());
        Test.stopTest();
    }
}

I was hoping this would be really simple all I want the trigger to do is update a field with an entry from pice book entry.

Thanks again
Trying to create an Apex trigger to query the price-book entries and place the result in a custom field can someone please tell me what i am doing wrong 
get two problems Expression must be a list type: pricebookEntry 
and a value cannot be stored to Hourly_Cost__c in type Custom_Programming__C


trigger updateCustomDev on Custom_Programming__c (after update) {
  

    //SQL statement to lookup price 
    PricebookEntry sqlResult = [SELECT UnitPrice 
        FROM PricebookEntry 
        WHERE Product2.Name = 'Custom Development'
                               AND PriceBook2.Name='DAKCS'];

    //save the returned SQL result inside the field 
    Custom_Programming__c.Hourly_Cost__c = sqlResult[0].UnitPrice;
      
}
public class SlackOpportunityPublisher {
    private static final String slackURL = 'https://hooks.slack.com/services/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';
    
    public class Id {
        @InvocableVariable(label='Opportunity Name')
        public String opptyName;
        @InvocableVariable(label='Type')
        public String Type;
        @InvocableVariable(label='Stage')
        public String stage;
        @InvocableVariable(label='Probability')
        public String probability;
        @InvocableVariable(label='First')
        public string first;
        @InvocableVariable(label='Last')
        public string last;
        @InvocableVariable(label='Close')
        public string close;                 
    }
    @InvocableMethod(label='Post to Slack')
    public static void postToSlack(List<Id> opportunityId) {
        Id oppId = opportunityId[0]; // If bulk, only post first to avoid overloading Slack channel
        Opportunity opportunity = [SELECT Name, Type, StageName, Probability, Owner.FirstName, Owner.LastName, CloseDate from Opportunity WHERE id=:OPPid];
        Map<String,Object> msg = new Map<String,Object>();
        msg.put('text', 'The following opportunity has changed:\n' + 'Account Name And Product: ' + Opportunity.Name + '\nType: ' + opportunity.Type + '\nNew Stage: ' + opportunity.StageName + '\nSales Person: ' + opportunity.Owner.FirstName + ' ' + opportunity.Owner.LastName + '\nProbability: ' + opportunity.Probability + '%' + '\nForcasted Close Date: ' + opportunity.CloseDate);
        msg.put('mrkdwn', true);
        String body = JSON.serialize(msg);    
        System.enqueueJob(new QueueableSlackCall(slackURL, 'POST', body));
    }
         
    public class QueueableSlackCall implements System.Queueable, Database.AllowsCallouts {
             
        private final String url;
        private final String method;
        private final String body;
             
        public QueueableSlackCall(String url, String method, String body) {
            this.url = url;
            this.method = method;
            this.body = body;
        }
             
        public void execute(System.QueueableContext ctx) {
            HttpRequest req = new HttpRequest();
            req.setEndpoint(url);
            req.setMethod(method);
            req.setBody(body);
            Http http = new Http();
            if (!Test.isRunningTest()) { // HTTP callout is not allowed in tests apparently...
            HttpResponse res = http.send(req);
        }
    }
    }
}
@isTest
private class SlackOpportunityPublisherTest{
    static testMethod void testPostToSlack() {
        SlackOpportunityPublisher.Id pubTest = new SlackOpportunityPublisher.Id();
        pubTest.opptyName = 'Test opportunity';
        pubTest.type = 'Test Type';
        pubTest.stage = 'Test stage';
        pubtest.probability = 'Test probability';
        pubTest.first = 'Test First';
        pubTest.last = 'Test Last';
        pubTest.close = 'Test Close';
        List<SlackOpportunityPublisher.Id> theList = new List<SlackOpportunityPublisher.Id>();
        theList.add(pubTest);
        SlackOpportunityPublisher.postToSlack(theList);
        System.assertEquals(theList, theList); // Can't really test this, just put something that is true
    }
}
Any help is appriciated this is the problem Method does not exist or incorrect signature: void postToSlack(List<SlackOpportunityPublisher.Id>) from the type SlackOpportunityPublisher
Hello everyone I have a problem with a field formula field named Space_Cost.

Formula

(Space_Count__c - 1) *  Additional_Space_Rate__c

the problem is if the field is Null or empty I get a negative number 
For example, if the space count is null or 0 or 1 I want the field to equal 0.00 if the field equals anything else do the formula above since the first space is free. 

any help would be much appreciated.
Hello Everyone hopefully I could get some much-needed help on this I created a Flow using the Flow builder and it works great in the Sandbox I created an outbound changeset and sent it to my production org and the flow does not work. I have tried recreating the Flow on the production side and it always plays though and gives me the successful screen but the record never gets created. 

The flow is invoked through an action on the Custom Screen it passes in the ID of the record I am on and grabs some data and creates a record really straight forward. any ideas on what i am doing w
Hello everyone. I created a flow today using the flow builder flowId=30129000000ULTsAAO and added the flow to the lightning page layout. My question is there a way to instead of adding the flow to the page layout could you add a button to the page layout instead to execute the flow see the image I am gathering two pieces of information
User-added image 
Any help would be great. I created a trigger the before update works but if I add Before insert I get a NullPointerException: not sure where to go I have added the system.debug in every block of code but bot sure what I am looking at I am very new to Apex triggers.

Code:
trigger CalculateBalanceOfCustom on Custom_Programming__c (before insert, before update) 
{
   
    //SQL statement to lookup price 
    List<PricebookEntry> Pbe = [SELECT UnitPrice FROM PricebookEntry WHERE Product2.Name IN('Custom Development','Tape Drop')AND PriceBook2.Name='DAKCS'];
    
    //New Values for loop
    for (Custom_Programming__c cp:Trigger.new){
        
       //Old record values  
       Custom_Programming__c oldcp = Trigger.oldMap.get(cp.ID);
        
        //If total hours or custom type has not changed then bail    
       if(cp.Total_Hours__c==null || (cp.Total_Hours__c==oldcp.Total_Hours__c && cp.Custom_Type__c == oldcp.Custom_Type__c))
           continue;

        //Tapedrop
       if (cp.Custom_Type__c == 'Tape Drop') 
        {
            cp.Testing_Balance__c = pbe[1].UnitPrice + (pbe[0].UnitPrice * cp.Total_Hours__c);
        }
        //No Billing Bug Fix
       else if (cp.Custom_Type__c =='No Billing' || cp.Custom_Type__c =='Bug Fix')
        {
          cp.Testing_Balance__c = 0;
        }
        //Everything Else
       else 
        {
           cp.Testing_Balance__c =pbe[0].UnitPrice * cp.Total_Hours__c;
        }        
    }
}
 
Please help I created an Apex Trigger to update a field if the total testing hours change below is the error I get. 
CalculateBalanceOfCustom: execution of BeforeUpdate caused by: System.NullPointerException: Argument cannot be null.: Trigger.CalculateBalanceOfCustom: line 25, column 1".

Code:
trigger CalculateBalanceOfCustom on Custom_Programming__c (before insert, before update) 
{
    //SQL statement to lookup price 
 List<PricebookEntry> Pbe = [SELECT UnitPrice FROM PricebookEntry WHERE Product2.Name IN('Custom Development','Tape Drop')AND PriceBook2.Name='DAKCS'];
    //New Values for loop
    for (Custom_Programming__c cp:Trigger.new)
    {
        //Map old Values and ID
        Custom_Programming__c oldcp = Trigger.oldMap.get(cp.ID);
        
        //Tapedrop        
        if (cp.Custom_Type__c == 'Tape Drop' && cp.Total_Hours__c !=oldcp.Total_Hours__c)
        {
            cp.Testing_Balance__c = pbe[1].UnitPrice + (pbe[0].UnitPrice * cp.Total_Hours__c);
        }
        
        //No Billing Bug Fix
        if (cp.Custom_Type__c =='No Billing' || cp.Custom_Type__c =='Bug Fix'&& cp.Total_Hours__c !=oldcp.Total_Hours__c)
        {
            cp.Testing_Balance__c = pbe[0].UnitPrice * 0;
        }
        //Everything Else
        if (cp.Custom_Type__c !='No Billing' || cp.Custom_Type__c !='Bug Fix' || cp.Custom_Type__c!='Tape Drop' && cp.Total_Hours__c !=oldcp.Total_Hours__c)
        {
            cp.Testing_Balance__c =pbe[0].UnitPrice * cp.Total_Hours__c;
        }
    }
}

Thanks for any assistance you can give. 
I was wondering if someone could help me answer a question. Should my apex trigger be before update or after update. unfortunately, I have to write an apex trigger for this and can't use process builder because I have to grab the unit price from the price book and perform a formula to charge the customer correctly. If I want to perform the update only when the field Total hours and Type are updated. and I don't want the trigger to change anything when any other field is updated. would that trigger be a Before or After. thanks for your help.
What is needed: 
custom object: Custom_Programming__c
fields to validate: Custom_Programming__c.Custom_Type__c and  Custom_Programming__c.Total_Hours__c

Any time the record is inserted or changed:
Custom_Type__c field changes and Total_Hours__c is greater than 0 or the Total_Hours__c is changed and meets the criteria it will get the price from the price book and update custom.Testing_Balance__c

I get is this message when testing:
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger UpdateBalanceTapeDrop caused an unexpected exception, contact your administrator: UpdateBalanceTapeDrop: execution of BeforeUpdate caused by: System.NullPointerException: Argument cannot be null.: Trigger.UpdateBalanceTapeDrop: line 29, column 1".

Code: 

trigger UpdateBalanceTapeDrop on Custom_Programming__c (before insert, before update) 
{
 for (Custom_Programming__c custom : Trigger.new) 
    {
        //SQL statement to lookup price 
        List<PricebookEntry> sqlResult = [SELECT UnitPrice FROM PricebookEntry WHERE Product2.Name IN('Custom Development','Tape Drop')AND PriceBook2.Name='DAKCS'];
          
        //Conditions FOR Tapedrop
        if (custom.Custom_Type__c == 'Tape Drop' && custom.Total_Hours__c >0)

       //Calculate Balance for Tapedrop  
        {
            custom.Testing_Balance__c = sqlResult[1].UnitPrice + (sqlResult[0].UnitPrice * custom.Total_Hours__c);
           }
        
        //Conditions for No Billing or Bug Fix
        if (custom.Custom_Type__c =='No Billing' || custom.Custom_Type__c =='Bug Fix' && custom.Total_Hours__c >0)
            
       //Calculate Balance for No Billing or Bug Fix 
        {
            custom.Testing_Balance__c = sqlResult[0].UnitPrice * 0;
        }
        
        //Conditions for everything else
       if (custom.Custom_Type__c != 'No Billing' || custom.Custom_Type__c !='Bug Fix' || custom.Custom_Type__c != 'Tape Drop' && custom.Total_Hours__c >0)
           
       //Calculate Balance for everything else
        {
            custom.Testing_Balance__c =sqlResult[0].UnitPrice * custom.Total_Hours__c;
        }
    }
}

Sorry if confusing I am new to Apex triggers and any help would be much appreciated. 

 
Can someone tell me what I am doing wrong?
I want to create a trigger that when the Custom type = Tape Drop  and Total hours are updated so does not = Null or > 0 the trigger will get the cost of the Custom Development from the price book (189.00) and the cost of the Tape Drop from the price book (750.00)  and put the
(Tape Drop (750) + Total Hours * Custom Development) in Testing_Balance__c here is what I have so far.
 
trigger UpdateBalanceTapeDrop on Custom_Programming__c (before insert, before update) {
 for (Custom_Programming__c custom : Trigger.new) 
    {

    //SQL statement to lookup price 
    List<PricebookEntry> sqlResult = [SELECT UnitPrice FROM PricebookEntry WHERE Product2.Name = 'Custom Development'AND PriceBook2.Name='DAKCS'];
    List<PricebookEntry> sqlResult2 = [SELECT UnitPrice FROM PricebookEntry WHERE Product2.Name = 'Tape Drop'AND PriceBook2.Name='DAKCS'];
        if (custom.Custom_Type__c == 'Tape Drop' && custom.Total_Hours__c != null)                
        {
            custom.Testing_Balance__c = sqlResult2[0].UnitPrice + (Total_Hours__c*sqlResult[0].UnitPrice);
        }
    }        
}

Any help would be much appreciated. 
 
Any Help would be much apricated I created an Apex Trigger and am having trouble writing the test class for code coverage really green when it comes to this 

Triger 
trigger updateCustomDev on Custom_Programming__c (before Insert) {
  for (Custom_Programming__c Custom : trigger.new) {

    //SQL statement to lookup price 
    List<PricebookEntry> sqlResult = [SELECT UnitPrice 
        FROM PricebookEntry 
        WHERE Product2.Name = 'Custom Development'
                               AND PriceBook2.Name='DAKCS'];

    //save the returned SQL result inside the field 
    Custom.Hourly_Cost__c = sqlResult[0].UnitPrice;
  }    
}

Test Class
@IsTest
public class TestupdateCustomDev {
    @IsTest static void testHourlyCost(){
        //Create Custom
        Custom_Programming__c c = new Custom_Programming__c(Name='Test',Custom_State__c='Active',Custom_Type__c='Custom',Status__c='New');
        
        Test.startTest();
        Database.SaveResult result = Database.insert (c, true);
         System.assert(result.isSuccess());
        Test.stopTest();
    }
}

I was hoping this would be really simple all I want the trigger to do is update a field with an entry from pice book entry.

Thanks again
Trying to create an Apex trigger to query the price-book entries and place the result in a custom field can someone please tell me what i am doing wrong 
get two problems Expression must be a list type: pricebookEntry 
and a value cannot be stored to Hourly_Cost__c in type Custom_Programming__C


trigger updateCustomDev on Custom_Programming__c (after update) {
  

    //SQL statement to lookup price 
    PricebookEntry sqlResult = [SELECT UnitPrice 
        FROM PricebookEntry 
        WHERE Product2.Name = 'Custom Development'
                               AND PriceBook2.Name='DAKCS'];

    //save the returned SQL result inside the field 
    Custom_Programming__c.Hourly_Cost__c = sqlResult[0].UnitPrice;
      
}
public class SlackOpportunityPublisher {
    private static final String slackURL = 'https://hooks.slack.com/services/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';
    
    public class Id {
        @InvocableVariable(label='Opportunity Name')
        public String opptyName;
        @InvocableVariable(label='Type')
        public String Type;
        @InvocableVariable(label='Stage')
        public String stage;
        @InvocableVariable(label='Probability')
        public String probability;
        @InvocableVariable(label='First')
        public string first;
        @InvocableVariable(label='Last')
        public string last;
        @InvocableVariable(label='Close')
        public string close;                 
    }
    @InvocableMethod(label='Post to Slack')
    public static void postToSlack(List<Id> opportunityId) {
        Id oppId = opportunityId[0]; // If bulk, only post first to avoid overloading Slack channel
        Opportunity opportunity = [SELECT Name, Type, StageName, Probability, Owner.FirstName, Owner.LastName, CloseDate from Opportunity WHERE id=:OPPid];
        Map<String,Object> msg = new Map<String,Object>();
        msg.put('text', 'The following opportunity has changed:\n' + 'Account Name And Product: ' + Opportunity.Name + '\nType: ' + opportunity.Type + '\nNew Stage: ' + opportunity.StageName + '\nSales Person: ' + opportunity.Owner.FirstName + ' ' + opportunity.Owner.LastName + '\nProbability: ' + opportunity.Probability + '%' + '\nForcasted Close Date: ' + opportunity.CloseDate);
        msg.put('mrkdwn', true);
        String body = JSON.serialize(msg);    
        System.enqueueJob(new QueueableSlackCall(slackURL, 'POST', body));
    }
         
    public class QueueableSlackCall implements System.Queueable, Database.AllowsCallouts {
             
        private final String url;
        private final String method;
        private final String body;
             
        public QueueableSlackCall(String url, String method, String body) {
            this.url = url;
            this.method = method;
            this.body = body;
        }
             
        public void execute(System.QueueableContext ctx) {
            HttpRequest req = new HttpRequest();
            req.setEndpoint(url);
            req.setMethod(method);
            req.setBody(body);
            Http http = new Http();
            if (!Test.isRunningTest()) { // HTTP callout is not allowed in tests apparently...
            HttpResponse res = http.send(req);
        }
    }
    }
}
@isTest
private class SlackOpportunityPublisherTest{
    static testMethod void testPostToSlack() {
        SlackOpportunityPublisher.Id pubTest = new SlackOpportunityPublisher.Id();
        pubTest.opptyName = 'Test opportunity';
        pubTest.type = 'Test Type';
        pubTest.stage = 'Test stage';
        pubtest.probability = 'Test probability';
        pubTest.first = 'Test First';
        pubTest.last = 'Test Last';
        pubTest.close = 'Test Close';
        List<SlackOpportunityPublisher.Id> theList = new List<SlackOpportunityPublisher.Id>();
        theList.add(pubTest);
        SlackOpportunityPublisher.postToSlack(theList);
        System.assertEquals(theList, theList); // Can't really test this, just put something that is true
    }
}
Any help is appriciated this is the problem Method does not exist or incorrect signature: void postToSlack(List<SlackOpportunityPublisher.Id>) from the type SlackOpportunityPublisher