Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.

Create the fourth panel and add a script

Log in to subscribe to topics and get notified when content changes.

Create the fourth panel and add a script

How to create the fourth panel and add a script.

  1. In the Wizard Panels related list, click New.
  2. Select the panel Type of Creates something (record generator).
  3. Enter the following information, then right-click the header and select Save.
    • Name: 4 Create Contract and Assets
    • Table: Global
  4. Paste the example script into the Script field. Configure the form to add the field, if necessary.

    Example script:

    //Call the createContract function to obtain the ID of the created contract
    var contract_id = createContract();
    //Construct a url that will be used to redirect the user after submission 
    var uri =(''+ contract_id);
    //Redirect the user to the url
    wizard.redirect= uri;
    gs.addInfoMessage('Contract created');
    //Create a new contract
    function createContract(){
      var cc = new GlideRecord('ast_contract');
    //set values from wizard variables - note the format wizard.variable
      cc.sys_class_name= wizard.contract_type;
      cc.starts= wizard.starts;
      cc.ends= wizard.ends;
      cc.short_description= wizard.short_description;
      var cntr = cc.insert();
    //We created a new contract and have the id so now we need the assets to associate
      return cntr;
    //This is the way we loop through the elements in a list collector - assets in this case
    function associateAssets(id){
      var items = wizard.asset_select.toString();
      items = items.split(',');
      for(var i =0; i < items.length; i++){
        var sys_id = items[i];
        if(sys_id !=''){
          var rl =new GlideRecord('ast_contract_instance');
          rl.ast_contract= id;
          rl.ci_item= sys_id;