Salesforce: Workaround to Assign Asset Name with Auto Increment Unique Value
In Salesforce, when creating an Asset entry, the Name field is a mandatory text field. For some users, this field has no particular purpose but cannot be left empty. For others, they may want to set the field with unique incremental id. In order to assign the Name field with an auto incremental value, a workaround solution is to first create a custom numeric field, (e.g.) Auto Update Id, with auto increment property.
Next step is to create a trigger which sets the Name field to the Auto_Update_Id value. Goes to Customize -> Assets -> Triggers and creates a trigger with the following simple code:
trigger SetNameToAutoIncrId on Asset (after insert) { for(Asset a: trigger.new){ for (Asset ua: [ Select Name, Auto_Update_Id__c FROM Asset where Id = :a.id ]) { ua.Name = ua.Auto_Update_Id__c; update ua; } } }
Since the auto increment value won’t be assigned until an Asset record is created, therefore we have to create a trigger with after insert event. Also Salesforce does not allow users to modify the triggered record in after insert event. So that we need to issue another SOQL query, assign the result to another Asset object and then update the record to the DB.
Although the user still needs to input something into the mandatory Name field, the insert operation will automatically overwrite the Name field with an unique numerical id.
A new look for my demo page
After a couple attempts of redesigning my homepage, I decided to fall back to simplistic approach. A simple grids base demo using jQuery thumbnail and lightbox to popup each demo.
New release of Highcharts extension supports Highcharts 3.0
A new version of Highcharts extension (ver 2.4.0) for Sencha ExtJs 4 and Touch 2 is released which supports the latest release of Highcharts 3.0 and fixes the compatibility issues with ExtJs 4.2 and Touch 2.1.1.
Here are the details of the latest changes: Read more
joekuan.org is up
Hi all,
I have setup joekuan.org which includes the Highstock and Highchart extensions for ExtJs 4. This site is constantly maintained with new added examples.