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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Saving form before setting all my fields on form required

(0) ShareShare
ReportReport
Posted on by 1,290

Hello All,

I have a following requirement where on the click of button in the ribbon, there are around 20 fields should be converted to "Business Required" on the form. Currently these fields are "Business Recommended".

However, I would also like to save the form before setting them required.

I am able to set the 20 fields to "Business Required" but because the fields are required it wont save the form.

For Example: 

I am filling out the form and i have filled out 7 fields details and I would like to save those 7 fields information on the click of the Submit button. Below is the JS code which i am using to convert the fields into business required. But i am having hard time saving the records. 

function setRequiredLevel(primaryControl)
{ debugger;
var formContext = primaryControl;
formContext.data.entity.save();
afterSave(formContext);
}
function afterSave(formContext)
{

var currentForm = formContext.ui.formSelector.getCurrentItem();
if(currentForm.getLabel() == "Commercial Form"){
var intakeFields = ["ibc_opportunitytoahaintakeid",
"ibc_lineofbusiness",
"ibc_statusofrequest",
"ibc_dateofinitialintakeformsubmission",
"ibc_duedate",
"ibc_effectivedate"];
}

for(var i=0; i<intakeFields.length; i++)
{
var intakeField = intakeFields[i];
if(formContext.getAttribute(intakeField) != null)
{
formContext.data.entity.save();
formContext.getAttribute(intakeField).setRequiredLevel("required");
}
else
{
formContext.getAttribute(intakeField).setRequiredLevel("required");
}

}

}

Please let me know if there's any workaround where i can save the form first, so i dont lose the information in the fields which i have already filled

Any help would be much appreciated.

I have the same question (0)
  • Suggested answer
    Gilmeyer Profile Picture
    Microsoft Employee on at

    Hi,

    Please use the following save method docs.microsoft.com/.../save and on success callback try to make the the empty fields business required.

  • Suggested answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    HI,

    You can update the record with field data using Web API and this way you don't have to take care of mandatory field error validation.

    Once you save the data using web api then make those field mandatory.

    If found helpful, Please mark my answer verified.

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
11manish Profile Picture

11manish 164

#2
ManoVerse Profile Picture

ManoVerse 147 Super User 2026 Season 1

#3
Zhilan Profile Picture

Zhilan 55

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans