Workflow question to create unique ID


I’m quite new to SuiteCRM and got a question to create a new field Quotation Number that is populated when an opportunity is created. The first 2 numbers should be the Year, then Month and then 6 for a unique ID.

I found out how to create the 2 parts of the ID seperately but don’t really see how to combine them into one number. Any assistance is super welcome!

{now(ym)} {GlobalCounterPerModule(quotationnumber;6)}

Bonus question, users want to be able to edit this number in some niche cases but in general I would prefer to keep it auto generated.

kind regards

Hi, @Robbe
I think it’s easy. Look at the option. I haven’t tested it, but I think you can get the idea.
{add({multiply(1000000; {now(ym)})}; {GlobalCounterPerModule(quotationnumber;6)})}

I just did this as a before save hook, that takes the last 4 digits of the SSN number and a 5 digit random number (duplicates are possible, while extremely unlikely). It only runs if the Student ID is null. Otherwise not. So the client can still edit it and it won’t be over written.

class studentidBSHook {

    function studentIDUpdate (&$bean, $event, $arguments) {
					 $randnum = rand(10000, 99999);
					 $ssn = $bean->ssn_c;
					 $bean->student_id_c = $randnum.'-'.$ssn;