Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

Auto created record shows unsaved changes

  • 1.  Auto created record shows unsaved changes

    GOLD CONTRIBUTOR
    Posted Jan 30, 2019 07:05 AM
    Dear All,

    We have a custom workflow activity that creates a renewal record based on the inception year when we close the Opportunity as won.
    Below are the steps that take place

    Close opportunity as won
    1. Renewal Opportunity gets created via the custom workflow activity.
    2. The Opportunity shows right date in the Year values when we look at the record created.
    3. Now when we run an advanced find and locate the same record we see that the values for the year field show vague values – lets say on the record if we have the value as 2017 then in advanced find it will show 2021 or something else- if the frequency was selected as recurring 4 year – if we would have selected the value as frequency as recurring 3 year then the value will be 2020 – (As this would be dependent on the frequency field on the form).
    4. We could see that the renewal opportunity shows that it has got Unsaved Changes – Now if we save the record on the form –The issue goes away.
    5. We would like to find what is causing the auto create renewal Opportunity record to load with Unsaved Changes. What modifications could we do to the code to ensure that if a renewal opportunity gets created – we don't see the unsaved changes.
    If we can find a way to have the renewal created opportunity record to load with saved changes then we thing the issue will not occur.

    ------------------------------
    Bhartendu Pandey
    Willis Towers Watson
    London
    ------------------------------


  • 2.  RE: Auto created record shows unsaved changes

    TOP CONTRIBUTOR
    Posted Jan 31, 2019 02:31 AM
    Hi @Bhartendu Pandey ,

    Are there any Business Rules activated on the entity? If so, have you tried to disable them to see if they are causing the 'unsaved changes'?

    ------------------------------
    BR,
    Niels
    ------------------------------



  • 3.  RE: Auto created record shows unsaved changes

    GOLD CONTRIBUTOR
    Posted Feb 15, 2019 07:51 AM
    Hello Neils,

    Thank you for your reply.
    I apologize for not really being able to connect any sooner as we had a go live for our Production environment and got too busy with the same.​

    Yes we have around 6 Business Rules on the Opportunity entity.
    I deactivated the same and tried to replicate the issue and I could still see that we are seeing the same behavior.

    I guess we have lot of fields on the form on which calculation takes place through various sources like Plugins . Also we have a lot of javascript code which could possibly cause the behavior.

    As such I have also noticed that all our issues get solved once we perform a save on the record. Is there a way to sort of save the record using a workflow.?

    ------------------------------
    Bhartendu Pandey
    Willis Towers Watson
    London
    ------------------------------



  • 4.  RE: Auto created record shows unsaved changes

    SILVER CONTRIBUTOR
    Posted Feb 15, 2019 09:22 AM
    @Bhartendu Pandey Sounds like ​something is being triggered (workflow or plugin) AFTER your custom workflow activity runs. Also, the unsaved changes message appears only when you open the form, in which case it's most likely a business rule or JScript being triggered that updates the data on the form, but then the user has to save the record.

    ------------------------------
    Michael Cross
    Senior Consultant
    eLogic
    rochester NY
    ------------------------------



  • 5.  RE: Auto created record shows unsaved changes

    GOLD CONTRIBUTOR
    Posted 29 days ago
    Hello @Michael Cross thank you for your inputs . Yes we do have calculations in the background that updates the fields.
    And yes possible the issue is being faced because of the heavy javascripts and plugin usage.

    I am still thinking if we can have a workflow to save the record or else we will just have to notify the users as to ensure they save the record so that appropriate calculations take place.


    ------------------------------
    Bhartendu Pandey
    Willis Towers Watson
    London
    ------------------------------



  • 6.  RE: Auto created record shows unsaved changes

    SILVER CONTRIBUTOR
    Posted 29 days ago
    You have to figure out what is causing the record to be "dirty" and requiring it to be saved, whether it's a business rule or JScript. Only then can you determine how to address the situation.

    ------------------------------
    Michael Cross
    Senior Consultant
    eLogic
    rochester NY
    ------------------------------



  • 7.  RE: Auto created record shows unsaved changes

    GOLD CONTRIBUTOR
    Posted 29 days ago
    @Michael Cross thank you for your reply. Yes we just tried checking however the form is heavily loaded with custom code.
    Will continue to looking to find the particular reason the form turns 'isdirty' and change the same​

    ------------------------------
    Bhartendu Pandey
    Willis Towers Watson
    London
    ------------------------------



  • 8.  RE: Auto created record shows unsaved changes

    GOLD CONTRIBUTOR
    Posted Feb 15, 2019 10:20 AM
    The business rule may be required but could be set to be scoped just to the form you're editing. If that's the case then the only time the business rule will apply is when the form is opened.

    Can you try changing the scope of the business rule to `Entity` and see if that makes the problem go away?



    ------------------------------
    Nick Hance
    Reenhanced
    www.buildbettersoftware.com
    Green Lane PA
    ------------------------------



  • 9.  RE: Auto created record shows unsaved changes

    GOLD CONTRIBUTOR
    Posted 29 days ago
    Hello Nick,

    Thank you for your reply.
    I had set the business rules all at an entity level activated them and tried to reproduce the issue and we could still see that the issue was occurring.

    I guess this is still caused by too much of scripting that has been performed. Some side effects of inheriting a legacy system :-(.
    I tried the workaround of having a workflow perform the save on the records . So i placed a dummy field on the form and had it hidden . Now i created and on demand workflow to trigger on demand and had it run against the newly created record.

    The workflow ran without any issues however the record still was unsaved.
    Is there something I could possibly do better with the workflow?


    ------------------------------
    Bhartendu Pandey
    Willis Towers Watson
    London
    ------------------------------



  • 10.  RE: Auto created record shows unsaved changes

    Posted 29 days ago
    Hi,

    You may have already done this, but if you install the Level up for D365/CRM extension for Chrome you can use the 'Changed Fields' functionality when on the form which will highlight the fields that are changed and unsaved.

    It may help you narrow down the issue as you can then inspect the fields dependencies to find business rules, or search for that fields name in your JavaScript files.

    Ta,

    Ben

    ------------------------------
    Ben Bartle
    IBM
    ------------------------------



  • 11.  RE: Auto created record shows unsaved changes

    Posted 28 days ago
    Hi
    It looks like your logic is in the JavaScript on the form, so when the record is created via workflow, the JavaScript is not executed until the form is opened. You can't do much about that, what you can do it put the logic the JavaScript is updating into your workflow process so the values are set on create, you should then have the correct values in your advanced find, and no longer need to save it after the first load.
    Cheers

    ------------------------------
    James Abraham
    Practice Lead, Dynamics
    Empired
    ------------------------------



  • 12.  RE: Auto created record shows unsaved changes

    GOLD CONTRIBUTOR
    Posted 28 days ago
    Hello @James Abraham

    Thank you for your inputs.
    I will look forward to see if we can place the code inside the  custom workflow activity.



    ------------------------------
    Bhartendu Pandey
    Willis Towers Watson
    London
    ------------------------------