Method for checking for mandatory attachment on catalog item that utilizes best practices

Jon Ulrich
Kilo Guru

I just spent the last 3 hours going down every path I could imagine, but could not find any solutions to meet these requirements.

  1. Require mandatory attachment on catalog item and prevent submission without it.
  2. Must use best practices; no DOM.
  3. Must use record attachment, no attachment variable. (This needs to be retrofitted into existing process that is using the record attachment)
  4. Attachment is mandatory only given a condition (not always mandatory, thus dont use Mandatory Attachment in portal settings);

I've tried everything imaginable and ran into road blocks everywhere:

  • getCurrentAttachmentNumber() does not work in service portal
  • GlideAjax to check sys_attachment table
    • This requires requires cart item sys_id.
      • g_form.getParameter("sysparm_item_guid") does not work in service portal.
      • KB0723775 says to use g_form.getUniqueValue() but that is not helpful at all as g_form.getUniqueValue(); returns Catalog Item sys_id, not the Cart Item sys_id.
    • Even after creating script include that takes Catalog Item sys_id as input, which is risky in its own, I still cant use a On Submit client script with Glide Ajax because you cant return false from an async callback on ga.getXMLAnswer() and ga.getXMLWait() is no longer supported.
1 REPLY 1

Muhammad Salar
Giga Sage