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 :
Microsoft Dynamics AX (Archived)

I have number of objects starts with prefix XXX, i want to change prefix with YYY. How can i do it. Please let me know the best way to do it. Thanks.

(0) ShareShare
ReportReport
Posted on by 70

I have number of objects starts with prefix XXX, i want to change prefix with YYY. How can i do it. Please let me know the best way to do it. Thanks.

*This post is locked for comments

I have the same question (0)
  • Amir Nazim Profile Picture
    5,994 on at

    HI Ajay,

    i think the reflection would be best for you if you have high number of objects. i have created a quick job for you that give you an idea about how you can update the name through reflection.
    you can use below job to implement it according to your requirements

    // the job is just updating the name of one object. you can modify it to update all the objects that you want to update.
    static void RenameXXXObjectsToYYY(Args _args)
    {
        TreeNode    node = TreeNode::findNode(@'\Classes\XXXClass');

        str oldName;
        str newName;

        #Properties
        ;
        oldName = node.AOTgetProperty(#PropertyName);
        newName = strdel(oldName,1,3);
        node.AOTsetProperty(#PropertyName, "YYY"+newName);
        node.AOTsave();

        node.treeNodeRelease();
        node = null;
    }

    // if you dont know the exact objects and you would like to know with again through reflection then you can again modify the below job accordinig to your requirement.

    static void FindClassStartsWithXXX(Args _args)
    {
        UtilIdElements utilId;
    ;
        while select utilId where utilid.recordType == UtilElementType::Class
        && utilId.name like 'XXX*'
        {
            print utilId.name;
        }
        pause;
    }

    you have to make sure the compile errors for all the objects your self. as changiing the prefix may cause compile error.

    let me know if you seeing any problem in that

  • Verified answer
    Amir Nazim Profile Picture
    5,994 on at

    above is my suggested answer

  • Ajay jaiswal Profile Picture
    70 on at

    Hi Amir,

    Thanks for the reply.

    I have tested above piece of codes and it will be little helpful for me.

    let suppose, i have an EDT ABCAction, there are many places in the application where this EDT is using.

    Is there any way to modify all the reference by program where this EDT is using?

    Please suggest. Thanks.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    I would try the following aproach:

    - generate a list of object names to change (e.g. by creating a project using Advanced Filter and copy names by Add-Ins > Copy > Name)

    - create an .xpo containing all object where objects to rename can occur (e.g. .xpo from your development layer)

    - write a script (in your favorite language) to take each name and replace all its occurence in the .xpo with the new name

  • Ammar Salah Profile Picture
    150 on at

    what you need to do, export the project as xpo, open in notepad, use find and replace tool, save, import the modified xpo into AX.

    check your modifications

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans