web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

SL 2015 WebApps Unlink Attachment

(0) ShareShare
ReportReport
Posted on by 6,451

Seems that in WebApps Expense Reports, a user is able to Unlink an attachment even if the Expense report is Completed/Posted.  We want to only allow the Unlink button to appear if the Expense Report is "In Process".  I can find references to the Unlink button in the Attachments.vbhtml file in the Source code, but not sure how to add the condition of hiding/disabling the button based on the Expense Report status.

Thanks.

*This post is locked for comments

I have the same question (0)
  • MARC_ Profile Picture
    626 on at

    Hey Mark -

    I haven't worked too much with expense, but you could try one of these 2 options...

    1. the Attachment.vbhtml file uses ViewData("ReadOnly") and if True, the button is not shown; so you could force the ViewData("ReadOnly") to be True in your controller

    2. the Unlink button has an id of "unlinkPop"; write JavaScript in ExpenseGrid.vbhtml to disable it if status != 'In Process' - the disabling would be something like:  $('#unlinkPop').addClass('ui-disabled');  or just hide it using $('#unlinkPop').hide();   could tie to the button click that opens the Attachment with a test on status.

    Again, haven't tested either, but that's where I'd start.

    Good luck!

    Marc

  • MARC_ Profile Picture
    626 on at

    Actually...try this

    add to your DetailAttachment.vbhtml

       $(document).ready(function () {

           if ($("#All").css('visibility') != "hidden") {

               $('#unlinkPop').hide();

           }

           else {

               $('#unlinkPop').show();

           }

       });

  • Mark E Profile Picture
    6,451 on at

    Marc,

    Thanks, trying to determine where exactly in the vbhtml you are suggesting this code, within the AttachmentUnlink function, or somewhere else?

    Also, this would be on the HeaderAttachment.vbhtml, as we have suppressed the ability for users to link attachments for grid entries, and only allowing attachments at the Document level.

  • Verified answer
    MARC_ Profile Picture
    626 on at

    Ah...sorry, i assumed detail note.

    Yes, put in the HeaderAttachment.vbhtml in the <script> element

    headattach.JPG

  • Mark E Profile Picture
    6,451 on at

    Works great, thanks!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics SL (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans