Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Field Validation when deactivating records

(0) ShareShare
ReportReport
Posted on by

Hi,

I would like to check if some fields have value before deactivate a CRM record (custom entity).

Is there any way I can call the deactivation dialog from JavaScript?

I cannot perform the deactivation from a SOAP call as the Deactivation dialog shows two Statuses to choose form.

I tried to call changeState function, as mentioned here, but it didn't worked.

btnType = 'deactivate'
value = 5

changeState(btnType, typeCode, value);

*This post is locked for comments

  • Jorge S Profile Picture
    Jorge S on at
    RE: Field Validation when deactivating records

    Hi Alex, thanks a lot! Your example totally worked for my requirement.

  • Verified answer
    ashlega Profile Picture
    ashlega 34,477 on at
    RE: Field Validation when deactivating records

    Hi Jorge,

     not sure about the javascript. Probably should not be calling changeStage directly either way since it`s an "internal" function..  You can try a workflow/plugin instead, here is an example:

    www.crmsoftwareblog.com/.../forcing-field-requirements-upon-closing-case-opportunity

     You might also create a new dropdown field and add options for all inactive statuses there, put it on the form, and work with that field in the "onsave" of the form just like you would with any other field.. Could use ribbon workbench to completly remove "deactivate" then (although, you'd have to remove it from the views as well then) Then you might use a workflow to actually deactivate the record whenever a value is selected into that field

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,375 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans