• Gabriel Dias
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 2
    Replies
I have a trigger that checks if exists a duplicate record before insert a Lead and when it find a duplicate record I need to update two fields on this record with the date of the try to insert a duplicate record and a boolean that shows if you hear an attempt to register for the lead, but when I use AddError the other record is not saved in the database.

Does anyone have a workaround to this problem? Future methods also don't work.
I have a trigger that checks if exists a duplicate record before insert a Lead and when it find a duplicate record I need to update two fields on this record with the date of the try to insert a duplicate record and a boolean that shows if you hear an attempt to register for the lead, but when I use AddError the other record is not saved in the database.

Does anyone have a workaround to this problem? Future methods also don't work.

hi pat

i have a problem.

I have a sobject TestStoring__c with one custom field Body__c.In after insert trigger on FeedItem ,  when i insert a record in 

TestStoring__c sobject,it is not getting inserted.I am also attaching the code below.

 

Class:

 

public class TestTriggerClass {
    public static string flag;
    public static void addFeedError(list<FeedItem> fi) {
        if(fi[0].body.contains('blocked')) {
            flag='not';
            fi[0].adderror('Not Allowed');
            return;
        } else {
            flag='done';
            return;
        }
    }
}

 

 

Trigger:

 

trigger Test on FeedItem (after insert) {
    FeedItem[] f=Trigger.New;
    TestTriggerClass.addFeedError(f);

    System.debug(TestTriggerClass.flag);
    if(TestTriggerClass.flag!='done') {
        TestStoring__c vv=new TestStoring__c();
        vv.Body__c=f[0].body;
        insert vv;
    }
}

 

 

Any idea will help me.

Thanks

 

Anil

hi pat

i have a problem.

I have a sobject TestStoring__c with one custom field Body__c.In after insert trigger on FeedItem ,  when i insert a record in 

TestStoring__c sobject,it is not getting inserted.I am also attaching the code below.

 

Class:

 

public class TestTriggerClass {
    public static string flag;
    public static void addFeedError(list<FeedItem> fi) {
        if(fi[0].body.contains('blocked')) {
            flag='not';
            fi[0].adderror('Not Allowed');
            return;
        } else {
            flag='done';
            return;
        }
    }
}

 

 

Trigger:

 

trigger Test on FeedItem (after insert) {
    FeedItem[] f=Trigger.New;
    TestTriggerClass.addFeedError(f);

    System.debug(TestTriggerClass.flag);
    if(TestTriggerClass.flag!='done') {
        TestStoring__c vv=new TestStoring__c();
        vv.Body__c=f[0].body;
        insert vv;
    }
}

 

 

Any idea will help me.

Thanks

 

Anil