function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kevin.chileskevin.chiles 

Issues with bringing quote line items over to custom object as lines

I am trying to bring over quote lines to my custom object as SPA linesbut I am having some issues.  Currently the trigger is telling me I am using the wrong Object and that I should be using Quote, but I am entering these items as Line items under my SPA from quote.  Am I going crazy?

 

here is my code

 

trigger test1 on SPA__c (after insert)
{

SPA__c to=trigger.new[0];

Quote q=[select id from Quote where id=:to.Volume_Price_Quote__c];

list<QuoteLineItem> ql=[select id,ListPrice,PriceBookEntry.Product2Id ,Subtotal,TotalPrice from QuoteLineItem where QuoteId=:q.id];

 

for(QuoteLineItem qli:ql)

{

SPA_Discount__c sd=new SPA_Discount__c();

 

sd.Net_Price__c=qli.ListPrice;
sd.SPA_Discount_for__c=qli.Product_Name__c;
sd.Public_Notes__c=qli.Public_Notes__c;
sd.Private_Notes__c=qli.Private_Notes__c;
sd.Sales_Commision_Split__c=qli.Sales_Commission_Split__c;
sd.Option_For_Split_Choice__c=qli.Option_For_Split_Choice__c;
sd.Spiff__c=qli.Spiff__c;


insert sd;
}
}

kevin.chileskevin.chiles

Just to make this fun, I also only need this to fire when the SPA__c object has a field populated, this is the syntax i have but it will not take

 

if(SPA__c.Volume_Price_Quote__c<>NULL()

 

I have tried to add this in several places but it will not work.  Please help!

VaasuVaasu
use
if(SPA__c.Volume_Price_Quote__c != NUL)
VaasuVaasu
if(SPA__c.Volume_Price_Quote__c != NULL)