0

On the Task object, I have to create a field "Barcode Number"( Bar_Code_Number__c), which starting from a specific value 68992001 and for every created task on any object increment to one, when the Task subject is " PTT Dispatch Task" only. For other task subject , it should be blank. Also, the users can also edit this field if they want. But the next task creation will follow the regular increment number ( and not from the one what the user has changed). Can you plz suggest how to achieve it. Thanks

I tried a workflow rule but did not succeeded.

As per the WF I created, the criteria as Task subject as " PTT Dispatch Task" , and formula as below, and first time i inputted the number above first number here. But i think this is not the correct way.

Formula

1
3

This is covered in many places:

IDEA - Provide conditional auto-numbering

Process Builder - How to Create a Conditional Auto Number with just Process Builder. This is kind of clever in a way - you link the subject Object via a lookup relationship to another object that has an auto-number field. Each time your subject object should get an incremented number, you insert the auto-number object, then take the autonumber field from the auto-number object and smash it back into your subject object.

Flow How to Create a Conditional Auto Number - same as above

APEX In an after update/insert trigger on your subject SObject, you can use (SELECT ... FOR UPDATE) on a custom object and increment a custom field Next_Sequential_Number__ by one. This gives you maximum flexibility if you need multiple numbering ranges, say, by business unit or product line.

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.