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

Announcements

Community site session details

Community site session details

Session Id :
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

(0) ShareShare
ReportReport
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

I have the same question (0)
  • Verified answer
    Tamilarasu Arunachalam Profile Picture
    593 on at

    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

  • Irfan K Profile Picture
    15 on at

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

  • Verified answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at

    Hi Irfan K,

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

  • Suggested answer
    Lorenzo 365 Profile Picture
    52 on at

    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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 56 Super User 2026 Season 1

#2
Eugen Podkorytov Profile Picture

Eugen Podkorytov 49

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 31 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans