Hi ,
Rename existing record name in dynamics 365
Here i will discuss how to rename already created batch name.
Step 1: Find Duplicate batch number by below code
This code has Having in X++.
class InventBatchIdDuplicateClean
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
InventBatch inventBatch;
InventSum inventSum;
InventBatchid inventBatchid;
Query query;
QueryBuildDataSource datasource;
QueryBuildRange range;
QueryHavingFilter havingFilter;
QueryRun queryRun;
int counter = 0, totalCounter = 0;
query = new Query();
datasource = query.addDataSource(tableNum(InventBatch));
datasource.addSelectionField(fieldNum(InventBatch, inventBatchid),SelectionField::Count);
datasource.orderMode(OrderMode::GroupBy);
datasource.addGroupByField(fieldNum(InventBatch, inventBatchid));
havingFilter = query.addHavingFilter(datasource, fieldStr(InventBatch, inventBatchid),AggregateFunction::Count);
havingFilter.value('>1');
queryRun = new QueryRun(query);
while (queryRun.next())
{
inventBatch = queryRun.getNo(1);
info(strFmt("Group %1", inventBatch.inventBatchid));
}
}
}
Reference
Reference
Step 2: Go to Batch Master. Stock Mgt --> Tracking Dimensions--> Batchs
Search for duplicate record and click on Record Info
(Options --> Page Options --> Record Info --> Rename)
Step 3: Click on rename in below window and change the batch name as you want. It will replace all corresponding transaction for this batch in the system
Rename existing record name in dynamics 365
Here i will discuss how to rename already created batch name.
Step 1: Find Duplicate batch number by below code
This code has Having in X++.
class InventBatchIdDuplicateClean
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
InventBatch inventBatch;
InventSum inventSum;
InventBatchid inventBatchid;
Query query;
QueryBuildDataSource datasource;
QueryBuildRange range;
QueryHavingFilter havingFilter;
QueryRun queryRun;
int counter = 0, totalCounter = 0;
query = new Query();
datasource = query.addDataSource(tableNum(InventBatch));
datasource.addSelectionField(fieldNum(InventBatch, inventBatchid),SelectionField::Count);
datasource.orderMode(OrderMode::GroupBy);
datasource.addGroupByField(fieldNum(InventBatch, inventBatchid));
havingFilter = query.addHavingFilter(datasource, fieldStr(InventBatch, inventBatchid),AggregateFunction::Count);
havingFilter.value('>1');
queryRun = new QueryRun(query);
while (queryRun.next())
{
inventBatch = queryRun.getNo(1);
info(strFmt("Group %1", inventBatch.inventBatchid));
}
}
}
Reference
Reference
Step 2: Go to Batch Master. Stock Mgt --> Tracking Dimensions--> Batchs
Search for duplicate record and click on Record Info
(Options --> Page Options --> Record Info --> Rename)
Step 3: Click on rename in below window and change the batch name as you want. It will replace all corresponding transaction for this batch in the system
Comments
Post a Comment