You need to sign in to do that
Don't have an account?

Giving version numbers to new attachments
Hi...
I have to create a attachment programmatically, there is create button on accounts when user clicks on that button one attachment will be created.
I have done above perfectly .. but problem is have to maintain version numbers of newly created attachment . like below
each button click
Attachment_V1
Attachment_V2
Attachment_V3 ........
like quote PDF ganeration on opportunity...
How will I maintain version numbers programatically.....
Any help appriciated.....
You can query the Attachment object to get the latest attachment with this account as parent id. Then parse the name of that attachment and get the suffix number after the underscore. Increment it and use it for the new attachment.
best,
Ram
AttachmentV1
again click the button
AttachmentV2
once I close the record and again open it then click the button It will created from again 1 like below
AttachmentV1
AttachmentV2
Its not maintaining the previous count.