Create new field on a form to show end time on a change form.

Not applicable

I need to create a new field named "End time" on a form (Application Inventory). I want this filed to be populated by end date value on the change request form based on a combination of the CI and the category. If a specific category and Configuration Item is selected for on a change ticket, the end date for the change should be populated on a new field on the application inventory form called "change end date"

1 ACCEPTED SOLUTION

Dr Atul G- LNG
Tera Patron

|Hi @Community Alums 

What is use case of showing end time on application inventory. better to add change as related list and get the all information on one place.

*************************************************************************************************************
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/dratulgrover [ Connect for 1-1 Session]

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

View solution in original post

5 REPLIES 5

Tushar
Kilo Sage

Hi @Community Alums 

 

Maybe a BR like this should work -

 

(function executeRule(current, previous /*null when async*/) {
  try {
    var ci = current.getDisplayValue("u_ci"); //  CI from the change request
    var category = current.category; //  category from the change request

    var appInvGr = new GlideRecord('u_application_inventory'); // replace with your Application Inventory table name
    appInvGr.addQuery('u_ci', ci); // filtering by CI
    appInvGr.query();

    if (appInvGr.next()) {
      appInvGr.u_change_end_date = current.u_end_date; // Populating the "change end date" field
      appInvGr.update();
    } else {
      gs.info('no matching record found in Application Inventory for CI: ' + ci + ' and Category: ' + category);
    }
  } catch (ex) {
    gs.error('Error updating Application Inventory record: ' + ex);
  }
})(current, previous);

 

Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!

Regards,
Tushar

Not applicable

dont use try/catch on buss.rules as the java class responsible is actually doing it for us for buss.rules

 

Not applicable

I will try this tomorrow and let you know. Thank you for the prompt response.

Not applicable

How do I add the change end date field to the application inventory form?