Catalog item requirement

AnilJ
Tera Contributor

I want populate the L2 Support group and its manager on order form, how we can achieve this.

When we entered the asset tag then this field will be populate automatically.

 

IMG-20250408-WA0003.jpg

7 REPLIES 7

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @AnilJ 

For the catalog item, if you have a variable for the asset tag, create another variable for the manager and L2 support group. You can then use the auto-populate feature on the variable to populate both

 

AGLearnNGrow_0-1744112874285.png

https://www.servicenow.com/community/developer-articles/auto-populate-reference-data-in-service-cata...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi Atul,

We are currently using Quebec version, so there is no option like auto-populate.

Hi @AnilJ 

 

So in this case you need to write the script only, which will be a technical debt for you mate. Suggest the client upgrade to the latest version or n-1 to get more new features of ServiceNow.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

swapnali ombale
Kilo Sage

Hi @AnilJ 

By creating business rule you can achieve this 

Create a Business Rule:
 
  • Table: Select the order form table.
  • When to Run: Choose "Before insert" or "Before update" depending on your needs.
  • Conditions: Add a condition to trigger the business rule when the asset field changes.
  • Script: Add the following script:
  • (function executeRule(current, previous /*null when async*/) {

    // Check if the asset field has changed

    if (current.u_asset != previous.u_asset) {

 

        // Get the asset record

        var assetGR = new GlideRecord('alm_asset'); // Replace 'alm_asset' with your asset table

        assetGR.addQuery('sys_id', current.u_asset);

        assetGR.query();

 

        if (assetGR.next()) {

            // Get the L2 Support group and manager from the asset record

            var l2SupportGroup = assetGR.u_l2_support_group; // Replace 'u_l2_support_group' with your field

            var manager = assetGR.u_manager; // Replace 'u_manager' with your field

 

            // Populate the assignment group and assigned to fields on the order form

            current.assignment_group = l2SupportGroup; // Replace 'assignment_group' with your field

            current.assigned_to = manager; // Replace 'assigned_to' with your field

        }

    }

})(current, previous);