Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL (Archived)

SL 2015 WebApps Unlink Attachment

Posted on by 6,405

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

  • Mark E Profile Picture
    Mark E 6,405 on at
    RE: SL 2015 WebApps Unlink Attachment

    Works great, thanks!!

  • Verified answer
    MARC_ Profile Picture
    MARC_ 620 on at
    RE: SL 2015 WebApps Unlink Attachment

    Ah...sorry, i assumed detail note.

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

    headattach.JPG

  • Mark E Profile Picture
    Mark E 6,405 on at
    RE: SL 2015 WebApps Unlink Attachment

    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.

  • MARC_ Profile Picture
    MARC_ 620 on at
    RE: SL 2015 WebApps Unlink Attachment

    Actually...try this

    add to your DetailAttachment.vbhtml

       $(document).ready(function () {

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

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

           }

           else {

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

           }

       });

  • MARC_ Profile Picture
    MARC_ 620 on at
    RE: SL 2015 WebApps Unlink Attachment

    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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans