Maximo Open Forum

 View Only

 SRMOBILE - Remove Summary field initialization

Jump to Best Answer
  • Customizations
  • Maximo Application Suite
Eric Burkland's profile image
Eric Burkland posted 02-06-2024 18:47

Maximo Application Suite/Manage 8.7.3.  SRMOBILE - Service Request application.

When you create a New Service Request and clink on a category, the category then defaults as the Summary/Description.  Is there a setting or customization that someone has done to remove this?  This is really annoying for our end users to have to wipe the field out each time or in a lot of cases they just leave the default and the person working the ticket has to put an actual description in.    I've gone through pulling up the XML through the Maximo Application Framework docker image but this application in particular is gnarly.    Thanks for your help.

Prajesh Pradhananga's profile image
Prajesh Pradhananga Best Answer

you could try something like below, add code to AppCustomizations.js, sample code is from Maximo Mobile version 8.10. 

 

/*
  onAddNewRecord is Called after the addNew is called and the item is added to the datasource.
  */
  onAddNewRecord({ datasource, item }) {
    console.log('Entering AppCustomizations.onAddNewRecord');

    if (this.page.name === 'createSR' && datasource.name === 'dsCreateSr') {
      this.page.state.xxx_descriptionUpdated = false;
    }
    console.log('Exiting AppCustomizations.onAddNewRecord');

  }

  /*
  onValueChanged is called after data has changed on a field in a datasource. It allows for an opportunity to reject the change, and while you can’t reject it (it already happened), you can use some additional datasource APIs to alert the user of failures, etc
  */
  onValueChanged({ datasource, item, field, oldValue, newValue }) {
    console.log('Entering AppCustomizations.onValueChanged');
    //
    // check if there is data in newValue
    //
    if (this.page.name === 'createSR' && datasource.name === 'dsCreateSr' && field === 'description' && newValue != undefined && newValue != "") {
      //
      // we only want to null the description first time, use custom state (xxx_descriptionUpdated or use other names as preferred) to track if it has been updated before on this SR
      //
      if (this.page.state.xxx_descriptionUpdated === undefined || this.page.state.xxx_descriptionUpdated === false) {
        this.page.state.xxx_descriptionUpdated = true;

        //
        // description is derived from below states (subcategory or topcategorydesc) in addNewServiceRequest function in CreateSRController Controller, if any of them match, null the value. 
        //
        if (newValue === this.app.state.subcategory || newValue === this.app.state.topcategorydesc) {
          console.log('Removing Description Value: ' + newValue);
          item[field] = "";
        }
      }
      console.log('Existing AppCustomizations.onValueChanged');
    }
  }

Eric Burkland's profile image
Eric Burkland

Thanks for your help @Prajesh Pradhananga. I made very slight modifications to make this work in Manage 8.75.  Works great!