web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Edit a field in a record

(0) ShareShare
ReportReport
Posted on by 50

Hi Team,

I just have a question with regards to the un-editable fields in records that belongs to forms which has a workflow on it, one case that I faced is that a user has submitted a record in a certain form which later he requested to edit a field in that record and since it's submitted I can't edit the filed in that record to the correct value.

This case happen in the production environment, and as you know we cannot access the DB in the production environment.

I come across a solution which I heard but I'm not sure how the implementation of it how it goes in X++, what I heard is that to edit a record in the production environment, you have to use "Batch Jobs" to trigger a runnable class in which this will help to edit the specified field in that record to be updated with the desired value needed.

Another solutions for this which I heard and it was implemented in the newer versions of Dynamics365 F&O is by using something called "Custom Scripts" which is provided within "System Administration" Module.

My question is: How to achieve this?, is there a tutorial for this case? or if you can guide me with the way of doing it and the x++ code used to achieve this.

Thanks

I have the same question (0)
  • Suggested answer
    omesh Profile Picture
    141 on at

    Hi Mohamd,

    Please check below link. Which explains how to run the custom scripts. Hope this will help you.

    https://d365fokartik.home.blog/2022/06/03/run-custom-x-scripts-with-zero-downtime-d365-finance-and-operation

    Thank You,

    Umesh.

  • GirishS Profile Picture
    27,827 Moderator on at

    Hi mohamd,

    Check whether you can achieve this by using open in excel functionality.

    Thanks,

    Girish S.

  • Suggested answer
    Dinaz Profile Picture
    115 on at

    Hi,

    If the workflow is not approved. The reviewer can reject it for the user to re-edit the fields.

    You can also customize few fields and make it editable even after its approved in this way you can maintain the database log.

  • mohamd.dhaif Profile Picture
    50 on at

    Hi omesh 

    Thank you so much for your response, I tried the tutorial offered on the link you provided, I tried it and it works for me and I saw the changes on the record targeted, but after I click: "Purpose resolved"

    pastedimage1662642024788v1.png


    This message appears to me and it rolls back the changes made.

    pastedimage1662642074772v2.png

    What is the issue?

    Thanks again

  • Suggested answer
    Komi Siabi Profile Picture
    13,109 Most Valuable Professional on at

    The error is about your code, you must be using the tts wrongly.

    Maybe you should share your code used to update the record.

    Please use rich formatting ->insert -> code , while pasting your code here.

  • mohamd.dhaif Profile Picture
    50 on at

    This code is written to update "Courses groups" table.

    public static void main(Args _args)
        {
    
            HcmCourseTypeGroup courseTypeGroupTutorial;
    
            if (curExt() != 'BH')
            {
                throw error("This script must run in the BH Company!");
            }
    
            select forupdate courseTypeGroupTutorial
                where courseTypeGroupTutorial.CourseTypeGroupId == 'Testing Course';
            if(courseTypeGroupTutorial.RecId)
            {
                ttsbegin;
                Info("Processing start");
                courseTypeGroupTutorial.CourseTypeGroupId="TGroup-Edited2";
                courseTypeGroupTutorial.doUpdate();
                Info("Processing end");
                ttsbegin;
            }
    
    
        }

  • Suggested answer
    Komi Siabi Profile Picture
    13,109 Most Valuable Professional on at

    Hi,

    In your code, you have ttsbeggin twice without a ttscommit. In addition, you should enclose your operation in between the beggin and the commit.

    public static void main(Args _args)
    {
    
    HcmCourseTypeGroup courseTypeGroupTutorial;
    
    if (curExt() != 'BH')
    {
    throw error("This script must run in the BH Company!");
    }
    
    ttsbeggin;
    select forupdate courseTypeGroupTutorial
    where courseTypeGroupTutorial.CourseTypeGroupId == 'Testing Course';
    if(courseTypeGroupTutorial.RecId)
    {
    Info("Processing start");
    courseTypeGroupTutorial.CourseTypeGroupId="TGroup-Edited2";
    courseTypeGroupTutorial.doUpdate();
    Info("Processing end");
    }
    ttscommit;
    

  • mohamd.dhaif Profile Picture
    50 on at

    Thank you Komi Siabi,

    Might be the tutorial I've followed they put this for the purpose of not modifying data for who's trying to test the code provided, I'll be testing it and get back to you confirming.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 456 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans