Tuesday, November 27, 2018

Require attachment for catalog item in Platform and Service Portal

Follow the below steps:-

1.Create UI Script

UI Script: GlobalCatalogItemFunctions
Global: true
Script:

function getSCAttachmentCount() {
   var length;
   try {
   length = angular.element("#sc_cat_item").scope().attachments.length;
   } catch(e) {
   length = -1;
   }
   return length;

}


2. Select your Portal > Theme(Open the theme and go to the related list section, click JS include tab and click the new UI action). 

Create New:- JS Theme

Display Name:- GlobalCatalogItemFunctions

Source:- UI Script

UI Script: GlobalCatalogItemFunctions(Select the UI script that is you created)


3. Catalog Client Script:

function onSubmit() {

   //Works in non-portal UI

   try {

   var attachments = document.getElementById('header_attachment_list_label');

   if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none' ) {

   alert('You must attach the completed form before submitting this request.');

   return false;

   }

   }

   //For Service Portal

   catch(e) {

   var count = getSCAttachmentCount();

   if(count <= 0) {

   alert('You must attach the completed form before submitting this request.');

   return false;

   }

   }

}

16 comments:

  1. Attachment for catalog item in Platform and Service Portal is very important part in servicenow. Thank you for given this useful information.

    ReplyDelete
  2. Thanks Resma. I'll upload some videos as well as.

    ReplyDelete
  3. Your welcome & thanks for your valuable comment!

    ReplyDelete
  4. it is an interesting Article, i read this post that was very nice and useful thanks for sharing it.

    online training website

    ReplyDelete
  5. Thanks for sharing this information!
    I totally agree with you. Your information is very interesting and important. I really like this information.
    Our easy is servicenow online training in hyderabad
    If you want to see our training venue then click on links:
    https://www.futureqtech.com/servicenow-online-training.php
    Call Now: +91 9581111796
    Drop Mail: info@futureqtech.com

    ReplyDelete
  6. Thank you for providing this kind of useful information,I am searching for this kind of useful information. it is very useful to me and some other looking for it. It is very helpful to who are searching servicenow.servicenow training in bangalore

    ReplyDelete
  7. Thanks for sharing valuable information. Explanation is in very detailed thanks once again.
    servicenow now learning
    servicenow certification

    ReplyDelete
  8. Thanks for sharing valuable information and very well explained. keep posting.

    best servicenow online training
    servicenow developer training online

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.
    ServiceNow Training in Bangalore

    ReplyDelete
  11. Thank you for your post. Written a Very nice article . It is amazing and wonderful to visit your site.
    I hope this Servicenow link will help to all users.

    ReplyDelete
  12. Thank you for your post. Written a Very nice article this is very informative. It is amazing and wonderful to visit your site.
    I hope this Servicenow link will help to all users.

    ReplyDelete

PLEASE LEAVE YOUR COMMENT