Monday, January 23, 2023

update_recordset using queryrun class in D365FO

//intialize the query
Query                  salesActivityLineQuery = new Query();
QueryBuildDataSource    SalesActivityLineDS = salesActivityLineQuery.addDataSource(tableNum(SalesActivityLine));
SalesActivityLineDS.addRange(fieldNum(SalesActivityLine_DIS, RecId)).value(con2Str(conSalesActivityLineRecId));

//Initialize Map and specify the field and field value to be updated
Map fieldSetMap1 = new Map(Types::String, Types::String);
fieldSetMap1.insert(fieldStr(SalesActivityLine_DIS, Status), any2Str(ActivityLineStatus_DIS::Rejected));

//Update
Query::update_recordset(fieldSetMap1, salesActivityLineQuery);

No comments:

Post a Comment

Table browser URL in D365FO

Critical Thinking icon icon by Icons8