Thursday, April 16, 2026

How to make a workflow global or legal entity specific

 scenario :- Generally in Dynamics there are some workflows with globally and some are Legal entity specific . With association type  as shown in below

Step 1:- To make a workflow global or Legal entity specific. Go to visual studio >

find the workflow type and click on properties and in  Association type choose the type you need as shown in below

Note :- Don't change this for standard workflows. And can use this for Custom mostly.

Wednesday, April 15, 2026

DB restore from tier 2 to tier 1

 Step 1:- Get Backpac file to your dev machine

Step2:- move this file to location as shown in below

                                     

Step 2 :- Navigate to Download and Install SqlPackage - SQL Server | Microsoft Learn 

and scroll down for windows package as shown in below

download the file and extract the zip file

Step 3:- open the file and copy location as shown in below


Step 4:-Open commnd promt with run of administrator and run cd paste the location copied from above as shown in below

Step5:-run this command SqlPackage.exe /a:import /sf:J:\MSSQL_BACKUP\uatbackup.bacpac /tsn:localhost /tdn:AXDB_New /TargetTrustServerCertificate:True  /p:CommandTimeout=1500


Step 6:-Wait for 6 hours until you see DB restored sucessfully.

Step 7:-Go to SSMS >Database >AXDB>properites>makes multiuser to single user 

then Rename to AXDB_OLD 

Step 8:-Rename AXDB_New (new db restored) to AXDB 

Make AXDB_OLD  properties to single user

Step 9:-Restart all services. Now Dev machines runs with Tier 2 database 

Note:- This process is when you have been given with bacpac file (usually when we export tier 2 it will be bacpac only.most of the time we get bacpac file only).

If we get bac file we can directly restore with in few steps and lesstime in ssms itself without cmd promt.


Thank you!!





Tuesday, February 24, 2026

Generate entity diagram in d365fo

 Today in this blog we learn about how to see relations between tables in pictorial representation.

Step1:- Navigate to Github https://github.com/noakesey/d365fo-entity-schema and click on releases as shown in below

Step2:- Down the first DLL file as shown in below

Step3:-Once you have downloaded the file it will shown in warning file click on three dots >Keep>Keep anyway as shown in below

Step4:-Click on the properties of the file and click on unblock and apply as shown in below

Step5:-Copy the file and place in folder

Navigation:-

C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\jalba1yr.dr0\AddinExtensions

If jalbalyr.dr0 folder not available then paste folder  in C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions

Step6:-Go to any table>rightclik>Addins>Generate entity relation schema as shown in below

Step7:-Click on outward and inward >DBML as shown in below

Step8:-Copy the whole code and click on the link as shown in below

Step9:-then click on create diagram as shown in below

Step10:-Clear existing code in left pane and paste the code copied in VS as shown in below

Thank you!!

Wednesday, February 18, 2026

Perform actions to workflow with code in d365fo x++

 Scenario:- We can do some actions in workflow through code 

1) Submit:-

Code:-

WorkflowTypeName   workflowTypeName  =  workflowTypeStr(CustomWorkflowType);

Workflow::activateFromWorkflowType(workflowTypeName,  Table.RecId, workflowComment, NoYes::No);

2) Approve:-

Code:-

WorkflowWorkItemTable workflowWorkItemTable;

WorkflowTypeName  workflowTypeName  =  workflowTypeStr(CustomWorkflowType);
select firstonly workflowWorkItemTable
where  workflowWorkItemTable.Type   == WorkflowWorkItemType::WorkItem
&&  workflowWorkItemTable.Status    == WorkflowWorkItemStatus::Pending
&&  workflowWorkItemTable.RefTableId== tableNum(EmployeeTable)
&&  workflowWorkItemTable.RefRecId  ==  5637144576;

 

if(workflowWorkItemTable)
{
     WorkflowWorkItemActionManager::dispatchWorkItemAction(workflowWorkItemTable,"Auto Approve by system",curUserId(), WorkflowWorkItemActionType::Complete,menuitemDisplayStr(Employee));       

}

3) cancel or recall  :-

Code:-

         WorkflowWorkItemTable workflowWorkItemTable;

WorkflowTypeName  workflowTypeName  =  workflowTypeStr(CustomWorkflowType);
  select firstonly workflowWorkItemTable
