2

I am using the process builder to create a new record. I have 2 objects

Object A - PTO Request Object B - PTO Days

Basically when a new PTO Request is created the process builder kicks in with process a and creates a new PTO Day as a seperate object and dates it using the start date given in the PTO Request - This functionality works great

The second process then looks at end date given in the PTO Request and basically keeps recreating the step in the first process but adding a day each time. This effectively creates x number of records in the PTO Days object 1 for each day between the Start and End Date recorded on the PTO Request.

The second part of the process works well - however when i use a start and end date that are over 4 weeks apart it fails for no apparent reason.

I cant believe that there is a limit on the number of new records created that would be that small?

Also i have tried over a month end so starting in January and ending in February and that doesnt impact it - so as far as i can see it is solely down to the number being created,

Any ideas?

enter image description here enter image description here enter image description here

  • 1
  • Could you please attach exactly your process flow so we can have a better idea of what may be happening there? – Alexander Aeons Torn Jan 5 '17 at 14:49
  • Sorry to be stupid but where is the option to upload screen shots? – Matthew Bracewell Jan 5 '17 at 14:56
  • Adrian - i didnt use business hours as i didnt know how to do it in apex as you suggested so i used a formula to determine the day and they in my process that i will post i told it to add 3 days if it was a friday or 1 day if it was a weekday - seems to work - sure you will see when i work out how to attach a screen shot – Matthew Bracewell Jan 5 '17 at 14:58
  • @AlexanderAeonsTorn sorry forgot to link you in my reply – Matthew Bracewell Jan 5 '17 at 15:07
0

It really doesn't have anything to do with the number of records you're creating, but rather the level of recursion you're causing. You can only go 16 levels deep before Salesforce hits the DML recursion limit. Instead, build a Flow, and have the Process Builder kick off the Flow. From there, the flow can create all the days between, and insert them all at once.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.