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

Workflow form redirect shows all records.

(0) ShareShare
ReportReport
Posted on by 66

Hi all,

I have created a custom workflow and it works perfectly .

The problem is that the approval manager when checks the "work items assigned to me " form , I tiwll show a record saying "abc submitted".

On click of this it actually opens the workflow list form which again has a hyperlink form to the main table but the problem is that when the main form is opened it shows all the records to the approval manager . I am not sure if we need to write some logic on init for this too as I was assuming that this works by std.

Am I missing any setting.

Below requirement when form is opened normally.

Also the custom form on which workflow is set needs to show records to users based on their userid only  So user a will see 10 records submitted by him only and not of other users.

However the manager will see all the records whenever this form is open via normal ways.

Thanks,

VK

I have the same question (0)
  • Suggested answer
    Dynamics Community 101 Profile Picture
    310 on at
    RE: Workflow form redirect shows all records.

    Hi Vicky,

    Please ensure that menu items assigned in workflow approval and workflow type are of detail page form and not list page forms.

  • Suggested answer
    Komi Siabi Profile Picture
    13,089 Most Valuable Professional on at
    RE: Workflow form redirect shows all records.

    Hello Vicky,

    You need to have two form a detail page and a list page. On the detail page, you need to write a line of code on the form init, and on the datasource execute query.

    RecId record;
    
    /// 
    /// Form init
    /// 
    public void init()
    {
        YourTable yourTable = element.args().record();
        record = yourTable.RecId;
        super();
    }

    Datasource

    /// 
    /// Datasource 
    /// 
    public void executeQuery()
    {
        QueryBuildRange         qr;
        
        qr = this.Query().dataSourceTable(tableNum("yourTable")).addRange(fieldNum(yourTable,recid));
        qr.value(SysQuery::value(record));
        qr.status(RangeStatus::Locked);
        super();
    }

  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at
    RE: Workflow form redirect shows all records.

    Hi vicky,

    As per komi comment you need to add caller as query range to details form.

    Also you mentioned another requirement - Show data based on the user ID. For this you need to enable created by property to yes on the table level.

    On the execute query you need to check whether logged in user ID is not manager means - add the range to created by field and value should be curuserid() and on the else statement clear range.

    Thanks,

    Girish S.

  • vicky1234 Profile Picture
    66 on at
    RE: Workflow form redirect shows all records.

    Thanks Komi and Girish

    the above code works .

    For the user filteration  ssue I wrote another logic to fix it.

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