Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

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

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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' 

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

    Hi Sachin,

    You if you want to update the approver name, you have to do it when the record is approved. This is a display method which will just display the value of the approver.

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

    Hello Mr. Gunjan ,

    What if want to store this value in my database field column "ApprovedByName". as of now in DB no value is showing if is use this.ApprovedByName = approvername; or remove it from method.

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

    Hi Sachin,

    Please make this small modification to the method. You don't need to assign value to a field in this method -

     if (workflowTrackingTable.RecId)
    {
        approvername 		= workflowtrackingtable.User;
    }

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

    Hello Mr. Gunjan, you are  absolutely right. i was referencing data field instead of data method. it showing approver name now. I have used below method. and approver name is displaying now.

       display public server WorkflowApprovalName  Displayapprovername()
        {
            WorkflowTrackingStatusTable workflowTrackingStatus;
            WorkflowTrackingTable workflowTrackingTable;
            WorkflowTrackingCommentTable workflowTrackingCommentTable;
            WorkflowApprovalName approvername;
            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;
        }

    Error68.PNG

    Thank you so so much for your help and identified the issue.      

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

    Sachin,

    This is where it is going wrong.  Remove the data field property and populate the data method property with "displayapprovername". This is the data method you have written for the approver name.

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

    Hello , Please find the Approvedby properties below.

    Error67.PNG

  • Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 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
    Community Member Microsoft Employee 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
    Gunjan Bhattachayya 35,421 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
    Community Member Microsoft Employee on at
    RE: Approver Name is not Displaying on Customized Form Dynamics 365 F&O

    Hello,

    Still the same nothing in approved by field.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans