Notifications
Announcements
No record found.
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
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
above is my suggested answer
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.
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
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2