• charchit nirayanwal
  • NEWBIE
  • 30 Points
  • Member since 2021

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 3
    Questions
  • 4
    Replies
The clear answer is No.
Reason Behind ?
There are some objects like OpportunityLineItem (opportunity product) on which we cant make quick actions.
This is limited by salesforce tell me more about these objects
For this we need to use trigger :

  trigger checkalready on "order object" (before insert) {
    order object a=trigger.new[0];
    integer d=[select count() from "order object" where "Customer field"  = :a."customer field" and "coupon field"=:a."coupon field"];
    if(d>0){
         a.addError('Coupons already used');
    }   
}

If anyone have any other answer without using trigger then must post
This Trailhead issue seems to have frustrated half a generation of Salesforcers. This should be pretty straightforward but the syntax checker does not allow "MailingPostalCode" for the good reason that it is nowhere to be found in the insertable fields. I can insert a billing postal code to get passed the syntax checked, but then I fail the challenge. Is the issue with the instructions, or is my Account object actually missing a MailingPostalCode ?
User-added image

public Class PenClassDemonstration {
        public static void ApplyDiscountPen(list<Pen__c> VarPenListNew) {
            for(Pen__c VarP : VarPenListNew){
           if(VarP.Price__c >= 100){
               VarP.Price__c = VarP.Price__c-20;
               }
              }
             }
             }
For this we need to use trigger :

  trigger checkalready on "order object" (before insert) {
    order object a=trigger.new[0];
    integer d=[select count() from "order object" where "Customer field"  = :a."customer field" and "coupon field"=:a."coupon field"];
    if(d>0){
         a.addError('Coupons already used');
    }   
}

If anyone have any other answer without using trigger then must post