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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

D365 Portal - How to validate fields on Workflow button

(0) ShareShare
ReportReport
Posted on by 441

Hello Everyone,

I've create a workflow button called "Decline " in partner portal form. When I click on that button a background workflow runs and it set record status to "Declined".

But before running that workflow , I need to validate a field called as "Decline Reason" and then execute the workflow. 

So , If I click on Decline button it should first ask me to fill "Decline reason"  value and then set record status to Declined!

Any solution on this please?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Nicholas Hayduk Profile Picture
    2,863 on at

    Hi Prashant,

    There is no out-of-the-box way to force a use to fill out a field before clicking a workflow button.

    Instead of running a workflow to set the status, I'd have both fields (status and the reason) as fields on the form.  You can then use JavaScript and validators to only show and require the Decline Reason field when the status is set to declined.  If there is other logic happening in your workflow, it could be triggered on the status change (as opposed to have the workflow trigger the status change).

    Hope that helps.

    Nick

  • Prashant Wani Profile Picture
    441 on at

    Thanks for your reply Nicholas.

    Can it be achieved using any custom button to set the status and  and ask user to fill status reason?

    We have demonstrated button functionality to user for declining lead and hence they would expect to have button.

  • Suggested answer
    oliver.rodrigues Profile Picture
    4,052 on at

    Prashant you can place a "Decline Button" via JS that shoes the "decline reason" field (also adding the necessary validation of course) and then simply save the record.. your WF in the background should do the trick

  • Suggested answer
    Nicholas Hayduk Profile Picture
    2,863 on at

    As Oliver pointed out, you can create the button using JavaScript which then requires the reason, but in the end you need to click save again.

    The challenge is that the only way to save data back to Dynamics is by having the user click the save button.

    If you wanted to get really fancy, you could in theory:

    - Add the reason field to the form, but hide it using JS

    - Create a custom button in JS that pops up a modal asking for the reason

    - Once they confirm their reason, use JS to copy the reason from the modal into the hidden reason field, and then us JS to click the save button on behalf of the user.  Since you've copied the reason to a field on the form, it will get saved to Dynamics.

    Nick

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans