Skip to main content

Notifications

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

Find Unsaved records and bulk save them

(0) ShareShare
ReportReport
Posted on by 33

Ok, two part question here as I am really new to Dynamics 365.  Is there a way under Accounts and Contacts to search for any record that has the Unsaved tag on it?  Referring to when you open the record up, see the record name in the top NAV bar and it ends with either - Unsaved or - Saved.  

I keep coming across tons of unsaved records and setting up business rules are not tripping properly because the record is unsaved.  Save the record and then the rules run fine and all is good.  I just can't seem to find a way to search and find these records.  

Second part of the question is if I can search and find these records, is there a way I can save them in bulk?  

Thanks.

Jayson

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 8,596 Super User 2024 Season 1 on at
    RE: Find Unsaved records and bulk save them

    Call below function on load of the form. If the issue is still persisting then remove it from the on load and use the same function on change of the depended field(field which is updated by Business rule)

    function onload_save(executionContext)

    {

       var formContext = executionContext.getFormContext();

       formContext.data.entity.save();

    }

    Thank you,

    Amit Katariya

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 8,596 Super User 2024 Season 1 on at
    RE: Find Unsaved records and bulk save them

    Yes it can... You can try it once. Else we can create a js which will run on change of a field which is changed by business rule and save the record. 

    https://www.fmtconsultants.com/autosave-feature-in-microsoft-crm/#:~:text=Go%20to%20the%20Dynamics%20365,available%20in%20all%20the%20forms!

    Thank you, 

    Amit Katariya

  • jlarner Profile Picture
    jlarner 33 on at
    RE: Find Unsaved records and bulk save them

    So is this confirmation that auto save will allow Business Rules to run and the record then gets saved without manual intervention?

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 8,596 Super User 2024 Season 1 on at
    RE: Find Unsaved records and bulk save them

    No but you can enable auto save function...

  • jlarner Profile Picture
    jlarner 33 on at
    RE: Find Unsaved records and bulk save them

    Ok, so I think I am understanding this now as it is the business rules that are on the form that are causing this.  I have a few business rules on the form especially based around rollup fields as you can't update other values based on a rollup field without a business rule.  So that leads me to ask these two questions.

    1. Is there a way to search for records that are unsaved?  

    2. Is there a way, in a business rule, to state "when done, save record"?

    Thanks.

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 8,596 Super User 2024 Season 1 on at
    RE: Find Unsaved records and bulk save them

    Yes as you already said you guys are migrating the data...that means records are created using the API's Or using some other automation tool(like using kingsway software) that means records are not created manually... So once you will open this record your business rules or JS will kick in which will chck the form data and make depending field updates.... And because of that you are facing this issue..... If you want to check what custom logic causing the issue you will have to enable audit history and save your record and check which fileds are changed. Once you will have changed fields data check the logic on this field... 

    You will get the culprit... 

    Thank you, 

    Amit Katariya

  • jlarner Profile Picture
    jlarner 33 on at
    RE: Find Unsaved records and bulk save them

    Thank you for the reply.  We are new on D365 and I noticed the unsaved scenario during our migration and the vendor told us this was normal.  Is that the correct response they should have provides us, probably not but it is what it is now.  I do have some business rules running on the forms so I guess the question is, when those run, can they or should they be set to save the record?  Additionally, we do not have Auto Save turned on in the account.  Is that part of my problem?  

    I would really like to see if there is a way to search this out still and pull a list but I don't know if a tag exists for unsaved anywhere in any of the entity tables.  

  • Suggested answer
    Pradeep Rai Profile Picture
    Pradeep Rai 5,490 Super User 2024 Season 2 on at
    RE: Find Unsaved records and bulk save them

    Hi Jayson,

    I would suggest you to refer below link and check which fields are getting dirty when you open any records:

    https://carldesouza.com/checking-isdirty-dynamics-365-using-javascript/

    Now, once we have fields then you need to check which business rules and javascript are updating the dirty fields.

    If business rules are making the fields dirty then you need update Business Rule to run only in certain condition such only on create form. For Identifying Create form in business rule you can use Created On. Because during record creation Created On field will be null.

    Similarly, in javascript you identify the form type as described in below link:

    https://neilparkhurst.com/2015/11/11/javascript-getformtype/

    Note: Xrm.Page willl get replaced by formContext. 

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 8,596 Super User 2024 Season 1 on at
    RE: Find Unsaved records and bulk save them

    Hello User,

    If you are facing this un-save issue after record is opened, then check status of respective record before opening it, from the advance find and once after opening it. if you notice any status change then it can be result of some custom logic.

    Thank you,

    Amit Katariya

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

Product updates

Dynamics 365 release plans