Tuesday, March 23, 2021

Time Function In SSRS reports D365FO

 Time Function In SSRS reports D365FO. Convert seconds to 1:00 pm.




=Format(TimeSerial(0,0,first(Fields!JobOrderTime.Value, "ServiceOrder")),"hh:mm:ss tt")


Keep Daxing!!

get warehouse address In D365FO

 If you want to get address of from warehouse:


InventLocation::find(InventLocationId).logisticsPostalAddress().Address;

InventLocation::find(InventLocationId).Address();

--------------------------------------------or--------------------------------------------------------

Based on role type:

Get delivery type primary address of warehouse:


public static RefRecId getDeliveryAddressRecid(InventLocationId _inventLocationId) { InventLocation inventlocation = InventLocation::find(_inventLocationId); InventLocationLogisticsLocation inventLocationLogisticsLocation; InventLocationLogisticsLocationRole inventLocationLogisticsLocationRole; LogisticsLocationRole logisticsLocationRole; LogisticsPostalAddress postalAddress; select firstonly location from inventLocationLogisticsLocation where inventLocationLogisticsLocation.InventLocation == inventLocation.RecId && inventLocationLogisticsLocation.IsPrimary == true exists join inventLocationLogisticsLocationRole where inventLocationLogisticsLocationRole.LocationLogisticsLocation == inventLocationLogisticsLocation.RecId exists join logisticsLocationRole where inventLocationLogisticsLocationRole.LocationRole == logisticsLocationRole.RecId && logisticsLocationRole.Type == LogisticsLocationRoleType::Delivery; if (inventLocationLogisticsLocation.Location) { TransDateTime now = DateTimeUtil::getSystemDateTime(); select firstonly validtimestate(now) RecId from postalAddress where postalAddress.Location == inventLocationLogisticsLocation.Location; } return postalAddress.RecId ? postalAddress.RecId : nullValueFromType(Types::Int64); }

--------------------------------------------or--------------------------------------------------------

public static void getDeliveryAddress(RefRecId _inventLocationRecId) {

    InventLocationLogisticsLocation        inventLocationLogisticsLocation;

    Select firstOnly inventLocationLogisticsLocation     where inventLocationLogisticsLocation.InventLocation == _inventLocationRecId     && inventLocationLogisticsLocation.IsPrimary == NoYes::Yes;

}


Keep Daxing!!

Get current company's Contact Information In D365 FO

 Get current company's Contact Information In D365 FO.

    

    static void CompanyPhone(Args _args)

{

    DirPartyLocation            dirPartyLocation;

    LogisticsElectronicAddress  electronicAddress;

    CompanyInfo                 companyInfo;

    

    companyInfo = companyInfo::find();

    

    select dirPartyLocation

        where dirPartyLocation.Party == companyInfo.RecId

        &&  dirPartyLocation.IsPostalAddress == NoYes::No

        join electronicAddress

        where electronicAddress.Location == dirPartyLocation.Location

        && electronicAddress.Type == LogisticsElectronicAddressMethodType::Phone;

    {

        info(strFmt("Description: %1, Contact number/address: %2",  electronicAddress.Description, electronicAddress.Locator));

    }

}

Keep Daxing!!

Monday, March 15, 2021

How to disable system defined buttons in standard form of d365?

   How to disable system-defined buttons in the standard form of d365?



Right-click on the button and copy the name.



check the Below code.


    FormCommandButtonControl 	newButton;

    #SysSystemDefinedButtons //- standard macro

    // #SystemDefinedNewButton - button name.

    newButton = sender.control(sender.controlId(#SystemDefinedNewButton)) as FormCommandButtonControl;

    newButton.visible(false);

    // Disable in design
    sender.formRun().design().showNewButton(0);
    this.form().design().showNewButton(0);

Keep Daxing!!


change view mode to edit mode of a form In D365Fo

How to change form view mode to edit mode in D365.


  • To subscribe to view/edit mode switching, use these events:
    • element.viewEditModeHelper().EditModeSwitching
    • element.viewEditModeHelper().EditModeSwitche
  • To query the current view/edit mode, use these events:
    • element.viewEditModeHelper().isInEditMode()
    • element.viewEditModeHelper().IsInViewMode()
  • To trigger view/edit mode switching, use these events:
    • element.viewEditModeHelper().setViewEditMode(ViewEditMode::Edit)

Keep Daxing!!

Wednesday, March 10, 2021

Convert HexaDecimal value to decimal in d365Fo using X++

 Convert HexaDecimal value to decimal in d365Fo using X++.


Check below code:

{

        int R, G, B;

        str      colorStr = '#00FF00';

        R = hex2int(substr(colorStr,2,2));

        G = hex2int(substr(colorStr,4,2));

        B = hex2int(substr(colorStr,6,2));

 

        info(strFmt('%1',WinAPI::RGB2int(R,G,B)));

        info(strFmt('%1',WinAPI::RGB2int(0,255,0)));

}

Keep Daxing!!