1 Reply · Latest reply on Oct 29, 2014 12:21 PM by William Sun

    How can I use a form in a UI Page to Submit a Catalog Item

      So, a weird question here and I'm not really sure how to approach this.


      I've built a CMS portal utilizing Twitter Bootstrap and I've embedded a UI page form into the homepage layout.  This UI page form is utilizing the form styles from Bootstrap and the processing script writes submitted data to a custom table.


      What I'm trying to figure out now is how have this form fire a catalog item workflow OR somehow have the catalog form embedded in to the homepage and utilize these same Bootstrap styles.


      Any help or direction with this would be appreciated.

        • Re: How can I use a form in a UI Page to Submit a Catalog Item
          William Sun

          This is a script I use in an Inbound Email Action to create a catalog item, it might be useful to you.

          You will need to change the bits where we set the requested_for and the cart.addItem to the item you want to add.

          I have not worked out all the details as far as adding the variables (commented out) but overall it works to create the item.


          var cart = new Cart();
          //pass Catalog item sys_id
          var item = cart.addItem('361eca0260da914063a50dc837a7e0ff'); // *cat_item sys_id*
          //set the variables
          //cart.setVariable(item, 'original', 'number');
          //var workflowVariable = 'New Value';
          //cart.setVariable(item, 'variableName', workflowVariable);
          // set the requested for
          var gr = new GlideRecord("sys_user");
          gr.addQuery("email", email.from);
          if (gr.next()) {
            var cartGR = cart.getCart();
            cartGR.requested_for = gr.sys_id;
          var rc = cart.placeOrder();
          //current.comments = "received from: " + email.body.requestor + "\n\n" + email.body_text;
          //current.short_description = email.subject + " - " + "Email";
          //current.u_service_desk = 'LATAM';


          Hope it helps.

          1 of 1 people found this helpful

          William Sun

          (Please mark as helpful/correct if this helped solve your issue)