web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Approver Name is not Displaying on Customized Form Dynamics 365 F&O

(0) ShareShare
ReportReport
Posted on by

Hello Experts, 

I have trying to display approver name and approved date on my customized form and i an following this (Link) article. i write below code for displaying approver name.

   display public server WorkflowApprovalName  Displayapprovername()
       { 
        WorkflowTrackingStatusTable workflowTrackingStatusTable;
        WorkflowTrackingTable WorkflowTrackingTable;
        WorkflowApprovalName approvername;
        select firstonly workflowtrackingstatustable
        join workflowtrackingtable
        where workflowtrackingstatustable.ContextRecId == this.recid
        && workflowtrackingtable.TrackingContext == workflowtrackingcontext::WorkItem
        && workflowtrackingtable.TrackingType == workflowtrackingtype::Approval
        && workflowtrackingtable.WorkflowTrackingStatusTable == workflowtrackingstatustable .recid;
        {
            approvername = workflowtrackingtable.User;
             return approvername;
            this.ApprovedByName=approvername;
        }

    }

But when creating a new record and approver approves it , nothing appearing in form field. can someone advise what is the issue or if i am making any mistake in the code.

Form Field.

Error65.PNG

Also i want to see the approver name in SSMS using SQL script. i am using below query and expecting USER column to display the approver name but using this query it shows the wrong names not the approver name. please advise how to see approver name in SQL.

 select * from workflowtrackingstatustable wfs
join workflowtrackingtable wft
on wfs.ContextRecId = wft.recid and CONFIGURATIONNUMBER='000401' 

I have the same question (0)
  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at
    RE: Approver Name is not Displaying on Customized Form Dynamics 365 F&O

    Hi Sachin,

    Please try this method and check if you get the approver User Id -

    display public server WorkflowApprovalName  Displayapprovername()
    {	
    	WorkflowTrackingStatusTable workflowTrackingStatus;  
    	WorkflowTrackingTable workflowTrackingTable;  
    	WorkflowTrackingCommentTable workflowTrackingCommentTable;  
    	UserInfo userInfo;  
    
    	select firstFast RecId, User from workflowTrackingTable  
    		order by RecId desc   
    		join workflowTrackingCommentTable   
    			where workflowTrackingCommentTable.WorkflowTrackingTable ==  workflowTrackingTable.RecId  
    		join UserInfo where UserInfo.id == WorkflowTrackingTable.User  
    		exists join workflowTrackingStatus  
    			where workflowTrackingTable.WorkflowTrackingStatusTable ==   workflowTrackingStatus.RecId  
    		&& workflowTrackingStatus.ContextRecId == this.RecId  
    		&& workflowTrackingStatus.ContextTableId == tableNum(this)
    		&& workflowTrackingTable.TrackingType == WorkflowTrackingType::Approval;  
    
    		if (workflowTrackingTable.RecId > 0)  
    		{  
    			approvername 		= workflowtrackingtable.User;
    			this.ApprovedByName = approvername;
    		}  
    		
    	return approvername;
    }

    As for the SSMS query, you can model this after the X query in the method above. As per your query, I have made some modifications but haven't tested it. You might need to tweak this more to get the desired result -

    select * from workflowtrackingstatustable wfs
    	join workflowtrackingtable wft ON wft.WorkflowTrackingStatusTable = wfs.RECID
    	    WHERE wft.CONFIGURATIONNUMBER='000401' 

  • Community Member Profile Picture
    on at
    RE: Approver Name is not Displaying on Customized Form Dynamics 365 F&O

    Hello Gunjan,

    Thanks for looking into this issue ,  i have tried your method there is one error it shows. please advise what reference i should mention to correct it. please find the screen shot below.

    Screenshot-_2800_8_2900_.png

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at
    RE: Approver Name is not Displaying on Customized Form Dynamics 365 F&O

    Hi Sachin,

    My bad. Please try this -

    display public server WorkflowApprovalName  Displayapprovername()
    {	
    	WorkflowTrackingStatusTable workflowTrackingStatus;  
    	WorkflowTrackingTable workflowTrackingTable;  
    	WorkflowTrackingCommentTable workflowTrackingCommentTable;  
    	UserInfo userInfo;  
    
    	select firstFast RecId, User from workflowTrackingTable  
    		order by RecId desc   
    		join workflowTrackingCommentTable   
    			where workflowTrackingCommentTable.WorkflowTrackingTable ==  workflowTrackingTable.RecId  
    		join UserInfo where UserInfo.id == WorkflowTrackingTable.User  
    		exists join workflowTrackingStatus  
    			where workflowTrackingTable.WorkflowTrackingStatusTable ==   workflowTrackingStatus.RecId  
    		&& workflowTrackingStatus.ContextRecId == this.RecId  
    		&& workflowTrackingStatus.ContextTableId == this.tableId
    		&& workflowTrackingTable.TrackingType == WorkflowTrackingType::Approval;  
    
    		if (workflowTrackingTable.RecId > 0)  
    		{  
    			approvername 		= workflowtrackingtable.User;
    			this.ApprovedByName = approvername;
    		}  
    		
    	return approvername;
    }

  • Community Member Profile Picture
    on at
    RE: Approver Name is not Displaying on Customized Form Dynamics 365 F&O

    Hello Gunjan,

    I tried the method you have advised but unfortunately still Approved by field is not displaying anything.

    Error66.PNG

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at
    RE: Approver Name is not Displaying on Customized Form Dynamics 365 F&O

    Hi Sachin,

    Please try this method and check if you get the approver Id -

    display public server WorkflowApprovalName  displayapprovername()
    {
    	WorkflowWorkItemTable workitem;
    
    	select workitem where workitem.RefRecId == this.RecId && workitem.RefTableId == this.TableId &&
    			workitem.Status == WorkflowWorkItemStatus::Completed
    
    	return workitem.UserId;
    }

  • Community Member Profile Picture
    on at
    RE: Approver Name is not Displaying on Customized Form Dynamics 365 F&O

    Hello,

    Still the same nothing in approved by field.

  • Gunjan Bhattachayya Profile Picture
    35,423 on at
    RE: Approver Name is not Displaying on Customized Form Dynamics 365 F&O

    Hi Sachin,

    On which table are you writing this display method? Is the same table linked to the workflow?

  • Community Member Profile Picture
    on at
    RE: Approver Name is not Displaying on Customized Form Dynamics 365 F&O

    Yes its the same table "DRFProjectTable" which i have mentioned during creation of this custom workflow. all other method like initValue()  i have defined in this table only.

  • Gunjan Bhattachayya Profile Picture
    35,423 on at
    RE: Approver Name is not Displaying on Customized Form Dynamics 365 F&O

    Please share a screenshot of the properties of the "Approved By" field in the form design.

  • Community Member Profile Picture
    on at
    RE: Approver Name is not Displaying on Customized Form Dynamics 365 F&O

    Hello , Please find the Approvedby properties below.

    Error67.PNG

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 563 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans