Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Unanswered

Issue with data.entity.save in Unified Interface

Posted on by
Hello,
 
We are using Dynamics CRM (on Premise) version 9.0.28.1.
 
I have a very simple javascript that gets the Record Id, puts it in a field and saves the form.  This is set to run on load in event handlers as I need to make sure the Record Id field is populated prior to workflows that run that require the field.  That said, we have been transitioning over to Unified Interface and with this Function running, I'm hitting a few issues:
 
  1. The forms this runs on have required fields that must be filled out before the form is saved.  Since the Function runs on load, we get the /A required field cannot be empty/ warning on all fields.
  2. When the record is saved, we get an error saying /Saving in Progress/.
The JavaScript Code is:
 
function PopulateGUID()
{
Xrm.Page.getAttribute(/ds_guid/).setValue(Xrm.Page.data.entity.getId().replace(/}/,//).replace(/{/,//));
Xrm.Page.data.entity.save();
}
 
From the bit of reading I've done it looks like I should transition to using formContext or something, but I am not 100% familiar with this.  Any guidance or example of how I can make it so that I get the record id, populate it in a field and save the form on load without getting the issues above would be much appreciated. 

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,570 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,683 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans