Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Field validation for REST API

Posted on by Microsoft Employee

I have a custom entity for a solution, and I want to validate some fields (like required fields, regex for particular fields etc). Some of the fields were marked required during field creation, but those fileds are only got validated on CRM FORM not for REST API. I also tried out Custom Workflow by following this but that didn't work for me.

How can I do this for REST API?

Regards.

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Field validation for REST API

    Hi,

    Thanks for the reply I was being able to validate the field for REST API using real time workflows, but the response is not the same as I have set in the workflow. REST API is giving 500 when validation fails, and I wan that the response should be the message which has been set. I have attached the screenshot of workflow.

    worflow.png 

    Thanks,

  • Suggested answer
    Shidin Haridas Profile Picture
    Shidin Haridas 3,497 on at
    RE: Field validation for REST API

    Ensure that the custom workflow you have is 'a real time workflow'.

    Else, it will be an async job.

    For any server side validation, use real-time workflows or plugins.

    And throw exception from the plugin code.

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Field validation for REST API

    If you want to validate data as it is created via any means (Crm form, REST API etc), then you'll need to use either a synchronous plugin (which would throw an Exception if the validation fails), or a synchronous workflow (which would cancel the workflow if the validation fails)

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans