Skip to main content

Please help me with this code, Writing a Trigger to display an error message on Opportunity_Support_Request__c record which has no OSR Product and if it is submitted for Approval(by clicking on Submit for Approval button) it will display the error message(You must add at least one osr Product to your Request).

Opportunity_Support_Request__c is Master object OSR_Product__c is Detail obj OSR_ID__c is the master detail field created on detail object. And the Trigger that I have written is :

trigger OSRapprovalTrigger on Opportunity_Support_Request__c (before insert,before update)
{        
    if(trigger.isUpdate && trigger.isBefore)
    {        
        for(Opportunity_Support_Request__c s : Trigger.new){                        
            if(s.Status__c == 'Not Submitted')
            {
                //Get list of osr products
                List <OSR_Product__c> SampleProductList = [Select CAT_logic_Description__c,Material_Description__c from OSR_Product__c where OSR_ID__c =: s.id ];//
                if(SampleProductList.size() == 0)
                {
                    if(!Test.isRunningTest()){
                        s.addError('You must add at least one osr Product to your Request');
                    }
                }
            }
        }
    }
}

                                                                                            

{
if(trigger.isUpdate && trigger.isBefore) {
for(Opportunity_Support_Request__c s : Trigger.new){
if(s.Status__c == 'Not Submitted') { //Get list of osr products List <OSR_Product__c> SampleProductList = [Select CAT_logic_Description__c,Material_Description__c from OSR_Product__c where OSR_ID__c =: s.id ];// if(SampleProductList.size() == 0) { if(!Test.isRunningTest()){ s.addError('You must add at least one osr Product to your Request'); } } } } } }

Please Help. Thanks in advance !

Please help me with this code, Writing a Trigger to display an error message on Opportunity_Support_Request__c record which has no OSR Product and if it is submitted for Approval(by clicking on Submit for Approval button) it will display the error message(You must add at least one osr Product to your Request).

Opportunity_Support_Request__c is Master object OSR_Product__c is Detail obj OSR_ID__c is the master detail field created on detail object. And the Trigger that I have written is :

trigger OSRapprovalTrigger on Opportunity_Support_Request__c (before insert,before update)

{
if(trigger.isUpdate && trigger.isBefore) {
for(Opportunity_Support_Request__c s : Trigger.new){
if(s.Status__c == 'Not Submitted') { //Get list of osr products List <OSR_Product__c> SampleProductList = [Select CAT_logic_Description__c,Material_Description__c from OSR_Product__c where OSR_ID__c =: s.id ];// if(SampleProductList.size() == 0) { if(!Test.isRunningTest()){ s.addError('You must add at least one osr Product to your Request'); } } } } } }

Please Help. Thanks in advance !

Please help me with this code, Writing a Trigger to display an error message on Opportunity_Support_Request__c record which has no OSR Product and if it is submitted for Approval(by clicking on Submit for Approval button) it will display the error message(You must add at least one osr Product to your Request).

Opportunity_Support_Request__c is Master object OSR_Product__c is Detail obj OSR_ID__c is the master detail field created on detail object. And the Trigger that I have written is :

trigger OSRapprovalTrigger on Opportunity_Support_Request__c (before insert,before update)
{        
    if(trigger.isUpdate && trigger.isBefore)
    {        
        for(Opportunity_Support_Request__c s : Trigger.new){                        
            if(s.Status__c == 'Not Submitted')
            {
                //Get list of osr products
                List <OSR_Product__c> SampleProductList = [Select CAT_logic_Description__c,Material_Description__c from OSR_Product__c where OSR_ID__c =: s.id ];//
                if(SampleProductList.size() == 0)
                {
                    if(!Test.isRunningTest()){
                        s.addError('You must add at least one osr Product to your Request');
                    }
                }
            }
        }
    }
}

                                                                                            

Please Help. Thanks in advance !

deleted 26 characters in body
Source Link
Deep
  • 9
  • 1
  • 3
  • 11

Please help me with this code, Writing a Trigger to display an error message on Opportunity_Support_Request__c record which has no OSR Product and if it is submitted for Approval(by clicking on Submit for Approval button) it will display the error message(You must add at least one osr Product to your Request).

Opportunity_Support_Request__c is Master object OSR_Product__c is Detail obj OSR_ID__c is the master detail field created on detail object. And the Trigger that I have written is :

trigger OSRapprovalTrigger on Opportunity_Support_Request__c (before insert,before update) {        
    if(trigger.isUpdate && trigger.isBefore)
    {        
        for(Opportunity_Support_Request__c s : Trigger.new){                        
            if(s.Status__c == 'Not Submitted')
            {
                //Get list of osr products
                List <OSR_Product__c> SampleProductList = [Select Quantity__c from OSR_Product__c where OSR_ID__c =: s.id];
                if(SampleProductList.size() == 0)
                {
                    if(!Test.isRunningTest()){
                        s.addError('You must add at least one osr Product to your Request');
                    }
                }
            }
        }
    }
}

                                                                                            

{
if(trigger.isUpdate && trigger.isBefore) {
for(Opportunity_Support_Request__c s : Trigger.new){
if(s.Status__c == 'Not Submitted') { //Get list of osr products List <OSR_Product__c> SampleProductList = [Select CAT_logic_Description__c,Material_Description__c from OSR_Product__c where OSR_ID__c =: s.id ];// if(SampleProductList.size() == 0) { if(!Test.isRunningTest()){ s.addError('You must add at least one osr Product to your Request'); } } } } } }

Please Help. Thanks in advance !

Please help me with this code, Writing a Trigger to display an error message on Opportunity_Support_Request__c record which has no OSR Product and if it is submitted for Approval(by clicking on Submit for Approval button) it will display the error message(You must add at least one osr Product to your Request).

Opportunity_Support_Request__c is Master object OSR_Product__c is Detail obj OSR_ID__c is the master detail field created on detail object. And the Trigger that I have written is :

trigger OSRapprovalTrigger on Opportunity_Support_Request__c (before insert,before update) {        
    if(trigger.isUpdate && trigger.isBefore)
    {        
        for(Opportunity_Support_Request__c s : Trigger.new){                        
            if(s.Status__c == 'Not Submitted')
            {
                //Get list of osr products
                List <OSR_Product__c> SampleProductList = [Select Quantity__c from OSR_Product__c where OSR_ID__c =: s.id];
                if(SampleProductList.size() == 0)
                {
                    if(!Test.isRunningTest()){
                        s.addError('You must add at least one osr Product to your Request');
                    }
                }
            }
        }
    }
}

                                                                                            

Please Help. Thanks in advance !

Please help me with this code, Writing a Trigger to display an error message on Opportunity_Support_Request__c record which has no OSR Product and if it is submitted for Approval(by clicking on Submit for Approval button) it will display the error message(You must add at least one osr Product to your Request).

Opportunity_Support_Request__c is Master object OSR_Product__c is Detail obj OSR_ID__c is the master detail field created on detail object. And the Trigger that I have written is :

trigger OSRapprovalTrigger on Opportunity_Support_Request__c (before insert,before update)

{
if(trigger.isUpdate && trigger.isBefore) {
for(Opportunity_Support_Request__c s : Trigger.new){
if(s.Status__c == 'Not Submitted') { //Get list of osr products List <OSR_Product__c> SampleProductList = [Select CAT_logic_Description__c,Material_Description__c from OSR_Product__c where OSR_ID__c =: s.id ];// if(SampleProductList.size() == 0) { if(!Test.isRunningTest()){ s.addError('You must add at least one osr Product to your Request'); } } } } } }

Please Help. Thanks in advance !

Please help me with this code, Writing a Trigger to display an error message on Opportunity_Support_Request__c record which has no OSR Product and if it is submitted for Approval(by clicking on Submit for Approval button) it will display the error message(You must add at least one osr Product to your Request).

Opportunity_Support_Request__c is Master object OSR_Product__c is Detail obj OSR_ID__c is the master detail field created on detail object. And the Trigger that I have written is :

trigger OSRapprovalTrigger on Opportunity_Support_Request__c (before insert,before update) {        
    if(trigger.isUpdate && trigger.isBefore)
    {         
        for(Opportunity_Support_Request__c s : Trigger.new){                         
            if(s.Status__c == 'Not Submitted')
            {
          trigger OSRapprovalTrigger on Opportunity_Support_Request__c   //Get list of osr products
                List <OSR_Product__c> SampleProductList = [Select Quantity__c from OSR_Product__c where OSR_ID__c =: s.id];
                if(beforeSampleProductList.size() insert,before== update0)
                {
                    if(!Test.isRunningTest()){
                        s.addError('You must add at least one osr Product to your Request');
                    }
                }
            }
        }
    }
}

                                                                                            

{
if(trigger.isUpdate && trigger.isBefore) {
for(Opportunity_Support_Request__c s : Trigger.new){
if(s.Status__c == 'Not Submitted') { //Get list of osr products List <OSR_Product__c> SampleProductList = [Select Quantity__c from OSR_Product__c where OSR_ID__c =: s.id]; if(SampleProductList.size() == 0) { if(!Test.isRunningTest()){ s.addError('You must add at least one osr Product to your Request'); } } } } } }

Please Help. Thanks in advance !

Please help me with this code, Writing a Trigger to display an error message on Opportunity_Support_Request__c record which has no OSR Product and if it is submitted for Approval(by clicking on Submit for Approval button) it will display the error message(You must add at least one osr Product to your Request).

Opportunity_Support_Request__c is Master object OSR_Product__c is Detail obj OSR_ID__c is the master detail field created on detail object. And the Trigger that I have written is :

                                                                                          trigger OSRapprovalTrigger on Opportunity_Support_Request__c (before insert,before update)

{
if(trigger.isUpdate && trigger.isBefore) {
for(Opportunity_Support_Request__c s : Trigger.new){
if(s.Status__c == 'Not Submitted') { //Get list of osr products List <OSR_Product__c> SampleProductList = [Select Quantity__c from OSR_Product__c where OSR_ID__c =: s.id]; if(SampleProductList.size() == 0) { if(!Test.isRunningTest()){ s.addError('You must add at least one osr Product to your Request'); } } } } } }

Please Help. Thanks in advance !

Please help me with this code, Writing a Trigger to display an error message on Opportunity_Support_Request__c record which has no OSR Product and if it is submitted for Approval(by clicking on Submit for Approval button) it will display the error message(You must add at least one osr Product to your Request).

Opportunity_Support_Request__c is Master object OSR_Product__c is Detail obj OSR_ID__c is the master detail field created on detail object. And the Trigger that I have written is :

trigger OSRapprovalTrigger on Opportunity_Support_Request__c (before insert,before update) {        
    if(trigger.isUpdate && trigger.isBefore)
    {         
        for(Opportunity_Support_Request__c s : Trigger.new){                         
            if(s.Status__c == 'Not Submitted')
            {
                //Get list of osr products
                List <OSR_Product__c> SampleProductList = [Select Quantity__c from OSR_Product__c where OSR_ID__c =: s.id];
                if(SampleProductList.size() == 0)
                {
                    if(!Test.isRunningTest()){
                        s.addError('You must add at least one osr Product to your Request');
                    }
                }
            }
        }
    }
}

                                                                                            

Please Help. Thanks in advance !

Source Link
Deep
  • 9
  • 1
  • 3
  • 11
Loading