Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Saving lead entity without mandatory fields filled

Posted on by

There are some mandatory fields on the lead form which are required for qualifying. But the user may not know the values when creating the lead and hence I want to allow saving without the mandatory fields filled. Any suggestions on how to do this?

  • Torrado Profile Picture
    Torrado 1,270 on at
    RE: Saving lead entity without mandatory fields filled

    Hello,

    Do you need additional help? Any news?

    If it's already clarified, and the answer was helpful, could you please mark it as verified? That will help others in future.

  • Suggested answer
    Torrado Profile Picture
    Torrado 1,270 on at
    RE: Saving lead entity without mandatory fields filled

    Hello Sankalp,

    No. You can read from the fields values and apply the validations (if the fields contains data) as part of the Plug-in logic.

    Please mark the answer as verified if helpful.

  • RE: Saving lead entity without mandatory fields filled

    Hi,

    Is it possible to get the current BPF name and it's mandatory fields in the plugin? I am trying out this approach today and I'm stuck at getting the BPF mandatory fields

  • Suggested answer
    Torrado Profile Picture
    Torrado 1,270 on at
    RE: Saving lead entity without mandatory fields filled

    Sankalp, as mentioned before, if you want to have that fields validation when pressing "Qualify" button, you need to create a synchronous PreValidation Plug-in on "QualifyLead" message, that will fire only when clicking "Qualify" button.

    Then, inside the Plug-in logic, you can check if the fields are populated and, if they are empty, block Lead qualification and display an error message to the user.

    Please mark the answer as verified if helpful.

  • Suggested answer
    David Yu Profile Picture
    David Yu on at
    RE: Saving lead entity without mandatory fields filled

    You may leverage QualifyLead message in plugin to block the qualify action if some of the fields are blank.

    pastedimage1618886609058v1.png

    Please register the step as synchronized.

  • RE: Saving lead entity without mandatory fields filled

    But those fields are required for qualifying the lead. My requirement is that users should be able to save the lead without filling those fields but should fill them to qualify the lead

  • Suggested answer
    David Yu Profile Picture
    David Yu on at
    RE: Saving lead entity without mandatory fields filled

    You may change it to not required at very beginning by formContext.getAttribute(arg).setRequiredLevel("none") and change it back once user qualifies the lead.

  • RE: Saving lead entity without mandatory fields filled

    Hi David,

    So there's a process which contains required fields at every stage. I've extracted the list of required fields and made them mandatory by using setRequiredField("required"), on loading the form. The problem is this prevents the lead from being saved without these fields filled during lead creation. The users wouldn't have this data beforehand and should be able to save the lead without the process provided required fields

  • Suggested answer
    David Yu Profile Picture
    David Yu on at
    RE: Saving lead entity without mandatory fields filled

    Hi Sankalp,

    You may set mark the field as optional from the entity and enable onload JS to change the field required level after the lead getting qualified.

    Here is the sample JS code for changing field required level. FYI

    setRequiredLevel (Client API reference) - Power Apps | Microsoft Docs

  • Suggested answer
    Torrado Profile Picture
    Torrado 1,270 on at
    RE: Saving lead entity without mandatory fields filled

    Hello,

    If you want to have that validation only when pressing "Qualify" button, you can create a PreValidation Plug-in on Qualify message, that will fire only when clicking "Qualify" button.

    Inside the Plug-in logic you can check if the fields are populated and, if not, display a message to the user.

    Please mark the answer as verified if helpful.

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

Product updates

Dynamics 365 release plans