where  workflowWorkItemTable.Type   == WorkflowWorkItemType::WorkItem
&&  workflowWorkItemTable.Status    == WorkflowWorkItemStatus::Pending
&&  workflowWorkItemTable.RefTableId== tableNum(EmployeeTable)
&&  workflowWorkItemTable.RefRecId  ==  5637146826;

 

if(workflowWorkItemTable)
{

  Workflow::cancelWorkflow(workflowWorkItemTable.CorrelationId, "cancel by code");
  }


4) Resume:-

Code:-

         Workflowtrackingstatustable workflowTrackingStatusTable;

    select * from workflowTrackingStatusTable where workflowTrackingStatusTable.CONTEXTRECID == 5637147576
&& workflowTrackingStatusTable.CONTEXTTABLEID == tableNum(EmployeeTable);


    if(workflowTrackingStatusTable)
   {

     Workflow::resumeWorkflow(workflowTrackingStatusTable.CorrelationId, "resume by code");

  }

Thankyou!!


Tuesday, February 17, 2026

Run some logic in workflow at particular step using WorkflowAutomatictask

 Scenario:- If you want to run some logic in workflow at particular we can use WorkflowAutomatictask

Step1:- create a class 

 Code:-

       class CustomWorkflowAutomatedEvnentHandler implements WorkflowElementExecutionEventHandler

{
    public void execute(WorkflowElementEventArgs _workflowElementEventArgs)
    {
        WorkflowContext    workflowContext = _workflowElementEventArgs.parmWorkflowContext();

 

        RecId recid = workflowContext.parmRecId();

 

        EmployeeTable emptable;

 

        select * from emptable where emptable.RecId == recid;

 

        info(strFmt("%1",emptable.EmployeeId));
    }

 

}

Step2:- Add Workflowautomatictask and give properties as shown in below

Step3:-In the supported elements add this automatic task and give type as automatictask.

Step4:-Open frontend and drag this automatictask to run some logic as shown in below

Thankyou!!

Add approvers at runtime using Assignment provide class in D365fo

 Step1:-Create a class code as follows

Code;- 

        class CustomworkflowAssignmentProviderClass implements WorkflowParticipantprovider

{
    public WorkflowParticipantTokenList getParticipantTokens()
    {
        WorkflowParticipantTokenList tokens = WorkflowParticipantTokenList::construct();

        tokens.add("Level1","Level 1");
        return tokens;
    }

 

    public WorkflowUserList resolve(WorkflowContext _context,
                                    WorkflowParticipantToken _participantTokenName)
    {
        WorkflowUserList    userList = WorkflowUserList::construct();

 

        EmployeeTable emptable;
        UserGroupInfo usergroupinfo;
        UserGroupList usergrouplist;

 

       

 


        switch(_participantTokenName)
        {
            case "Level1" :
                select * from emptable
            where emptable.RecId == _context.parmRecId();

 

                if(emptable.AssigneeType == AssigneeType::User)
                {
                    userList.add(emptable.User);

 

                }
                else
                {
                    while select usergrouplist
               where usergrouplist.groupId == emptable.User
                    {
                        userList.add(emptable.User);
                    }

                }
                break;

 


        }


        if (userList.getCount() == 0)
        {
            throw error(strFmt("User can not found"));
        }
        return userList;
    }

 

}

Step2:-Add Workflow participant provide and give AssignmentProviderClass in properties and add

Workflow type with new element give workflow type as shown in below

Step3:-Build and sync then add this assignment provide in assignment section in Workflow configurator

That's all

Thankyou


Monday, February 16, 2026

Custom workflow with drop dialog as standard in d365fo

 If we want get output of workflow like dropdialog as some of standard workflows please follow steps

output expected:-

Step1:-Please develop basic workflow first by using link below

https://manidynamics.blogspot.com/2026/02/custom-workflow-in-d365fo.html

Step2:-Go to any standard forms , here i have chosen Purchtable confirm workflow and locate control as shown in below

Step3:-Go to that form and duplicate similar to your project as shown in below

Step4:-Change cord in Formlevel replace with your table and workflowtype names and in cansubmit instead caller use record.cansubmitworkflow

Step5:-Create  a display menuitem for this form

Step6:-Create a buttongroup control and add button and give properties of menuitem created in above step.Also change normalimage property to Workflow as shown in below

Step7:-Remove formdesign properties workflowtype 

Output :-

configure workflow in frontend .

Thankyou!!

How to make a workflow global or legal entity specific

 scenario :- Generally in Dynamics there are some workflows with globally and some are Legal entity specific . With association type  as sho...