Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

Data should not be update in uneditable field and existing value in field not change through excel add-in

(0) ShareShare
ReportReport
Posted on by 56

In my requirement I have a unedited able field in which user cannot enter values of form after if this field is lock. Below in picture the Jul-22 field is lock and unedited.

pastedimage1663785588046v1.png

I want when I update data through excel add-in  specifically field Jul-22  value cannot be ever changed with any new value or field value replace its already existing value like 170. Below in picture period 1 is Jul-22 field in excel If user remove 170 and put 180 so the 170 should exist in table and 180 value not updated.

pastedimage1663785971614v2.png

  select * from projectForecastPeriods
            where projectForecastPeriods.FinancialYear == this.FinancialYear
            && projectForecastPeriods.ForecastModel == this.ForecastModel;

        if(projectForecastPeriods.Period1 ==NoYes::Yes && this.Period1)
        {
            ttsbegin;
            select forupdate currentForecastTable 
                where currentForecastTable.RecId == this.RecId;
            currentForecastTable.Period1 = this.Period1;
            currentForecastTable.update();
            ttscommit;
        }

I try the above code on Data Entity level method mapEntityToDatasouce in which I assign existing value to my table . In this case its assign value to table feld but its thrown a error on currentForecastTable update method "The record never been selected" and in this way its update the field value with new value. This code not working properly.

Please give me suggestions.

Thanks.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,861 Super User 2024 Season 2 on at
    RE: Data should not be update in uneditable field and existing value in field not change through excel add-in

    Hi Muhammad,

    In that case you can consider adding validations using the methods validateWrite or validateFieldValue.

  • Awais Qurni Profile Picture
    Awais Qurni 56 on at
    RE: Data should not be update in uneditable field and existing value in field not change through excel add-in

    But In my scenario field can editable or not editable  If editable and user put some values after this he lock the field and

    export data in excel and user value change field value in excel and publish so, the existing value never changed.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,861 Super User 2024 Season 2 on at
    RE: Data should not be update in uneditable field and existing value in field not change through excel add-in

    Hi Muhammad,

    Why aren't you simply make this field read only on the table and/or data entity? If the field should be non-editable based on conditions, then I would recommend writing a validation and return an error instead of trying to update records.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,540 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans