Wednesday, July 31, 2019
Friday, July 26, 2019
Disable users in AX using Sql Query
Open SSMS> New Query> Copy paste and run the query
update USERINFO SET ENABLE=0
where NAME in ('Uma Shankar')
You can disable multiple users by passing comma separated user names in the where condition.
Thanks,
Uma
Thursday, July 25, 2019
Tuesday, July 23, 2019
How to get cost price of an Item based on Warehouse X++
public real GetCostPrice(ItemId _itemId, InventLocationId _inventLocationId)
{
InventDimParm inventDimParm;
InventOnHand inventOnHand;
InventSum inventSum;
InventDim inventDim;
;
select firstOnly1 inventSum where inventSum.ItemId == _itemId;
//inventDim.InventSiteId = "SiteId";
inventDim.InventLocationId = _inventLocationId;
inventDimParm.initFromInventDim(inventDim);
inventOnHand = InventOnHand::newItemDim(inventSum.ItemId, inventDim, inventDimParm);
return inventOnHand.costPricePcs();
// info(strfmt("%1", inventOnHand.costPricePcs()));
}
Thanks
Uma
{
InventDimParm inventDimParm;
InventOnHand inventOnHand;
InventSum inventSum;
InventDim inventDim;
;
select firstOnly1 inventSum where inventSum.ItemId == _itemId;
//inventDim.InventSiteId = "SiteId";
inventDim.InventLocationId = _inventLocationId;
inventDimParm.initFromInventDim(inventDim);
inventOnHand = InventOnHand::newItemDim(inventSum.ItemId, inventDim, inventDimParm);
return inventOnHand.costPricePcs();
// info(strfmt("%1", inventOnHand.costPricePcs()));
}
Thanks
Uma
Get OnHand Stock value using Warehouse, Date and ItemId using X++
public real GetOnHandStock(InventLocationId _warehouse,TransDate _transDate,Itemid _itemid)
{
InventDim inventDim;
InventDimParm inventDimParm;
InventLocation inventLocation;
InventSumDatePhysicalDim inventSumDatePhysicalDim;
real OnhandQty;
inventLocation = InventLocation::find(_warehouse);
inventDim.wMSLocationId =inventLocation.WMSLocationIdDefaultReceipt;
inventDim.InventLocationId = inventLocation.InventLocationId;
inventDim.InventSiteId =inventLocation.InventSiteId;
inventDim = InventDim::findOrCreate(inventDim);
inventDimParm.initFromInventDim(inventDim);
OnhandQty = InventSumDatePhysicalDim::onHandQty(_transDate,_itemid,inventDim,inventDimParm);
return OnhandQty;
}
{
InventDim inventDim;
InventDimParm inventDimParm;
InventLocation inventLocation;
InventSumDatePhysicalDim inventSumDatePhysicalDim;
real OnhandQty;
inventLocation = InventLocation::find(_warehouse);
inventDim.wMSLocationId =inventLocation.WMSLocationIdDefaultReceipt;
inventDim.InventLocationId = inventLocation.InventLocationId;
inventDim.InventSiteId =inventLocation.InventSiteId;
inventDim = InventDim::findOrCreate(inventDim);
inventDimParm.initFromInventDim(inventDim);
OnhandQty = InventSumDatePhysicalDim::onHandQty(_transDate,_itemid,inventDim,inventDimParm);
return OnhandQty;
}
How Get Item Group Name (ItemGroupName) of an ItemId using x++
Get Item Group Name (ItemGroupName) of an ItemId using x++
class ItemGroupName
{
public static void main(Args _args)
{
InventItemGroupItem inventItemGroupItem;
inventItemGroupItem=InventItemGroupItem::findByItemIdLegalEntity('256473');
// 256473 is Item Number
info(strFmt("%1", inventItemGroupItem));
}
}
Thanks
Uma
class ItemGroupName
{
public static void main(Args _args)
{
InventItemGroupItem inventItemGroupItem;
inventItemGroupItem=InventItemGroupItem::findByItemIdLegalEntity('256473');
// 256473 is Item Number
info(strFmt("%1", inventItemGroupItem));
}
}
Thanks
Uma
Thursday, July 18, 2019
How to Get Start Date and End Date from a Date (SystemDateGet())
How to Get Start Date and End Date from a Date
utcDateTime fromDateTime,toDateTime;
fromDateTime= DateTimeUtil::newDateTime((DateStartMth(SystemDateGet())),str2time("00:00:00.000 AM"),DateTimeUtil::getUserPreferredTimeZone());
toDateTime= DateTimeUtil::newDateTime((endmth(SystemDateGet())),str2time("23:59:59.000 PM"),DateTimeUtil::getUserPreferredTimeZone());
You can build a date range where fromDateTime is starting date of a month and toDateTime is ending date of a month.
Thanks
Uma
utcDateTime fromDateTime,toDateTime;
fromDateTime= DateTimeUtil::newDateTime((DateStartMth(SystemDateGet())),str2time("00:00:00.000 AM"),DateTimeUtil::getUserPreferredTimeZone());
toDateTime= DateTimeUtil::newDateTime((endmth(SystemDateGet())),str2time("23:59:59.000 PM"),DateTimeUtil::getUserPreferredTimeZone());
You can build a date range where fromDateTime is starting date of a month and toDateTime is ending date of a month.
Thanks
Uma
Subscribe to:
Posts (Atom)
Get Enum Id and Enum Value in D365FO using SQL and X++
Below is the sql get enum id and enum value of a enum in D365 F&O using sql. SELECT enumidtable . NAME 'Enum Name' ...
-
class RoundUpto2decimalPoints { public static void main(Args _args) { real cost = 0.057139; info(st...
-
While doing customization I came across a scenario where the datatype of a column was of string type and value was stored as "1111.9379...
-
Recent below questions were asked to fresher during technical interview. His answers were noted down. My intention here is to help freshe...