1

enter image description here

trigger update_date_trigger on Idea(before insert, before update) {
    for (Idea p: Trigger.new) {
        if (p.VoteTotal == 100 && p.Date__c != null) {
            p.Date__c = date.Today();
        }
    }
}

in this I didn't get my date when votetotal reach 100.

3
  • 1
    what is the issue you are facing?
    – highfive
    Jul 11, 2016 at 6:05
  • I didn't get my date when votetotal reach 100
    – Rajesh
    Jul 11, 2016 at 6:09
  • Seems p.Date__c != null logic is not valid here. Check that
    – highfive
    Jul 11, 2016 at 6:17

2 Answers 2

0

I believe the problem is that Idea triggers aren't executed when an idea is voted on, probably because the field is a roll up summary. Technically votes are part of a separate object called Vote, which doesn't support triggers.

enter image description here

You will probably have to implement this feature by scheduling a class to periodically poll the system for Ideas that meet your criterion and update the Date field accordingly.

4
  • hi martin in that image user promote the idea, when it will reach 100(VoteTotal) need date(Today)
    – Rajesh
    Jul 11, 2016 at 8:10
  • @Rajesh Unfortunately for this task, when a user clicks promote, the system creates a new entry created for the Vote object, and the related Idea record isn't updated. Your date field isn't getting updated because the trigger never fires.
    – martin
    Jul 11, 2016 at 8:14
  • any idea how to solve this
    – Rajesh
    Jul 11, 2016 at 8:21
  • @Rajesh I'd schedule a (batch) apex class to run every night just before midnight.
    – martin
    Jul 11, 2016 at 8:27
0

Try removing condition p.Date__c != null in

if (p.VoteTotal == 100 && p.Date__c != null) {
            p.Date__c = date.Today();
        }
1
  • I tried ishwar, still date not get
    – Rajesh
    Jul 11, 2016 at 6:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .