Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL forum
Answered

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.

  • 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_ 616 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_ 616 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_ 616 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

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans