Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Unanswered

Issue with data.entity.save in Unified Interface

(0) ShareShare
ReportReport
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

News and Announcements

Announcing Category Subscriptions!

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans