Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Answered

Validation on Delete button (work order product): Delete only allow if the condition is meet otherwise message box should display with message in Dynamics365

Posted on by 15

I want to prevent the deletion of Work order Products in the Work order screen in Dynamics 365 based on the field (Line status) value, if the "Line Status" value meets the criteria then the system should allow deleting otherwise a message box should be displayed. please help me to do it via Javascript. thanks a lot

pastedimage1680698963733v1.png

  • Suggested answer
    Lorenzo 365 Profile Picture
    Lorenzo 365 52 on at
    RE: Validation on Delete button (work order product): Delete only allow if the condition is meet otherwise message box should display with message in Dynamics365

    I think there are two easy way to do this:

    - Via workflow

    - Adding a custom display rule or custom command to the button in ribbon workbench

  • Verified answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Validation on Delete button (work order product): Delete only allow if the condition is meet otherwise message box should display with message in Dynamics365

    Hi Irfan K,

    Do not you think workflow or plugins are easy ways to solve this problem instead of the JavaScript. 

  • Irfan K Profile Picture
    Irfan K 15 on at
    RE: Validation on Delete button (work order product): Delete only allow if the condition is meet otherwise message box should display with message in Dynamics365

    If you don't mind, do you have some code samples?

  • Verified answer
    RE: Validation on Delete button (work order product): Delete only allow if the condition is meet otherwise message box should display with message in Dynamics365

    Hi Irfan,

    You can throw your alert using a web resource and calling it in the button click with the condition check.

    Please follow the below steps:

    1. Add ribbon workbench solution to your environment.
    2. create a new solution only for ribbon customization(Ribbon workbench doesn't handle more than 5 entities).
    3. Add the entity to that solution(in your case it is workorderproducts)
    4. Open ribbon work bench and select the button then add commands(your custom script), display rules etc as your need
    5. publish the solution

    Test the button

    If this answer helps you, like and verify my answer

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans