Auto-Generate & Update Asset Serial Numbers using a custom function (Assets Module)

Auto-Generate & Update Asset Serial Numbers using a custom function (Assets Module)

Hello Team,

I’ve been working on a script to automate one of our processes in Zoho FSM, and the core functionality has been successfully implemented. However, I’m encountering an issue related to serial number allocation, which is not working as expected.

Below is a detailed explanation of how the script functions, along with an example of the issue I’m facing.

Script Functionality

The script handles two scenarios based on the asset type:

  1. If the Asset Type is "Product":

    • It updates the Asset Name field (API Name: Name) and the Description field (API Name: Description).

    • The format used for the asset name is: SKU (from Services and Parts module (API Name: SKU)) + Serial Number (API Name: GIAI) + Product Name (from Services and Parts module (API Name: Name)).

    • The description field is updated with the name (API Name: Name) from the Assets and Parts module.

  2. If the Asset Type is "ProCare Contract":

    • It performs the same field updates as mentioned above.

    • However, in this case, the serial number is generated automatically for the specific asset type through the workflow.

    • The functionality is working, but the serial number allocation is incorrect. This is the main issue I'm facing.

Issue – Incorrect Serial Number Allocation

Although the logic is mostly working, the serial numbers are not being assigned in a sequential or consistent manner.

Expected Behavior:

For example:

  • Asset A → Created Time: 2025-04-20 19:39 → Serial Number: 0001

  • Asset B → Created Time: 2025-04-20 19:40 → Serial Number: 0002

  • Asset C → Created Time: 2025-04-20 19:41 → Serial Number: 0003

Actual Behavior Observed:

  • Asset A → Created Time: 2025-04-20 19:39 → Serial Number: 0003

  • Asset B → Created Time: 2025-04-20 19:40 → Serial Number: 0002

  • Asset C → Created Time: 2025-04-20 19:41 → Serial Number: 0001

As you can see, the serial numbers are not aligning with the asset creation timestamps.

I’ve attached the script I developed for reference. I would greatly appreciate it if someone could help me resolve this issue.

For your reference, I’m currently using the Zoho FSM Professional subscription.

Thank you!